diff --git a/CHANGELOG.md b/CHANGELOG.md index 81768b04c..11a296b2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.4.1 +* fix: build error on Flutter 3.13 by @LucasXu0 in ([#488](https://github.com/AppFlowy-IO/appflowy-editor/pull/488)) + ## 1.4.0 * feat: adjust the loading large document optimization in mobile platform by @LucasXu0 in ([#474](https://github.com/AppFlowy-IO/appflowy-editor/pull/474)) * feat: simplify auto scroll behavior in ScrollServiceWidget by @LucasXu0 in ([#437](https://github.com/AppFlowy-IO/appflowy-editor/pull/437)) diff --git a/example/lib/pages/desktop_editor.dart b/example/lib/pages/desktop_editor.dart index fa5cb3053..eb279188f 100644 --- a/example/lib/pages/desktop_editor.dart +++ b/example/lib/pages/desktop_editor.dart @@ -142,7 +142,7 @@ class _DesktopEditorState extends State { ); // customize the padding map.forEach((key, value) { - value.configuration = BlockComponentConfiguration( + value.configuration = value.configuration.copyWith( padding: (_) => const EdgeInsets.symmetric(vertical: 8.0), ); }); diff --git a/example/lib/pages/mobile_editor.dart b/example/lib/pages/mobile_editor.dart index 9c95af43b..6248a91b3 100644 --- a/example/lib/pages/mobile_editor.dart +++ b/example/lib/pages/mobile_editor.dart @@ -55,6 +55,18 @@ class _MobileEditorState extends State { child: MobileFloatingToolbar( editorState: editorState, editorScrollController: editorScrollController, + toolbarBuilder: (context, anchor) { + return AdaptiveTextSelectionToolbar.editable( + clipboardStatus: ClipboardStatus.pasteable, + onCopy: () => copyCommand.execute(editorState), + onCut: () => cutCommand.execute(editorState), + onPaste: () => pasteCommand.execute(editorState), + onSelectAll: () => selectAllCommand.execute(editorState), + anchors: TextSelectionToolbarAnchors( + primaryAnchor: anchor, + ), + ); + }, child: AppFlowyEditor( editorStyle: editorStyle, editorState: editorState, @@ -128,6 +140,11 @@ class _MobileEditorState extends State { fontWeight: FontWeight.w600, ), ); + map[ParagraphBlockKeys.type] = TextBlockComponentBuilder( + configuration: BlockComponentConfiguration( + placeholderText: (node) => 'Type something...', + ), + ); return map; } } diff --git a/lib/src/editor/toolbar/mobile/mobile_floating_toolbar/mobile_floating_toolbar.dart b/lib/src/editor/toolbar/mobile/mobile_floating_toolbar/mobile_floating_toolbar.dart index a5ab1f824..ff216990f 100644 --- a/lib/src/editor/toolbar/mobile/mobile_floating_toolbar/mobile_floating_toolbar.dart +++ b/lib/src/editor/toolbar/mobile/mobile_floating_toolbar/mobile_floating_toolbar.dart @@ -19,11 +19,13 @@ class MobileFloatingToolbar extends StatefulWidget { required this.editorState, required this.editorScrollController, required this.child, + required this.toolbarBuilder, }); final EditorState editorState; final EditorScrollController editorScrollController; final Widget child; + final Widget Function(BuildContext context, Offset anchor) toolbarBuilder; @override State createState() => _MobileFloatingToolbarState(); @@ -149,18 +151,9 @@ class _MobileFloatingToolbarState extends State Widget _buildToolbar( BuildContext context, - Offset? offset, + Offset offset, ) { - return AdaptiveTextSelectionToolbar.editable( - clipboardStatus: ClipboardStatus.pasteable, - onCopy: () => copyCommand.execute(editorState), - onCut: () => cutCommand.execute(editorState), - onPaste: () => pasteCommand.execute(editorState), - onSelectAll: () => selectAllCommand.execute(editorState), - anchors: TextSelectionToolbarAnchors( - primaryAnchor: offset ?? Offset.zero, - ), - ); + return widget.toolbarBuilder(context, offset); } Rect _findSuitableRect(Iterable rects) { diff --git a/pubspec.yaml b/pubspec.yaml index be22000fc..b5a4343ad 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: appflowy_editor description: A highly customizable rich-text editor for Flutter. The AppFlowy Editor project for AppFlowy and beyond. -version: 1.4.0 +version: 1.4.1 homepage: https://github.com/AppFlowy-IO/appflowy-editor platforms: