quill icon indicating copy to clipboard operation
quill copied to clipboard

out-of-place characters on insertion/quill-js load

Open jtopenpetition opened this issue 3 years ago • 0 comments

Okay, so the problem is probably already somewhat known in #3425 and #2942. I found a new effect - apart from having to remove characters with too many backspaces - however, when texts containing these characters are stored as html to be made editable. Loading the editor on a div that contains the magic string below will actually change the text, which in my humble opinion should never happen.

Steps for Reproduction

  1. Visit quilljs.com, jsfiddle.net, codepen.io

  2. insert the following "magic" text into the editor:

    xbold non-bold ü filler bold-again non-bold-again

    the umlaut is actually hex: 75 cc 88, which is a u (U+0075) followed by the combining diaeresis U+0308 (cc88)

  3. In case the boldness wasn't pasted, you may have to bolden both bold words, and copy-paste them again.

Alternatively, set the HTML on the playground to the following

<p><strong>xbold</strong> non-bold ü filler <strong>bold-again</strong> non-bold-again
<div id="editor-container">
  <p><strong>xbold</strong> non-bold ü filler <strong>bold-again</strong> non-bold-again
</div>

Expected behavior:

the text is inserted at exactly the place where the cursor / selection is, and looking exactly like here / like it was before the editor was loaded.

Actual behavior:

image

  1. Depending on what other text there is in the editor, many exciting things may happen.
    • If the editor is empty or you append to existing text, it is likely a line break will be inserted right before bold-again.
    • If there already is text and you prepend the magic text, one character may be moved to the spot before bold-again
    • If there already is text and you insert the magic text in the middle, the next char might be moved to the spot after bold-again.
    • If the content should replaced by pasting (when text is selected) the first character of the replaced text might be before bold-again, also, the next character after the selection may disappear.

Platforms: windows, linux, mac, firefox, chromium - all reasonably current version

Version:

current version (1.3.6)

jtopenpetition avatar Aug 09 '22 09:08 jtopenpetition