From f21a08344bf28bc217b7043c46b51ea5c9ab66d2 Mon Sep 17 00:00:00 2001 From: Daniel Eder Date: Wed, 3 Aug 2022 10:38:39 +0200 Subject: [PATCH] Fix non breaking spaces when pasting lists When pasting lists from word the pastematcher accidentally generated non breaking spaces between
  • and the the first character in the line. trimLeft() on line 15 fixes this. Intentional spaces before the first character will also be trimmed (I see no way to differentiate), however this should be a super-rare occurrence when pasting from word, and can still be fixed in the text editor after pasting. See https://github.com/quilljs/quill/issues/1225#issuecomment-992867278 --- frontend/services/quill/msWordPasteMatchers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/services/quill/msWordPasteMatchers.js b/frontend/services/quill/msWordPasteMatchers.js index c8041783..8909df30 100644 --- a/frontend/services/quill/msWordPasteMatchers.js +++ b/frontend/services/quill/msWordPasteMatchers.js @@ -12,7 +12,7 @@ function matchMsWordList(node, delta) { bulletOp.insert = bulletOp.insert.trimLeft(); let listPrefix = bulletOp.insert.match(/^.*?(^ยท|\.)/) || bulletOp.insert[0]; - bulletOp.insert = bulletOp.insert.substring(listPrefix[0].length, bulletOp.insert.length); + bulletOp.insert = bulletOp.insert.substring(listPrefix[0].length, bulletOp.insert.length).trimLeft(); // Trim the newline off the last op let last = ops[ops.length-1];