quilljs-markdown icon indicating copy to clipboard operation
quilljs-markdown copied to clipboard

Display error while paste multi `inlinecode`

Open Whyjsee opened this issue 6 months ago • 0 comments

Display error when i copy a multi inlinecode sentence like "- `Integer.MAX_VALUE` is `2147483647`, `Integer.MAX_VALUE / 10` is `214748364`. something else...." , and paste on editor directly.

seems like this error is cause by code added in #38

    if (format['code-block'] || format['code']) {
      // if exists text in code-block, to skip.

      if (format['code']) {
        // ignore all styles when copied text in code block.
        const copiedTexts = delta.ops.filter(d => d.insert).map(d => d.insert).join('')
        this.quillJS.deleteText(retain, copiedTexts.length)
        this.quillJS.insertText(retain, copiedTexts.replace(/\n/g, ''), { code: true })
        this.quillJS.format('code', false)
      }
      return false
    }

this code will be executed and remove all the text you pasted, then insert the whole raw text into code block

ScreenShot: Screenshot 2024-01-02 at 15 21 12

Whyjsee avatar Jan 02 '24 07:01 Whyjsee