singerdmx / flutter-quill

Rich text editor for Flutter

Home Page:https://pub.dev/packages/flutter_quill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Web], [Mobile], [Desktop] - Unable to insert link mailto or tel

tsafundzic opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues
  • This issue was mentioned before, but nothing has been done: #1048

Flutter Quill version

9.3.11

Steps to reproduce

  1. Open flutter editor
  2. Select insert link from the quill editor
  3. Dialog with two input fields is shown (text and link inputs)
  4. It only works for http scheme and you can save it only in that case, if you enter link like mailto:something@gmail.com it doesn't allow you to save it. Same goes with tel scheme

Expected results

When you enter mailto:something@gmail.com or tel:123456789 in second input field in "link dialog" you should be able to save it

Actual results

It only works for http scheme and you can save it only in that case, if you enter link like mailto:something@gmail.com it doesn't allow you to save it. Same goes with tel scheme

Code sample

Just run the example project

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Inside QuillToolbar, inside configurations there is buttonOptions which has linkRegExp and there you can add regex:

       QuillToolbar.simple(
          configurations: QuillSimpleToolbarConfigurations(
            controller: _quillController,
            buttonOptions: QuillSimpleToolbarButtonOptions(
              linkStyle: QuillToolbarLinkStyleButtonOptions(
                linkRegExp: RegExp(
                  r"(mailto:[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)|(?:http|https)://\S+|(?:tel:)+[0-9]+$",
                  caseSensitive: false,
                ),
              ),
            ),
          ),
        ),