diff --git a/CHANGELOG.md b/CHANGELOG.md index 17eed562..637cfbd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [6.4.1] +* Control the detect word boundary behaviour. + # [6.4.0] * Use `axis` to make the toolbar vertical. * Use `toolbarIconCrossAlignment` to align the toolbar icons on the cross axis. diff --git a/lib/src/widgets/delegate.dart b/lib/src/widgets/delegate.dart index 1de60822..ce8e65a3 100644 --- a/lib/src/widgets/delegate.dart +++ b/lib/src/widgets/delegate.dart @@ -66,9 +66,8 @@ class EditorTextSelectionGestureDetectorBuilder { /// Creates a [EditorTextSelectionGestureDetectorBuilder]. /// /// The [delegate] must not be null. - EditorTextSelectionGestureDetectorBuilder({ - required this.delegate, - this.detectWordBoundary = true}); + EditorTextSelectionGestureDetectorBuilder( + {required this.delegate, this.detectWordBoundary = true}); /// The delegate for this [EditorTextSelectionGestureDetectorBuilder]. /// @@ -341,26 +340,28 @@ class EditorTextSelectionGestureDetectorBuilder { /// /// The [child] or its subtree should contain [EditableText]. Widget build( - {required HitTestBehavior behavior, required Widget child, Key? key, - bool detectWordBoundary = true}) { + {required HitTestBehavior behavior, + required Widget child, + Key? key, + bool detectWordBoundary = true}) { return EditorTextSelectionGestureDetector( - key: key, - onTapDown: onTapDown, - onForcePressStart: delegate.forcePressEnabled ? onForcePressStart : null, - onForcePressEnd: delegate.forcePressEnabled ? onForcePressEnd : null, - onSingleTapUp: onSingleTapUp, - onSingleTapCancel: onSingleTapCancel, - onSingleLongTapStart: onSingleLongTapStart, - onSingleLongTapMoveUpdate: onSingleLongTapMoveUpdate, - onSingleLongTapEnd: onSingleLongTapEnd, - onDoubleTapDown: onDoubleTapDown, - onSecondarySingleTapUp: onSecondarySingleTapUp, - onDragSelectionStart: onDragSelectionStart, - onDragSelectionUpdate: onDragSelectionUpdate, - onDragSelectionEnd: onDragSelectionEnd, - behavior: behavior, - detectWordBoundary: detectWordBoundary, - child: child - ); + key: key, + onTapDown: onTapDown, + onForcePressStart: + delegate.forcePressEnabled ? onForcePressStart : null, + onForcePressEnd: delegate.forcePressEnabled ? onForcePressEnd : null, + onSingleTapUp: onSingleTapUp, + onSingleTapCancel: onSingleTapCancel, + onSingleLongTapStart: onSingleLongTapStart, + onSingleLongTapMoveUpdate: onSingleLongTapMoveUpdate, + onSingleLongTapEnd: onSingleLongTapEnd, + onDoubleTapDown: onDoubleTapDown, + onSecondarySingleTapUp: onSecondarySingleTapUp, + onDragSelectionStart: onDragSelectionStart, + onDragSelectionUpdate: onDragSelectionUpdate, + onDragSelectionEnd: onDragSelectionEnd, + behavior: behavior, + detectWordBoundary: detectWordBoundary, + child: child); } } diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index c65898f2..7c8d7c10 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -416,8 +416,8 @@ class QuillEditorState extends State void initState() { super.initState(); _selectionGestureDetectorBuilder = - _QuillEditorSelectionGestureDetectorBuilder(this, - widget.detectWordBoundary); + _QuillEditorSelectionGestureDetectorBuilder( + this, widget.detectWordBoundary); } @override @@ -467,9 +467,8 @@ class QuillEditorState extends State readOnly: widget.readOnly, placeholder: widget.placeholder, onLaunchUrl: widget.onLaunchUrl, - contextMenuBuilder: showSelectionToolbar - ? RawEditor.defaultContextMenuBuilder - : null, + contextMenuBuilder: + showSelectionToolbar ? RawEditor.defaultContextMenuBuilder : null, showSelectionHandles: isMobile(theme.platform), showCursor: widget.showCursor, cursorStyle: CursorStyle( @@ -593,7 +592,8 @@ class QuillEditorState extends State class _QuillEditorSelectionGestureDetectorBuilder extends EditorTextSelectionGestureDetectorBuilder { - _QuillEditorSelectionGestureDetectorBuilder(this._state, this._detectWordBoundary) + _QuillEditorSelectionGestureDetectorBuilder( + this._state, this._detectWordBoundary) : super(delegate: _state, detectWordBoundary: _detectWordBoundary); final QuillEditorState _state; diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index 8c6c61af..d6496ee6 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -311,12 +311,10 @@ class RawEditorState extends EditorState onCopy: copyEnabled ? () => copySelection(SelectionChangedCause.toolbar) : null, - onCut: cutEnabled - ? () => cutSelection(SelectionChangedCause.toolbar) - : null, - onPaste: pasteEnabled - ? () => pasteText(SelectionChangedCause.toolbar) - : null, + onCut: + cutEnabled ? () => cutSelection(SelectionChangedCause.toolbar) : null, + onPaste: + pasteEnabled ? () => pasteText(SelectionChangedCause.toolbar) : null, onSelectAll: selectAllEnabled ? () => selectAll(SelectionChangedCause.toolbar) : null, diff --git a/lib/src/widgets/raw_editor/raw_editor_state_selection_delegate_mixin.dart b/lib/src/widgets/raw_editor/raw_editor_state_selection_delegate_mixin.dart index 98cfb407..5da7cef2 100644 --- a/lib/src/widgets/raw_editor/raw_editor_state_selection_delegate_mixin.dart +++ b/lib/src/widgets/raw_editor/raw_editor_state_selection_delegate_mixin.dart @@ -156,8 +156,8 @@ mixin RawEditorStateSelectionDelegateMixin on EditorState bool get copyEnabled => widget.contextMenuBuilder != null; @override - bool get pasteEnabled => widget.contextMenuBuilder != null - && !widget.readOnly; + bool get pasteEnabled => + widget.contextMenuBuilder != null && !widget.readOnly; @override bool get selectAllEnabled => widget.contextMenuBuilder != null; diff --git a/pubspec.yaml b/pubspec.yaml index 951881cb..6300860a 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.4.0 +version: 6.4.1 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill