Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mobile] customRecognizerBuilder not triggered for links in bullet list #1929

Open
1 task done
tsafundzic opened this issue Jun 19, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@tsafundzic
Copy link

Is there an existing issue for this?

Flutter Quill version

9.4.2

Steps to reproduce

Add customRecognizerBuilder to the QuillEditor:

                         customRecognizerBuilder: (Attribute attribute, Leaf leaf) {
                            // We are not using default long press context menu for handling the links
                            return TapGestureRecognizer()
                              ..onTap = () {
                                if (attribute.key == Attribute.link.key) {
                                  launchUrlFromQuill(context, attribute.value.toString());
                                }
                              };
                          },

This is text used to test:

[
  {
    "insert": "Google",
    "attributes": {
      "link": "https://www.google.com/"
    }
  },
  {
    "insert": "\n",
    "attributes": {
      "list": "bullet"
    }
  },
  {
    "insert": "\n\nAnd this link works: "
  },
  {
    "insert": "Google",
    "attributes": {
      "link": "https://www.google.com/"
    }
  }
]

Expected results

Every link should trigger TapGestureRecognizer defined in customRecognizerBuilder. In bullets it does't trigger it - only long press works in that case.

Actual results

TapGestureRecognizer defined as customRecognizerBuilder is not being triggered when it is in bullet list - in that case only long press on link works.

Code sample

Code sample
                     QuillEditor(
                        focusNode: FocusNode(canRequestFocus: false),
                        scrollController: ScrollController(),
                        configurations: QuillEditorConfigurations(
                          controller: _quillController,
                          scrollable: true,
                          padding: EdgeInsets.zero,
                          autoFocus: false,
                          checkBoxReadOnly: true,
                          showCursor: false,
                          expands: false,
                          customRecognizerBuilder: (Attribute attribute, Leaf leaf) {
                            // We are not using default long press context menu for handling the links
                            return TapGestureRecognizer()
                              ..onTap = () {
                                if (attribute.key == Attribute.link.key) {
                                  launchUrlFromQuill(context, attribute.value.toString());
                                }
                              };
                          },
                          onLaunchUrl: (link) => launchUrlFromQuill(context, link),
                        ),
                      ),

Screenshots or Video

No response

Logs

No response

@tsafundzic tsafundzic added the bug Something isn't working label Jun 19, 2024
@CatHood0
Copy link
Collaborator

CatHood0 commented Jun 26, 2024

Can you provide what launchUrlFromQuill() does?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants