From 07fc12143d6e1eb944903fd0d2bfa0e3f73dff64 Mon Sep 17 00:00:00 2001 From: John Leen Date: Mon, 31 Oct 2016 18:19:51 -0700 Subject: [PATCH] Only query the last op's insertion string if it's actually an insert --- core/quill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/quill.js b/core/quill.js index 868aff220e..393cd5264a 100644 --- a/core/quill.js +++ b/core/quill.js @@ -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); }