feat: add callback to handle performAction (#2061)

pull/2063/head
Huan Du 9 months ago committed by GitHub
parent 964779be3d
commit ab004b8755
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      lib/src/editor/config/editor_configurations.dart
  2. 1
      lib/src/editor/editor.dart
  3. 4
      lib/src/editor/raw_editor/config/raw_editor_configurations.dart
  4. 2
      lib/src/editor/raw_editor/raw_editor_state_text_input_client_mixin.dart

@ -81,6 +81,7 @@ class QuillEditorConfigurations extends Equatable {
this.onScribbleActivated, this.onScribbleActivated,
this.scribbleAreaInsets, this.scribbleAreaInsets,
this.readOnlyMouseCursor = SystemMouseCursors.text, this.readOnlyMouseCursor = SystemMouseCursors.text,
this.onPerformAction,
}); });
final QuillSharedConfigurations sharedConfigurations; final QuillSharedConfigurations sharedConfigurations;
@ -374,6 +375,9 @@ class QuillEditorConfigurations extends Equatable {
/// Optional insets for the scribble area. /// Optional insets for the scribble area.
final EdgeInsets? scribbleAreaInsets; final EdgeInsets? scribbleAreaInsets;
/// Called when a text input action is performed.
final void Function(TextInputAction action)? onPerformAction;
@override @override
List<Object?> get props => [ List<Object?> get props => [
placeholder, placeholder,
@ -437,6 +441,7 @@ class QuillEditorConfigurations extends Equatable {
bool? enableScribble, bool? enableScribble,
void Function()? onScribbleActivated, void Function()? onScribbleActivated,
EdgeInsets? scribbleAreaInsets, EdgeInsets? scribbleAreaInsets,
void Function(TextInputAction action)? onPerformAction,
}) { }) {
return QuillEditorConfigurations( return QuillEditorConfigurations(
sharedConfigurations: sharedConfigurations ?? this.sharedConfigurations, sharedConfigurations: sharedConfigurations ?? this.sharedConfigurations,
@ -503,6 +508,7 @@ class QuillEditorConfigurations extends Equatable {
enableScribble: enableScribble ?? this.enableScribble, enableScribble: enableScribble ?? this.enableScribble,
onScribbleActivated: onScribbleActivated ?? this.onScribbleActivated, onScribbleActivated: onScribbleActivated ?? this.onScribbleActivated,
scribbleAreaInsets: scribbleAreaInsets ?? this.scribbleAreaInsets, scribbleAreaInsets: scribbleAreaInsets ?? this.scribbleAreaInsets,
onPerformAction: onPerformAction ?? this.onPerformAction,
); );
} }
} }

@ -300,6 +300,7 @@ class QuillEditorState extends State<QuillEditor>
readOnlyMouseCursor: configurations.readOnlyMouseCursor, readOnlyMouseCursor: configurations.readOnlyMouseCursor,
magnifierConfiguration: configurations.magnifierConfiguration, magnifierConfiguration: configurations.magnifierConfiguration,
textInputAction: configurations.textInputAction, textInputAction: configurations.textInputAction,
onPerformAction: configurations.onPerformAction,
), ),
), ),
), ),

@ -89,6 +89,7 @@ class QuillRawEditorConfigurations extends Equatable {
this.scribbleAreaInsets, this.scribbleAreaInsets,
this.readOnlyMouseCursor = SystemMouseCursors.text, this.readOnlyMouseCursor = SystemMouseCursors.text,
this.magnifierConfiguration, this.magnifierConfiguration,
this.onPerformAction,
}); });
/// Controls the document being edited. /// Controls the document being edited.
@ -341,6 +342,9 @@ class QuillRawEditorConfigurations extends Equatable {
final TextMagnifierConfiguration? magnifierConfiguration; final TextMagnifierConfiguration? magnifierConfiguration;
/// Called when a text input action is performed.
final void Function(TextInputAction action)? onPerformAction;
@override @override
List<Object?> get props => [ List<Object?> get props => [
readOnly, readOnly,

@ -212,7 +212,7 @@ mixin RawEditorStateTextInputClientMixin on EditorState
@override @override
void performAction(TextInputAction action) { void performAction(TextInputAction action) {
// no-op widget.configurations.onPerformAction?.call(action);
} }
@override @override

Loading…
Cancel
Save