Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: add clear icon into link menu

Lucas.Xua2c4f73e7d9c
diff --git a/frontend/app_flowy/packages/appflowy_editor/assets/images/clear.svg b/frontend/app_flowy/packages/appflowy_editor/assets/images/clear.svg
new file mode 100644
index 0000000000..7f303d737f
--- /dev/null
+++ b/frontend/app_flowy/packages/appflowy_editor/assets/images/clear.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="8" cy="8" r="7" fill="#F2F2F2"/>
+<path d="M6 6L10 10" stroke="#BDBDBD" stroke-linecap="round"/>
+<path d="M10 6L6 10" stroke="#BDBDBD" stroke-linecap="round"/>
+</svg>
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/link_menu/link_menu.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/link_menu/link_menu.dart
index 2c4ba2b975..a33adf3b8c 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/link_menu/link_menu.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/link_menu/link_menu.dart
@@ -100,15 +100,26 @@ class _LinkMenuState extends State<LinkMenu> {
textAlign: TextAlign.left,
controller: _textEditingController,
onSubmitted: widget.onSubmitted,
- decoration: const InputDecoration(
+ decoration: InputDecoration(
hintText: 'URL',
- hintStyle: TextStyle(fontSize: 14.0),
- border: OutlineInputBorder(
+ hintStyle: const TextStyle(fontSize: 14.0),
+ contentPadding: const EdgeInsets.all(16.0),
+ isDense: true,
+ suffixIcon: IconButton(
+ padding: const EdgeInsets.all(4.0),
+ icon: const FlowySvg(
+ name: 'clear',
+ width: 24,
+ height: 24,
+ ),
+ onPressed: () {
+ _textEditingController.clear();
+ },
+ ),
+ border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12.0)),
borderSide: BorderSide(color: Color(0xFFBDBDBD)),
),
- contentPadding: EdgeInsets.all(16.0),
- isDense: true,
),
);
}