quill icon indicating copy to clipboard operation
quill copied to clipboard

Quill removes the entire word when using the space after a word with a link

Open stirelli opened this issue 8 years ago • 3 comments

Quill removes the entire word when using the space after a word with a link

Steps for Reproduction

  1. Visit https://codepen.io/stirelli/pen/GwyWjB
  2. Select the word 'links'
  3. Set a link
  4. Make an space at the end of the word

Expected behavior: Should make a normal space

Actual behavior: Quill removes the entire word

Platforms: Chrome 70.0.3538.77 (Official Build) (64-bit) Ubuntu 18.10

Version: v2.0.0-dev.3

stirelli avatar Nov 21 '18 13:11 stirelli

Looks like it only happens when the text is bold. Additional information:

  • if you have some bold text with a link in the middle, putting a space after the link deletes the link & puts the cursor at the end of the bold text.

jaredly avatar Nov 26 '18 20:11 jaredly

I confirmed that this also happens when text is in italics or underlined, I believe it's related to having the <a> nested inside of another tag. I traced the actual removal to https://github.com/quilljs/parchment/blob/2.0/src/blot/abstract/parent.ts#L237 inside of parchment, but I don't have enough depth of knowledge at the moment to understand why the problem is occurring.

Checking out the mutations that cause it, it looks like there's quite a lot going on in there for adding a single character. That's pretty much where I'm getting stuck on tracing it though.

image

rogers-kyle avatar Feb 04 '19 20:02 rogers-kyle

Fixed in https://github.com/quilljs/quill/pull/3807. Feel free to let me know if there is anything missing. Closing...

luin avatar Jun 23 '23 23:06 luin