flutter-quill
flutter-quill copied to clipboard
Native Text processing context menu
Have you checked for an existing issue?
- [x] I have searched the existing issues
Use case
Have access to native context menus like Translate, Search, etc.
Proposal
Changes in raw_editor_state.dart:
If we check in the Flutter text field, we can access those native context menus. What we need to do is load it in raw_editor_state.dart, then add them to the contextMenuButtonItems.
@protected
@override
void initState() {
super.initState();
....
_initProcessTextActions();
}
/// Query the engine to initialize the list of text processing actions to show
/// in the text selection toolbar.
Future<void> _initProcessTextActions() async {
_processTextActions.clear();
_processTextActions.addAll(await _processTextService.queryTextActions());
}
List<ContextMenuButtonItem> get contextMenuButtonItems {
return buttonItemsForToolbarOptions() ??
EditableText.getEditableButtonItems(
...
)
..addAll(_textProcessingActionButtonItems); <--- add them here.
}
Reference
- package:flutter/src/widgets/editable_text.dart:2946
I already added them to my app but it will be great to have them directly in Flutter Quill so I don't have to customize & will also benefit all Quill users.
I'll pay attention to this as soon as I have the time. Let us finish the fixes we're working on first, and we'll likely add this (at least I'll take it into consideration for future PRs).
@EchoEllet thanks for you PR for Android, but there is similar feature on iOS too. It will be better to support both Android and iOS.
Flutter supports for an iOS 16+ system context menu: https://api.flutter.dev/flutter/widgets/SystemContextMenu-class.html
I think it also unlock the secure paste feature for iOS. https://github.com/flutter/flutter/issues/103163 Now: on iOS, user copy from any other app, and open our app, tries to paste quill editor. iOS shows a popup:
"Acme" would like to paste from "Safari" Do you want to allow this?
So we can get rid of this question and directly paste content too.