diff --git a/CHANGELOG.md b/CHANGELOG.md index f4e428a4..85639249 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ +# [6.0.1] +* Changed translation country code (zh_HK -> zh_hk) to lower case, which is required for i18n_extension used in flutter_quill. +* Add localization in example's main to demonstrate translation. +* Issue [Windows] selection's copy / paste tool bar not shown #861: add selection's copy / paste toolbar, escape to hide toolbar, mouse right click to show toolbar, ctrl-Y / ctrl-Z to undo / redo. +* Image and video displayed in Windows platform caused screen flickering while selecting text, a sample_data_nomedia.json asset is added for Desktop to demonstrate the added features. +* Known issue: keyboard action sometimes causes exception mentioned in Flutter's issue #106475 ([Windows] Keyboard shortcuts stop working after modifier key repeat flutter/flutter#106475). +* Know issue: user needs to click the editor to get focus before toolbar is able to display. + # [6.0.0] BREAKING CHANGE -* Removed embed (image, video & forumla) blocks from the package to reduce app size. +* Removed embed (image, video & formula) blocks from the package to reduce app size. These blocks have been moved to the package `flutter_quill_extensions`, migrate by filling the `embedBuilders` and `embedButtons` parameters as follows: diff --git a/README.md b/README.md index 2c78b30b..96e0eaa5 100644 --- a/README.md +++ b/README.md @@ -85,11 +85,11 @@ _controller = QuillController( For web development, use `flutter config --enable-web` for flutter or use [ReactQuill] for React. It is required to provide `EmbedBuilder`, e.g. [defaultEmbedBuildersWeb](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/universal_ui/universal_ui.dart#L99). -Also it is required to provide `webImagePickImpl`, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L237). +Also it is required to provide `webImagePickImpl`, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L240). ## Desktop -It is required to provide `filePickImpl` for toolbar image button, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L217). +It is required to provide `filePickImpl` for toolbar image button, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L220). ## Configuration diff --git a/example/lib/pages/home_page.dart b/example/lib/pages/home_page.dart index 5e5f348e..c222502d 100644 --- a/example/lib/pages/home_page.dart +++ b/example/lib/pages/home_page.dart @@ -34,7 +34,9 @@ class _HomePageState extends State { Future _loadFromAssets() async { try { - final result = await rootBundle.loadString(isDesktop() ? 'assets/sample_data_nomedia.json' : 'assets/sample_data.json'); + final result = await rootBundle.loadString(isDesktop() + ? 'assets/sample_data_nomedia.json' + : 'assets/sample_data.json'); final doc = Document.fromJson(jsonDecode(result)); setState(() { _controller = QuillController( diff --git a/example/lib/pages/read_only_page.dart b/example/lib/pages/read_only_page.dart index 831552a3..d0ae032e 100644 --- a/example/lib/pages/read_only_page.dart +++ b/example/lib/pages/read_only_page.dart @@ -20,7 +20,9 @@ class _ReadOnlyPageState extends State { @override Widget build(BuildContext context) { return DemoScaffold( - documentFilename: isDesktop() ? 'assets/sample_data_nomedia.json' : 'sample_data_nomedia.json', + documentFilename: isDesktop() + ? 'assets/sample_data_nomedia.json' + : 'sample_data_nomedia.json', builder: _buildContent, showToolbar: _edit == true, floatingActionButton: FloatingActionButton.extended( diff --git a/lib/src/widgets/delegate.dart b/lib/src/widgets/delegate.dart index 615e53c2..817056ed 100644 --- a/lib/src/widgets/delegate.dart +++ b/lib/src/widgets/delegate.dart @@ -112,7 +112,9 @@ class EditorTextSelectionGestureDetectorBuilder { // For backwards-compatibility, we treat a null kind the same as touch. final kind = details.kind; shouldShowSelectionToolbar = kind == null || - kind == PointerDeviceKind.mouse || // this is added to enable word selection by mouse double tap + kind == + PointerDeviceKind + .mouse || // this is added to enable word selection by mouse double tap kind == PointerDeviceKind.touch || kind == PointerDeviceKind.stylus; } @@ -182,7 +184,8 @@ class EditorTextSelectionGestureDetectorBuilder { /// onSingleTapUp for mouse right click @protected - void onSecondarySingleTapUp(TapUpDetails details) { // added to show toolbar by right click + void onSecondarySingleTapUp(TapUpDetails details) { + // added to show toolbar by right click if (shouldShowSelectionToolbar) { editor!.showToolbar(); } @@ -321,7 +324,8 @@ class EditorTextSelectionGestureDetectorBuilder { @protected void onDragSelectionEnd(DragEndDetails details) { renderEditor!.handleDragEnd(details); - if (isDesktop()) { // added to show selection copy/paste toolbar after drag to select + if (isDesktop()) { + // added to show selection copy/paste toolbar after drag to select if (delegate.selectionEnabled) { if (shouldShowSelectionToolbar) { editor!.showToolbar(); diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index 7ec83545..04c42edc 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -640,7 +640,8 @@ class _QuillEditorSelectionGestureDetectorBuilder try { if (delegate.selectionEnabled && !_isPositionSelected(details)) { final _platform = Theme.of(_state.context).platform; - if (isAppleOS(_platform) || isDesktop()) { // added isDesktop() to enable extend selection in Windows platform + if (isAppleOS(_platform) || isDesktop()) { + // added isDesktop() to enable extend selection in Windows platform switch (details.kind) { case PointerDeviceKind.mouse: case PointerDeviceKind.stylus: diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index 282ec420..deacdedd 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -363,10 +363,14 @@ class RawEditorState extends EditorState return QuillStyles( data: _styles!, child: Shortcuts( - shortcuts: { // shortcuts added for Windows platform - LogicalKeySet(LogicalKeyboardKey.escape): HideSelectionToolbarIntent(), - LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ): const UndoTextIntent(SelectionChangedCause.keyboard), - LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyY): const RedoTextIntent(SelectionChangedCause.keyboard), + shortcuts: { + // shortcuts added for Windows platform + LogicalKeySet(LogicalKeyboardKey.escape): + HideSelectionToolbarIntent(), + LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ): + const UndoTextIntent(SelectionChangedCause.keyboard), + LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyY): + const RedoTextIntent(SelectionChangedCause.keyboard), }, child: Actions( actions: _actions, @@ -1180,7 +1184,8 @@ class RawEditorState extends EditorState PasteTextIntent: _makeOverridable(CallbackAction( onInvoke: (intent) => pasteText(intent.cause))), - HideSelectionToolbarIntent: _makeOverridable(_HideSelectionToolbarAction(this)), + HideSelectionToolbarIntent: + _makeOverridable(_HideSelectionToolbarAction(this)), UndoTextIntent: _makeOverridable(_UndoKeyboardAction(this)), RedoTextIntent: _makeOverridable(_RedoKeyboardAction(this)), }; @@ -1885,7 +1890,8 @@ class HideSelectionToolbarIntent extends Intent { const HideSelectionToolbarIntent(); } -class _HideSelectionToolbarAction extends ContextAction { +class _HideSelectionToolbarAction + extends ContextAction { _HideSelectionToolbarAction(this.state); final RawEditorState state; @@ -1896,8 +1902,7 @@ class _HideSelectionToolbarAction extends ContextAction - state.textEditingValue.selection.isValid; + bool get isActionEnabled => state.textEditingValue.selection.isValid; } class _UndoKeyboardAction extends ContextAction { @@ -1931,4 +1936,3 @@ class _RedoKeyboardAction extends ContextAction { @override bool get isActionEnabled => true; } - diff --git a/lib/src/widgets/text_selection.dart b/lib/src/widgets/text_selection.dart index ad022890..770c3b3d 100644 --- a/lib/src/widgets/text_selection.dart +++ b/lib/src/widgets/text_selection.dart @@ -736,10 +736,13 @@ class EditorTextSelectionGestureDetector extends StatefulWidget { /// onTapDown for mouse right click final GestureTapDownCallback? onSecondaryTapDown; + /// onTapUp for mouse right click final GestureTapUpCallback? onSecondarySingleTapUp; + /// onTapCancel for mouse right click final GestureTapCancelCallback? onSecondarySingleTapCancel; + /// onDoubleTap for mouse right click final GestureTapDownCallback? onSecondaryDoubleTapDown; diff --git a/pubspec.yaml b/pubspec.yaml index 70b0ed88..e6a76bca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) -version: 6.0.0 +version: 6.0.1 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill