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.

chore: upgrade editor to 1.2.1 (#2997)

Lucas.Xu098c085d9606
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart
index dd65843f21..762883052e 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart
@@ -99,12 +99,12 @@ void main() {
// expect to the see the inline math equation button is highlighted
inlineMathEquationButton = find.byWidgetPredicate(
(widget) =>
- widget is IconItemWidget &&
+ widget is SVGIconItemWidget &&
widget.tooltip ==
LocaleKeys.document_plugins_createInlineMathEquation.tr(),
);
expect(
- tester.widget<IconItemWidget>(inlineMathEquationButton).isHighlight,
+ tester.widget<SVGIconItemWidget>(inlineMathEquationButton).isHighlight,
isTrue,
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
index d1ccf8823a..52365bc6d2 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
@@ -310,9 +310,10 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
builder.showActions = (_) => true;
builder.actionBuilder = (context, state) {
+ final top = builder.configuration.padding(context.node).top;
final padding = context.node.type == HeadingBlockKeys.type
- ? const EdgeInsets.only(top: 8.0)
- : EdgeInsets.zero;
+ ? EdgeInsets.only(top: top + 8.0)
+ : EdgeInsets.only(top: top);
return Padding(
padding: padding,
child: BlockActionList(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart
index 045f8c6ed4..cc2eb942ff 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart
@@ -114,6 +114,11 @@ class _CalloutBlockComponentWidgetState
@override
GlobalKey<State<StatefulWidget>> get containerKey => widget.node.key;
+ @override
+ GlobalKey<State<StatefulWidget>> blockComponentKey = GlobalKey(
+ debugLabel: CalloutBlockKeys.type,
+ );
+
@override
BlockComponentConfiguration get configuration => widget.configuration;
@@ -177,6 +182,12 @@ class _CalloutBlockComponentWidgetState
),
);
+ child = Padding(
+ key: blockComponentKey,
+ padding: padding,
+ child: child,
+ );
+
if (widget.actionBuilder != null) {
child = BlockComponentActionWrapper(
node: widget.node,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
index 85c6a88679..1490f583cb 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
@@ -101,6 +101,11 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
@override
final forwardKey = GlobalKey(debugLabel: 'flowy_rich_text');
+ @override
+ GlobalKey<State<StatefulWidget>> blockComponentKey = GlobalKey(
+ debugLabel: CodeBlockKeys.type,
+ );
+
@override
BlockComponentConfiguration get configuration => widget.configuration;
@@ -187,6 +192,12 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
),
);
+ child = Padding(
+ key: blockComponentKey,
+ padding: padding,
+ child: child,
+ );
+
if (widget.actionBuilder != null) {
child = BlockComponentActionWrapper(
node: widget.node,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation_toolbar_item.dart
index 77871450bf..3e95e5abb7 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation_toolbar_item.dart
@@ -9,7 +9,7 @@ final ToolbarItem inlineMathEquationItem = ToolbarItem(
id: 'editor.inline_math_equation',
group: 2,
isActive: onlyShowInSingleSelectionAndTextType,
- builder: (context, editorState) {
+ builder: (context, editorState, highlightColor) {
final selection = editorState.selection!;
final nodes = editorState.getNodesInSelection(selection);
final isHighlight = nodes.allSatisfyInSelection(selection, (delta) {
@@ -17,13 +17,14 @@ final ToolbarItem inlineMathEquationItem = ToolbarItem(
(attributes) => attributes[InlineMathEquationKeys.formula] != null,
);
});
- return IconItemWidget(
+ return SVGIconItemWidget(
iconBuilder: (_) => svgWidget(
'editor/math',
size: const Size.square(16),
- color: isHighlight ? Colors.lightBlue : Colors.white,
+ color: isHighlight ? highlightColor : Colors.white,
),
isHighlight: isHighlight,
+ highlightColor: highlightColor,
tooltip: LocaleKeys.document_plugins_createInlineMathEquation.tr(),
onPressed: () async {
final selection = editorState.selection;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart
index 2ba502859b..400ff010bf 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart
@@ -21,7 +21,7 @@ final ToolbarItem smartEditItem = ToolbarItem(
final nodes = editorState.getNodesInSelection(selection);
return nodes.every((element) => element.delta != null);
},
- builder: (context, editorState) => SmartEditActionList(
+ builder: (context, editorState, _) => SmartEditActionList(
editorState: editorState,
),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
index 1889e97311..cab4b7f75e 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
@@ -86,7 +86,7 @@ class _ToggleListBlockComponentWidgetState
SelectableMixin,
DefaultSelectableMixin,
BlockComponentConfigurable,
- BackgroundColorMixin {
+ BlockComponentBackgroundColorMixin {
// the key used to forward focus to the richtext child
@override
final forwardKey = GlobalKey(debugLabel: 'flowy_rich_text');
@@ -97,6 +97,11 @@ class _ToggleListBlockComponentWidgetState
@override
GlobalKey<State<StatefulWidget>> get containerKey => node.key;
+ @override
+ GlobalKey<State<StatefulWidget>> blockComponentKey = GlobalKey(
+ debugLabel: ToggleListBlockKeys.type,
+ );
+
@override
Node get node => widget.node;
@@ -159,6 +164,12 @@ class _ToggleListBlockComponentWidgetState
],
);
+ child = Padding(
+ key: blockComponentKey,
+ padding: padding,
+ child: child,
+ );
+
if (widget.actionBuilder != null) {
child = BlockComponentActionWrapper(
node: node,
diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock
index 799fbc4149..2211ec4b57 100644
--- a/frontend/appflowy_flutter/pubspec.lock
+++ b/frontend/appflowy_flutter/pubspec.lock
@@ -53,11 +53,11 @@ packages:
dependency: "direct main"
description:
path: "."
- ref: "35394cd"
- resolved-ref: "35394cd4f45f3f98afbec8d23d12fe0bf3cd3f6d"
+ ref: "33b18d9"
+ resolved-ref: "33b18d98dcc6db996eef3d6b869f293da3da3615"
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
source: git
- version: "1.1.0"
+ version: "1.2.0"
appflowy_popover:
dependency: "direct main"
description:
diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml
index caf39f353d..350d405154 100644
--- a/frontend/appflowy_flutter/pubspec.yaml
+++ b/frontend/appflowy_flutter/pubspec.yaml
@@ -42,11 +42,10 @@ dependencies:
git:
url: https://github.com/AppFlowy-IO/appflowy-board.git
ref: a183c57
- # appflowy_editor: ^1.0.4
appflowy_editor:
git:
url: https://github.com/AppFlowy-IO/appflowy-editor.git
- ref: 35394cd
+ ref: 33b18d9
appflowy_popover:
path: packages/appflowy_popover
diff --git a/frontend/scripts/code_generation/language_files/generate_language_files.cmd b/frontend/scripts/code_generation/language_files/generate_language_files.cmd
index 470f1654e5..e147c45a8e 100644
--- a/frontend/scripts/code_generation/language_files/generate_language_files.cmd
+++ b/frontend/scripts/code_generation/language_files/generate_language_files.cmd
@@ -13,7 +13,7 @@ cd ..\..\..\appflowy_flutter
REM copy the resources/translations folder to
REM the appflowy_flutter/assets/translation directory
echo Copying resources/translations to appflowy_flutter/assets/translations
-xcopy /E /Y /I ..\resources\translations assets\translations
+xcopy /E /Y /I ..\resources\translations\ assets\translations\
call flutter packages pub get
diff --git a/frontend/scripts/code_generation/language_files/generate_language_files.sh b/frontend/scripts/code_generation/language_files/generate_language_files.sh
index d3bdf7e9b3..86125cdad6 100755
--- a/frontend/scripts/code_generation/language_files/generate_language_files.sh
+++ b/frontend/scripts/code_generation/language_files/generate_language_files.sh
@@ -12,7 +12,7 @@ cd ../../../appflowy_flutter
# copy the resources/translations folder to
# the appflowy_flutter/assets/translation directory
-cp -r ../resources/translations assets/translations
+cp -rf ../resources/translations/ assets/translations/
flutter packages pub get
diff --git a/frontend/scripts/makefile/flutter.toml b/frontend/scripts/makefile/flutter.toml
index d72e4db393..3d4c5ab513 100644
--- a/frontend/scripts/makefile/flutter.toml
+++ b/frontend/scripts/makefile/flutter.toml
@@ -168,7 +168,7 @@ script = [
script = ["""
cd appflowy_flutter/
flutter pub get
- flutter build ${TARGET_OS} --${BUILD_FLAG}
+ flutter build ${TARGET_OS} --${BUILD_FLAG} --verbose
"""]
script_runner = "@shell"