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

Make the trigger keys extendable with an option #31

Open
petemcfarlane opened this issue Nov 25, 2019 · 0 comments
Open

Make the trigger keys extendable with an option #31

petemcfarlane opened this issue Nov 25, 2019 · 0 comments

Comments

@petemcfarlane
Copy link

I've got some pesky non-breaking white space characters interfering with the default regex which detects if a space key has been pressed.
I can solve it locally by extending the MarkdownShortcuts module, but thought it'd be a nice option if you could configure the regex.

e.g. my current solution

MyMarkdownShortcuts extends MarkdownShortcuts {
  constructor(quill, options) {
    super(quill, options);
    this.quill.on('text-change', (delta) => {
      delta.ops.forEach (op => {
        if (Object.prototype.hasOwnProperty.call(op, 'insert')) {
          if (/\u00A0/.test(op.insert)) {
            this.onSpace();
          }
        }
      });
    });
  }
}

suggestion, in quill config:

{
  // ...
  markdownShortcuts: {
    onSpaceTrigger: /\u00A0|\ / // custom regex here
  }
}
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

1 participant