Skip to content

Commit

Permalink
Fix noop check to compare with native range nodes
Browse files Browse the repository at this point in the history
Fixes #1195
  • Loading branch information
jhchen committed Dec 23, 2016
1 parent 555f872 commit 154f2b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,6 @@ function modify(modifier, source, index, shift) {
} else if (shift !== 0) {
range = shiftRange(range, index, shift, source);
}
if (range.index === 0 && range.length === 0) {
// Fixes cursor render bug in Chrome for code-block and checklist
this.setSelection(null, Emitter.sources.SILENT);
}
this.setSelection(range, Emitter.sources.SILENT);
}
if (change.length() > 0) {
Expand Down
8 changes: 4 additions & 4 deletions core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ class Selection {
if (selection == null) return;
if (startNode != null) {
if (!this.hasFocus()) this.root.focus();
let nativeRange = this.getNativeRange();
if (nativeRange == null || force ||
startNode !== nativeRange.start.node || startOffset !== nativeRange.start.offset ||
endNode !== nativeRange.end.node || endOffset !== nativeRange.end.offset) {
let native = (this.getNativeRange() || {}).native;
if (native == null || force ||
startNode !== native.startContainer || startOffset !== native.startOffset ||
endNode !== native.endContainer || endOffset !== native.endOffset) {
let range = document.createRange();
range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset);
Expand Down

0 comments on commit 154f2b4

Please sign in to comment.