Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/src/editor/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ class QuillEditorState extends State<QuillEditor>
theme.colorScheme.primary.withValues(alpha: 0.40);
}

final isMobile = Theme.of(context).platform == TargetPlatform.iOS ||
Theme.of(context).platform == TargetPlatform.android;

final showSelectionToolbar =
config.enableInteractiveSelection && config.enableSelectionToolbar;

Expand Down
7 changes: 7 additions & 0 deletions lib/src/editor/raw_editor/raw_editor_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@ class QuillRawEditorState extends EditorState
bringIntoView(selection.extent);
}
}

// Show toolbar on selection change if it's not from drag
if (cause != SelectionChangedCause.drag &&
cause != SelectionChangedCause.toolbar &&
widget.config.contextMenuBuilder != null) {
showToolbar();
}
}

void _handleSelectionCompleted() {
Expand Down
19 changes: 6 additions & 13 deletions lib/src/editor/widgets/delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,11 @@ class EditorTextSelectionGestureDetectorBuilder {
/// which triggers this callback.
@protected
void onDoubleTapDown(TapDownDetails details) {
if (delegate.selectionEnabled) {
renderEditor!.selectWord(SelectionChangedCause.tap);
// allow the selection to get updated before trying to bring up
// toolbars.
//
// if double tap happens on an editor that doesn't
// have focus, selection hasn't been set when the toolbars
// get added
SchedulerBinding.instance.addPostFrameCallback((_) {
if (checkSelectionToolbarShouldShow(isAdditionalAction: false)) {
editor!.showToolbar();
}
});
renderEditor!.handleTapDown(details);
final selection = renderEditor!.getSelectionForPosition(details.globalPosition);
if (selection != null) {
renderEditor!.handleSelectionChanged(selection, SelectionChangedCause.tap);
editor!.showToolbar();
}
}

Expand Down Expand Up @@ -357,6 +349,7 @@ class EditorTextSelectionGestureDetectorBuilder {
/// the handlers provided by this builder.
///
/// The [child] or its subtree should contain [EditableText].
@override
Widget build({
required HitTestBehavior behavior,
required Widget child,
Expand Down