singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.58k stars 835 forks source link

[Desktop] Error when using selection shortcut on Mac #1192

Closed Andre-lbc closed 2 weeks ago

Andre-lbc commented 1 year ago

Hello, I'm getting the following 2 errors when using command + shift + arrow shortcuts on MacOS:

Error 1: Unable to find an action for an Intent with type ExpandSelectionToDocumentBoundaryIntent in an Actions widget in the given context. Triggered by command + shift + arrow up and command + shift + arrow down (Platform shortcut for moving selection from current position to start or end of text)

Error 2: Unable to find an action for an Intent with type ExpandSelectionToLineBreakIntent in an Actions widget in the given context. Triggered by command + shift + arrow right and command + shift + arrow left (Platform shortcut for moving selection from current position to start of end of line.)

hezhong0711 commented 1 year ago

+1 facing the same problem

tolotrasamuel commented 8 months ago

Any update on this ? It's been about 1 year

CatHood0 commented 1 month ago

@Andre-lbc does this issue still persists?

EchoEllet commented 1 month ago

does this issue still persists?

1937 Fixed a similar issue on macOS. I remember it was an issue on Linux too.

Andre-lbc commented 1 month ago

Sorry, I just saw this, I'll check it out and get back to you tomorrow.

Andre-lbc commented 1 month ago

Hi, I can confirm that I can still reproduce these errors with the latest stable version available to me (flutter_quill: 10.7.5)

Console logs:

════════ Exception caught by services library ══════════════════════════════════
Unable to find an action for an Intent with type ExpandSelectionToLineBreakIntent in an Actions widget in the given context.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by services library ══════════════════════════════════
Unable to find an action for an Intent with type ExpandSelectionToLineBreakIntent in an Actions widget in the given context.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by services library ══════════════════════════════════
Unable to find an action for an Intent with type ExpandSelectionToDocumentBoundaryIntent in an Actions widget in the given context.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by services library ══════════════════════════════════
Unable to find an action for an Intent with type ExpandSelectionToDocumentBoundaryIntent in an Actions widget in the given context.
════════════════════════════════════════════════════════════════════════════════
EchoEllet commented 1 month ago

Thank you for the input, I was indicating that there was a similar issue (unimplemented intent action) that's also on macOS that's fixed, will fix this issue in a similar way as soon as we can.

EchoEllet commented 1 month ago

The following intents are both missing and need actions that implement them:

This is similar to #1937.

EchoEllet commented 1 month ago

It seems that ExtendSelectionToNextParagraphBoundaryOrCaretLocationIntent is also not implemented:

The following assertion was thrown during method call TextInputClient.performSelectors:
Unable to find an action for an Intent with type ExtendSelectionToNextParagraphBoundaryOrCaretLocationIntent in an Actions widget in the given context.

Unable to find an action for an Intent with type ExtendSelectionToNextParagraphBoundaryOrCaretLocationIntent in an Actions widget in the given context.
EchoEllet commented 1 month ago

Fixed in #2279.

https://github.com/user-attachments/assets/25bd4422-471c-4f3e-a7ff-1ef0ca836c1b

Will need more time to complete the bug fix, also notice some other related bugs, undocumented actions/intents, inconsistency with the naming, missing tests, some other intents to be implemented, code duplication to achieve a task, and common functionalities being duplicated all over the source code.

Which is why more time needed before releasing an incomplete bug fix.

For now, you can test and see if the issue exist on the branch of #2279:

$ git clone --depth 1 --branch fix/1192 https://github.com/singerdmx/flutter-quill.git
$ (cd example/macos && pod update OrderedSet && pod install --repo-update)
$ (cd example && flutter run -d macos)
EchoEllet commented 1 month ago

It looks like the new version of flutter_inappwebview is causing build issues on macOS as well:

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-0008192914A1801E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00006000-0008192914A1801E, name:My Mac }
~/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.0/macos/Classes/InAppWebView/InAppWebView.swift:870:26: error: method does not override any method from its superclass
    public override func evaluateJavaScript(_ javaScriptString: String, completionHandler: (@MainActor @Sendable (Any?, (any Error)?) -> Void)? = nil) {
                         ^
    open func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, (any Error)?) -> Void)? = nil)
              ^
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

See related issue #2280.

EchoEllet commented 2 weeks ago

@Andre-lbc Can you confirm if this issue is fixed with 10.8.5?

Andre-lbc commented 2 weeks ago

Hello @EchoEllet, Thanks!

Just upgraded to 10.8.5 and ran it on macOS:

command + shift + arrow up and command + shift + arrow down no longer throw exceptions and are showing the expected behavior.

command + shift + arrow left and command + shift + arrow right no longer throw exceptions, but are showing slightly different behavior than their native counterpart: they now expand the selection to the end/beginning of the paragraph, whereas on native they expand until the end/beginning of the line.

EchoEllet commented 2 weeks ago

no longer throw exceptions, but are showing slightly different behavior than their native counterpart: they now expand the selection to the end/beginning of the paragraph, whereas on native they expand until the end/beginning of the line.

I'm unsure about the expected native behavior on macOS though the current behavior does what you described, see ExpandSelectionToLineBreakAction.

Can you share an example video of a macOS app that implements this shortcut as expected?

Andre-lbc commented 2 weeks ago

Of course, here are some examples:

Native app (Apple Notes) https://github.com/user-attachments/assets/e18ace31-96f3-4c06-b6fd-2e9b393ddacf
Electron app (Notion) https://github.com/user-attachments/assets/75cfe1fc-b3f3-46fd-8501-758ac1c50432
Flutter app + flutter-quill https://github.com/user-attachments/assets/f495ec83-ceda-401b-b0e8-39411539dbdd

I think this is not dependent on the application level implementation, as all third-party apps I have used so far support this (Firefox, Chrome, Visual Studio Code, Notion, Word, Excel, OneNote, Android Studio, etc)