quill
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -0,1 +1,11 @@ | ||
# 1.1.10 | ||
- Preserve user selection on API changes [#1152](https://github.com/quilljs/quill/issues/1152) | ||
- Fix backspacing into emojis [#1230](https://github.com/quilljs/quill/issues/1230) | ||
- Fix ability to type after emptying line in IE/Firefox [#1254](https://github.com/quilljs/quill/issues/1254) | ||
- Fix whitelisting block formats [#1256](https://github.com/quilljs/quill/issues/1256) | ||
Thank you [@benbro](https://github.com/benbro), [@haugstrup](https://github.com/haugstrup), [@peterweck](https://github.com/peterweck) and [@sbevels](https://github.com/sbevels) for contributions to this release! | ||
# 1.1.9 | ||
@@ -2,0 +12,0 @@ |
@@ -77,2 +77,3 @@ import Delta from 'quill-delta'; | ||
Object.keys(formats).forEach((format) => { | ||
if (this.scroll.whitelist != null && !this.scroll.whitelist[format]) return; | ||
let lines = this.scroll.lines(index, Math.max(length, 1)); | ||
@@ -79,0 +80,0 @@ let lengthRemaining = length; |
@@ -286,3 +286,5 @@ import './polyfill'; | ||
} | ||
this.selection.scrollIntoView(); | ||
if (source !== Emitter.sources.SILENT) { | ||
this.selection.scrollIntoView(); | ||
} | ||
} | ||
@@ -398,3 +400,3 @@ | ||
let change = modifier(); | ||
if (range != null && source === Emitter.sources.USER) { | ||
if (range != null) { | ||
if (index === true) index = range.index; | ||
@@ -401,0 +403,0 @@ if (shift == null) { |
@@ -221,7 +221,14 @@ import Parchment from 'parchment'; | ||
if (!this.hasFocus()) this.root.focus(); | ||
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(); | ||
let range = this.getNativeRange(); | ||
let native = (range || {}).native; | ||
if (range == null || force || | ||
startNode !== native.startContainer || | ||
startOffset !== native.startOffset || | ||
endNode !== native.endContainer || | ||
endOffset !== native.endOffset || | ||
(range.start.node.tagName === 'BR' && startNode !== range.start.node) || | ||
(range.end.node.tagName === 'BR' && endNode !== range.end.node)) { | ||
range = document.createRange(); | ||
range.setStart(startNode, startOffset); | ||
@@ -266,4 +273,5 @@ range.setEnd(endNode, endOffset); | ||
update(source = Emitter.sources.USER) { | ||
let nativeRange, oldRange = this.lastRange; | ||
[this.lastRange, nativeRange] = this.getRange(); | ||
let oldRange = this.lastRange; | ||
let [lastRange, nativeRange] = this.getRange(); | ||
this.lastRange = lastRange; | ||
if (this.lastRange != null) { | ||
@@ -270,0 +278,0 @@ this.savedRange = this.lastRange; |
@@ -64,2 +64,15 @@ import Parchment from 'parchment'; | ||
constructor(domNode) { | ||
super(domNode) | ||
domNode.addEventListener('click', (e) => { | ||
let format = this.statics.formats(domNode); | ||
if (e.target.parentNode !== domNode) return; | ||
if (format === 'checked') { | ||
this.format('list', 'unchecked'); | ||
} else if(format === 'unchecked') { | ||
this.format('list', 'checked'); | ||
} | ||
}); | ||
} | ||
format(name, value) { | ||
@@ -66,0 +79,0 @@ if (this.children.length > 0) { |
@@ -37,3 +37,3 @@ import clone from 'clone'; | ||
this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function() {}); | ||
if (/Gecko/i.test(navigator.userAgent)) { | ||
if (/Firefox/i.test(navigator.userAgent)) { | ||
// Need to handle delete and backspace for Firefox in the general case #1171 | ||
@@ -256,5 +256,7 @@ this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace); | ||
} | ||
this.quill.deleteText(range.index-1, 1, Quill.sources.USER); | ||
// Check for astral symbols | ||
let length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1; | ||
this.quill.deleteText(range.index-length, length, Quill.sources.USER); | ||
if (Object.keys(formats).length > 0) { | ||
this.quill.formatLine(range.index-1, 1, formats, Quill.sources.USER); | ||
this.quill.formatLine(range.index-length, length, formats, Quill.sources.USER); | ||
} | ||
@@ -264,5 +266,7 @@ this.quill.selection.scrollIntoView(); | ||
function handleDelete(range) { | ||
if (range.index >= this.quill.getLength() - 1) return; | ||
this.quill.deleteText(range.index, 1, Quill.sources.USER); | ||
function handleDelete(range, context) { | ||
// Check for astral symbols | ||
let length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1; | ||
if (range.index >= this.quill.getLength() - length) return; | ||
this.quill.deleteText(range.index, length, Quill.sources.USER); | ||
} | ||
@@ -269,0 +273,0 @@ |
@@ -228,8 +228,2 @@ import Delta from 'quill-delta'; | ||
}, | ||
link: function(value) { | ||
if (value === true) { | ||
value = prompt('Enter link URL:'); | ||
} | ||
this.quill.format('link', value, Quill.sources.USER); | ||
}, | ||
indent: function(value) { | ||
@@ -244,2 +238,21 @@ let range = this.quill.getSelection(); | ||
} | ||
}, | ||
link: function(value) { | ||
if (value === true) { | ||
value = prompt('Enter link URL:'); | ||
} | ||
this.quill.format('link', value, Quill.sources.USER); | ||
}, | ||
list: function(value) { | ||
let range = this.quill.getSelection(); | ||
let formats = this.quill.getFormat(range); | ||
if (value === 'check') { | ||
if (formats['list'] === 'checked' || formats['list'] === 'unchecked') { | ||
this.quill.format('list', false, Quill.sources.USER); | ||
} else { | ||
this.quill.format('list', 'unchecked', Quill.sources.USER); | ||
} | ||
} else { | ||
this.quill.format('list', value, Quill.sources.USER); | ||
} | ||
} | ||
@@ -246,0 +259,0 @@ } |
{ | ||
"name": "quill", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "Your powerful, rich text editor", | ||
@@ -5,0 +5,0 @@ "author": "Jason Chen <jhchen7@gmail.com>", |
@@ -40,3 +40,3 @@ module.exports = { | ||
'bullet' : require('../assets/icons/list-bullet.svg'), | ||
'unchecked' : require('../assets/icons/list-check.svg') | ||
'check' : require('../assets/icons/list-check.svg') | ||
}, | ||
@@ -43,0 +43,0 @@ 'script': { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2153767
22692