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

Setting linkRegExp to null breaks insertHTML #437

Closed
mYstar opened this issue Sep 12, 2023 · 1 comment
Closed

Setting linkRegExp to null breaks insertHTML #437

mYstar opened this issue Sep 12, 2023 · 1 comment

Comments

@mYstar
Copy link

mYstar commented Sep 12, 2023

I tried to turn off link detection as mentioned in the docs: https://github.com/fastmail/Squire#linkregexp like this:

this._editor = new Squire($element[0]);
this._editor.linkRegExp = null;

Then I noticed, that paste is broken. After debugging it turns out, that insertHTML() fails due to an exception.
My solution, let linkRegExp always return null or false:

this._editor.linkRegExp = {
    exec: function () {
        return null;
    },
    test: function () {
        return false;
    }
};

Is there a cleaner solution? Did I misinterpret the docs?

Thanks for this great project.

@neilj
Copy link
Member

neilj commented Sep 19, 2023

Looks like the docs are slightly wrong. It needs to be a regex, but to turn off link detect just make it match nothing. I would just do:

this._editor.linkRegExp = /[]/;

@neilj neilj closed this as completed Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants