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: / supports inserting Quote #936

Lucas.Xu071ff06d47bc
diff --git a/frontend/app_flowy/packages/appflowy_editor/assets/images/quote.svg b/frontend/app_flowy/packages/appflowy_editor/assets/images/quote.svg
index 0f3d33f6d3..1393e71556 100644
--- a/frontend/app_flowy/packages/appflowy_editor/assets/images/quote.svg
+++ b/frontend/app_flowy/packages/appflowy_editor/assets/images/quote.svg
@@ -1,3 +1,3 @@
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
- <rect width="40" height="160" x="80" y="20" fill="#00BCF0"/>
+ <rect width="40" height="200" x="80" y="0" fill="#00BCF0"/>
</svg>
\ No newline at end of file
diff --git a/frontend/app_flowy/packages/appflowy_editor/assets/images/selection_menu/quote.svg b/frontend/app_flowy/packages/appflowy_editor/assets/images/selection_menu/quote.svg
new file mode 100644
index 0000000000..5c1cbb4a50
--- /dev/null
+++ b/frontend/app_flowy/packages/appflowy_editor/assets/images/selection_menu/quote.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.4742 9.35161C12.8007 8.99566 13 8.52111 13 8C13 6.89543 12.1046 6 11 6C9.89543 6 9 6.89543 9 8C9 9.04413 9.80011 9.90137 10.8207 9.99207L10.0124 11.1682L10.8365 11.7346L12.4742 9.35161Z" fill="black"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.47395 7.35186C6.80061 6.99588 7 6.52123 7 6C7 4.89543 6.10457 4 5 4C3.89543 4 3 4.89543 3 6C3 7.04411 3.80008 7.90134 4.82061 7.99206L4.01231 9.16823L4.83645 9.73461L6.47395 7.35186Z" fill="black"/>
+</svg>
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart
index 7f4f803610..f4f2006af4 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart
@@ -169,6 +169,14 @@ final List<SelectionMenuItem> _defaultSelectionMenuItems = [
insertCheckboxAfterSelection(editorState);
},
),
+ SelectionMenuItem(
+ name: 'Quote',
+ icon: _selectionMenuIcon('quote'),
+ keywords: ['quote', 'refer'],
+ handler: (editorState, _, __) {
+ insertQuoteAfterSelection(editorState);
+ },
+ ),
];
Widget _selectionMenuIcon(String name) {
diff --git a/frontend/app_flowy/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart b/frontend/app_flowy/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart
index 2711921352..6006fe6a7a 100644
--- a/frontend/app_flowy/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart
@@ -38,17 +38,17 @@ void main() async {
await editor.pressLogicKey(LogicalKeyboardKey.keyE);
expect(
find.byType(SelectionMenuItemWidget, skipOffstage: false),
- findsNWidgets(2),
+ findsNWidgets(3),
);
await editor.pressLogicKey(LogicalKeyboardKey.backspace);
expect(
find.byType(SelectionMenuItemWidget, skipOffstage: false),
- findsNWidgets(3),
+ findsNWidgets(4),
);
await editor.pressLogicKey(LogicalKeyboardKey.keyE);
expect(
find.byType(SelectionMenuItemWidget, skipOffstage: false),
- findsNWidgets(2),
+ findsNWidgets(3),
);
await editor.pressLogicKey(LogicalKeyboardKey.keyX);
expect(
@@ -73,7 +73,7 @@ void main() async {
await editor.pressLogicKey(LogicalKeyboardKey.keyE);
expect(
find.byType(SelectionMenuItemWidget, skipOffstage: false),
- findsNWidgets(2),
+ findsNWidgets(3),
);
await editor.pressLogicKey(LogicalKeyboardKey.escape);
expect(
@@ -89,7 +89,7 @@ void main() async {
await editor.pressLogicKey(LogicalKeyboardKey.keyE);
expect(
find.byType(SelectionMenuItemWidget, skipOffstage: false),
- findsNWidgets(2),
+ findsNWidgets(3),
);
await editor.pressLogicKey(LogicalKeyboardKey.backspace);
await editor.pressLogicKey(LogicalKeyboardKey.backspace);