Skip to content

Commit 000569a

Browse files
abichingerLucasXu0
andauthored
feat: callout (#1732)
* feat: add callout plugin * refactor: add SelectionMenuItem.node factory makes calloutMenuItem more readable * feat: add color picker * feat: add popover to callout * feat: add emoji to callout * fix: store tint name * fix: remove leading underscores * fix: revert export of editor_entry * refactor: move color tint names to appflowy_editor * fix: #1732 only re-insert text node if it's parent is text node too while deleting * docs: doc comment for SelectionMenuItem.node * fix: disable callout plugin should be re-enabled after #1753 is done * fix: typo --------- Co-authored-by: Lucas.Xu <[email protected]>
1 parent 3de4e1c commit 000569a

File tree

15 files changed

+806
-34
lines changed

15 files changed

+806
-34
lines changed

frontend/app_flowy/lib/plugins/document/document_page.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
12
import 'package:appflowy_editor/appflowy_editor.dart';
23
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
34
import 'package:flowy_infra_ui/widget/error_page.dart';
4-
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
55
import 'package:flutter/material.dart';
66
import 'package:flutter_bloc/flutter_bloc.dart';
77
import 'package:intl/intl.dart';
@@ -108,6 +108,8 @@ class _DocumentPageState extends State<DocumentPage> {
108108
kMathEquationType: MathEquationNodeWidgetBuidler(),
109109
// Code Block
110110
kCodeBlockType: CodeBlockNodeWidgetBuilder(),
111+
// Card
112+
kCalloutType: CalloutNodeWidgetBuilder(),
111113
},
112114
shortcutEvents: [
113115
// Divider

frontend/app_flowy/packages/appflowy_editor/lib/l10n/intl_en.arb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,23 @@
7373
"backgroundColorPink": "Pink background",
7474
"@backgroundColorPink": {},
7575
"backgroundColorRed": "Red background",
76-
"@backgroundColorRed": {}
76+
"@backgroundColorRed": {},
77+
"tint1": "Tint 1",
78+
"tint2": "Tint 2",
79+
"tint3": "Tint 3",
80+
"tint4": "Tint 4",
81+
"tint5": "Tint 5",
82+
"tint6": "Tint 6",
83+
"tint7": "Tint 7",
84+
"tint8": "Tint 8",
85+
"tint9": "Tint 9",
86+
"lightLightTint1": "Purple",
87+
"lightLightTint2": "Pink",
88+
"lightLightTint3": "Light Pink",
89+
"lightLightTint4": "Orange",
90+
"lightLightTint5": "Yellow",
91+
"lightLightTint6": "Lime",
92+
"lightLightTint7": "Green",
93+
"lightLightTint8": "Aqua",
94+
"lightLightTint9": "Blue"
7795
}

frontend/app_flowy/packages/appflowy_editor/lib/src/l10n/intl/messages_all.dart

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import 'dart:async';
1313

14+
import 'package:flutter/foundation.dart';
1415
import 'package:intl/intl.dart';
1516
import 'package:intl/message_lookup_by_library.dart';
1617
import 'package:intl/src/intl_helpers.dart';
@@ -40,28 +41,28 @@ import 'messages_zh-TW.dart' as messages_zh_tw;
4041

4142
typedef Future<dynamic> LibraryLoader();
4243
Map<String, LibraryLoader> _deferredLibraries = {
43-
'bn_BN': () => new Future.value(null),
44-
'ca': () => new Future.value(null),
45-
'cs_CZ': () => new Future.value(null),
46-
'de_DE': () => new Future.value(null),
47-
'en': () => new Future.value(null),
48-
'es_VE': () => new Future.value(null),
49-
'fr_CA': () => new Future.value(null),
50-
'fr_FR': () => new Future.value(null),
51-
'hi_IN': () => new Future.value(null),
52-
'hu_HU': () => new Future.value(null),
53-
'id_ID': () => new Future.value(null),
54-
'it_IT': () => new Future.value(null),
55-
'ja_JP': () => new Future.value(null),
56-
'ml_IN': () => new Future.value(null),
57-
'nl_NL': () => new Future.value(null),
58-
'pl_PL': () => new Future.value(null),
59-
'pt_BR': () => new Future.value(null),
60-
'pt_PT': () => new Future.value(null),
61-
'ru_RU': () => new Future.value(null),
62-
'tr_TR': () => new Future.value(null),
63-
'zh_CN': () => new Future.value(null),
64-
'zh_TW': () => new Future.value(null),
44+
'bn_BN': () => new SynchronousFuture(null),
45+
'ca': () => new SynchronousFuture(null),
46+
'cs_CZ': () => new SynchronousFuture(null),
47+
'de_DE': () => new SynchronousFuture(null),
48+
'en': () => new SynchronousFuture(null),
49+
'es_VE': () => new SynchronousFuture(null),
50+
'fr_CA': () => new SynchronousFuture(null),
51+
'fr_FR': () => new SynchronousFuture(null),
52+
'hi_IN': () => new SynchronousFuture(null),
53+
'hu_HU': () => new SynchronousFuture(null),
54+
'id_ID': () => new SynchronousFuture(null),
55+
'it_IT': () => new SynchronousFuture(null),
56+
'ja_JP': () => new SynchronousFuture(null),
57+
'ml_IN': () => new SynchronousFuture(null),
58+
'nl_NL': () => new SynchronousFuture(null),
59+
'pl_PL': () => new SynchronousFuture(null),
60+
'pt_BR': () => new SynchronousFuture(null),
61+
'pt_PT': () => new SynchronousFuture(null),
62+
'ru_RU': () => new SynchronousFuture(null),
63+
'tr_TR': () => new SynchronousFuture(null),
64+
'zh_CN': () => new SynchronousFuture(null),
65+
'zh_TW': () => new SynchronousFuture(null),
6566
};
6667

6768
MessageLookupByLibrary? _findExact(String localeName) {
@@ -116,18 +117,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
116117
}
117118

118119
/// User programs should call this before using [localeName] for messages.
119-
Future<bool> initializeMessages(String localeName) async {
120+
Future<bool> initializeMessages(String localeName) {
120121
var availableLocale = Intl.verifiedLocale(
121122
localeName, (locale) => _deferredLibraries[locale] != null,
122123
onFailure: (_) => null);
123124
if (availableLocale == null) {
124-
return new Future.value(false);
125+
return new SynchronousFuture(false);
125126
}
126127
var lib = _deferredLibraries[availableLocale];
127-
await (lib == null ? new Future.value(false) : lib());
128+
lib == null ? new SynchronousFuture(false) : lib();
128129
initializeInternalMessageLookup(() => new CompositeMessageLookup());
129130
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
130-
return new Future.value(true);
131+
return new SynchronousFuture(true);
131132
}
132133

133134
bool _messagesExistFor(String locale) {

frontend/app_flowy/packages/appflowy_editor/lib/src/l10n/intl/messages_en.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,29 @@ class MessageLookup extends MessageLookupByLibrary {
6363
"highlight": MessageLookupByLibrary.simpleMessage("Highlight"),
6464
"image": MessageLookupByLibrary.simpleMessage("Image"),
6565
"italic": MessageLookupByLibrary.simpleMessage("Italic"),
66+
"lightLightTint1": MessageLookupByLibrary.simpleMessage("Purple"),
67+
"lightLightTint2": MessageLookupByLibrary.simpleMessage("Pink"),
68+
"lightLightTint3": MessageLookupByLibrary.simpleMessage("Light Pink"),
69+
"lightLightTint4": MessageLookupByLibrary.simpleMessage("Orange"),
70+
"lightLightTint5": MessageLookupByLibrary.simpleMessage("Yellow"),
71+
"lightLightTint6": MessageLookupByLibrary.simpleMessage("Lime"),
72+
"lightLightTint7": MessageLookupByLibrary.simpleMessage("Green"),
73+
"lightLightTint8": MessageLookupByLibrary.simpleMessage("Aqua"),
74+
"lightLightTint9": MessageLookupByLibrary.simpleMessage("Blue"),
6675
"link": MessageLookupByLibrary.simpleMessage("Link"),
6776
"numberedList": MessageLookupByLibrary.simpleMessage("Numbered List"),
6877
"quote": MessageLookupByLibrary.simpleMessage("Quote"),
6978
"strikethrough": MessageLookupByLibrary.simpleMessage("Strikethrough"),
7079
"text": MessageLookupByLibrary.simpleMessage("Text"),
80+
"tint1": MessageLookupByLibrary.simpleMessage("Tint 1"),
81+
"tint2": MessageLookupByLibrary.simpleMessage("Tint 2"),
82+
"tint3": MessageLookupByLibrary.simpleMessage("Tint 3"),
83+
"tint4": MessageLookupByLibrary.simpleMessage("Tint 4"),
84+
"tint5": MessageLookupByLibrary.simpleMessage("Tint 5"),
85+
"tint6": MessageLookupByLibrary.simpleMessage("Tint 6"),
86+
"tint7": MessageLookupByLibrary.simpleMessage("Tint 7"),
87+
"tint8": MessageLookupByLibrary.simpleMessage("Tint 8"),
88+
"tint9": MessageLookupByLibrary.simpleMessage("Tint 9"),
7189
"underline": MessageLookupByLibrary.simpleMessage("Underline")
7290
};
7391
}

frontend/app_flowy/packages/appflowy_editor/lib/src/l10n/l10n.dart

Lines changed: 180 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)