diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index 4160e0bb..13f5ee78 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -180,6 +180,8 @@ class QuillEditor extends StatefulWidget { this.floatingCursorDisabled = false, this.textSelectionControls, this.onImagePaste, + this.customShortcuts, + this.customActions, Key? key}) : super(key: key); @@ -394,6 +396,9 @@ class QuillEditor extends StatefulWidget { /// Returns the url of the image if the image should be inserted. final Future Function(Uint8List imageBytes)? onImagePaste; + final Map? customShortcuts; + final Map>? customActions; + @override QuillEditorState createState() => QuillEditorState(); } @@ -504,6 +509,8 @@ class QuillEditorState extends State customStyleBuilder: widget.customStyleBuilder, floatingCursorDisabled: widget.floatingCursorDisabled, onImagePaste: widget.onImagePaste, + customShortcuts: widget.customShortcuts, + customActions: widget.customActions, ); final editor = I18n( diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index e5836a14..b42c76bc 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -70,6 +70,8 @@ class RawEditor extends StatefulWidget { this.minHeight, this.maxContentWidth, this.customStyles, + this.customShortcuts, + this.customActions, this.expands = false, this.autoFocus = false, this.keyboardAppearance = Brightness.light, @@ -227,6 +229,9 @@ class RawEditor extends StatefulWidget { final Future Function(Uint8List imageBytes)? onImagePaste; + final Map? customShortcuts; + final Map>? customActions; + /// Builder function for embeddable objects. final EmbedsBuilder embedBuilder; final LinkActionPickerDelegate linkActionPickerDelegate; @@ -428,9 +433,14 @@ class RawEditorState extends EditorState LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.keyL): const ApplyCheckListIntent(), + + if (widget.customShortcuts != null) ...widget.customShortcuts!, }, child: Actions( - actions: _actions, + actions: { + ..._actions, + if (widget.customActions != null) ...widget.customActions!, + }, child: Focus( focusNode: widget.focusNode, onKey: _onKey,