From 3f3614e786889813ae9a56362b16fdd8c5950422 Mon Sep 17 00:00:00 2001 From: operatorultra <105389680+operatorultra@users.noreply.github.com> Date: Fri, 21 Jul 2023 20:02:50 +0200 Subject: [PATCH] Persist boolean logic for showSelectionToolbar --- lib/src/widgets/editor.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index d757b813..50e3e6cb 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -191,6 +191,7 @@ class QuillEditor extends StatefulWidget { this.customLinkPrefixes = const [], this.dialogTheme, this.contentInsertionConfiguration, + this.contextMenuBuilder, Key? key, }) : super(key: key); @@ -432,6 +433,9 @@ class QuillEditor extends StatefulWidget { /// Configures the dialog theme. final QuillDialogTheme? dialogTheme; + // Allows for creating a custom context menu + final QuillEditorContextMenuBuilder? contextMenuBuilder; + /// Configuration of handler for media content inserted via the system input /// method. /// @@ -503,8 +507,9 @@ class QuillEditorState extends State readOnly: widget.readOnly, placeholder: widget.placeholder, onLaunchUrl: widget.onLaunchUrl, - contextMenuBuilder: - showSelectionToolbar ? RawEditor.defaultContextMenuBuilder : null, + contextMenuBuilder: showSelectionToolbar + ? (widget.contextMenuBuilder ?? RawEditor.defaultContextMenuBuilder) + : null, showSelectionHandles: isMobile(theme.platform), showCursor: widget.showCursor, cursorStyle: CursorStyle(