Skip to content

Commit

Permalink
Only query the last op's insertion string if it's actually an insert (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jleen authored and jhchen committed Nov 3, 2016
1 parent 50a1713 commit 2df224a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class Quill {
let deleted = this.editor.deleteText(0, length);
let applied = this.editor.applyDelta(delta);
let lastOp = applied.ops[applied.ops.length - 1];
if (lastOp != null && lastOp.insert[lastOp.insert.length-1] === '\n') {
if (lastOp != null && typeof(lastOp.insert) === 'string' && lastOp.insert[lastOp.insert.length-1] === '\n') {
this.editor.deleteText(this.getLength() - 1, 1);
applied.delete(1);
}
Expand Down

0 comments on commit 2df224a

Please sign in to comment.