Skip to content

Commit

Permalink
Fix non breaking spaces when pasting lists
Browse files Browse the repository at this point in the history
When pasting lists from word the pastematcher accidentally generated non breaking spaces between <li> 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 slab/quill#1225 (comment)
  • Loading branch information
daniel-eder authored Aug 3, 2022
1 parent a7c360b commit f21a083
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/services/quill/msWordPasteMatchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit f21a083

Please sign in to comment.