Comparing version 1.2.3 to 1.2.4
@@ -0,1 +1,16 @@ | ||
# 1.2.4 | ||
- Fix pasting nested list [#906](https://github.com/quilljs/quill/issues/906) | ||
- Fix delete key interaction at end of list [#1277](https://github.com/quilljs/quill/issues/1277) | ||
- Fix pasting whitespace prefix [#1244](https://github.com/quilljs/quill/issues/1244) | ||
- Fix file dialog open speed [#1265](https://github.com/quilljs/quill/issues/1265) | ||
- Fix backspace with at beginning of list interaction with meta keys [#1307](https://github.com/quilljs/quill/issues/1307) | ||
- Fix pasting nested styles [#1333](https://github.com/quilljs/quill/issues/1333) | ||
- Fix backspacing into an empty line should keep own formats [#1339](https://github.com/quilljs/quill/issues/1339) | ||
- Fix IE11 autolinking interaction [#1390](https://github.com/quilljs/quill/issues/1390) | ||
- Fix persistent focus interaction with tabbing away [#1404](https://github.com/quilljs/quill/issues/1404) | ||
Thanks to [@bigggge](https://github.com/bigggge), [@CoenWarmer](https://github.com/CoenWarmer), [@cutteroid](https://github.com/cutteroid), [@jay-cox](https://github.com/jay-cox), [@kiewic](https://github.com/kiewic), [@kloots](https://github.com/kloots), [@MichaelTontchev](https://github.com/MichaelTontchev), [@montlebalm](https://github.com/montlebalm), [@RichardNeill](https://github.com/RichardNeill), and [@vasconita](https://github.com/vasconita) for your contributions to this release. | ||
# 1.2.3 | ||
@@ -2,0 +17,0 @@ |
@@ -58,5 +58,7 @@ let elem = document.createElement('div'); | ||
// Disable resizing in Firefox | ||
document.addEventListener("DOMContentLoaded", function() { | ||
// Disable resizing in Firefox | ||
document.execCommand("enableObjectResizing", false, false); | ||
// Disable automatic linkifying in IE11 | ||
document.execCommand("autoUrlDetect", false, false); | ||
}); |
@@ -46,2 +46,3 @@ import Parchment from 'parchment'; | ||
this.emitter.on(Emitter.events.SCROLL_BEFORE_UPDATE, () => { | ||
if (!this.hasFocus()) return; | ||
let native = this.getNativeRange(); | ||
@@ -48,0 +49,0 @@ if (native == null) return; |
@@ -0,1 +1,2 @@ | ||
import extend from 'extend'; | ||
import Delta from 'quill-delta'; | ||
@@ -21,2 +22,3 @@ import Parchment from 'parchment'; | ||
[Node.TEXT_NODE, matchText], | ||
[Node.TEXT_NODE, matchNewline], | ||
['br', matchBreak], | ||
@@ -28,2 +30,3 @@ [Node.ELEMENT_NODE, matchNewline], | ||
[Node.ELEMENT_NODE, matchStyles], | ||
['li', matchIndent], | ||
['b', matchAlias.bind(matchAlias, 'bold')], | ||
@@ -74,3 +77,3 @@ ['i', matchAlias.bind(matchAlias, 'italic')], | ||
if (typeof html === 'string') { | ||
this.container.innerHTML = html; | ||
this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags | ||
} | ||
@@ -142,2 +145,18 @@ let [elementMatchers, textMatchers] = this.prepareMatching(); | ||
function applyFormat(delta, format, value) { | ||
if (typeof format === 'object') { | ||
return Object.keys(format).reduce(function(delta, key) { | ||
return applyFormat(delta, key, format[key]); | ||
}, delta); | ||
} else { | ||
return delta.reduce(function(delta, op) { | ||
if (op.attributes && op.attributes[format]) { | ||
return delta.push(op); | ||
} else { | ||
return delta.insert(op.insert, extend({}, {[format]: value}, op.attributes)); | ||
} | ||
}, new Delta()); | ||
} | ||
} | ||
function computeStyle(node) { | ||
@@ -190,3 +209,3 @@ if (node.nodeType !== Node.ELEMENT_NODE) return {}; | ||
function matchAlias(format, node, delta) { | ||
return delta.compose(new Delta().retain(delta.length(), { [format]: true })); | ||
return applyFormat(delta, format, true); | ||
} | ||
@@ -215,3 +234,3 @@ | ||
if (Object.keys(formats).length > 0) { | ||
delta = delta.compose(new Delta().retain(delta.length(), formats)); | ||
delta = applyFormat(delta, formats); | ||
} | ||
@@ -232,4 +251,3 @@ return delta; | ||
} else if (typeof match.formats === 'function') { | ||
let formats = { [match.blotName]: match.formats(node) }; | ||
delta = delta.compose(new Delta().retain(delta.length(), formats)); | ||
delta = applyFormat(delta, match.blotName, match.formats(node)); | ||
} | ||
@@ -250,5 +268,23 @@ return delta; | ||
function matchIndent(node, delta) { | ||
let match = Parchment.query(node); | ||
if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) { | ||
return delta; | ||
} | ||
let indent = -1, parent = node.parentNode; | ||
while (!parent.classList.contains('ql-clipboard')) { | ||
if ((Parchment.query(parent) || {}).blotName === 'list') { | ||
indent += 1; | ||
} | ||
parent = parent.parentNode; | ||
} | ||
if (indent <= 0) return delta; | ||
return delta.compose(new Delta().retain(delta.length() - 1).retain(1, { indent: indent})); | ||
} | ||
function matchNewline(node, delta) { | ||
if (isLine(node) && !deltaEndsWith(delta, '\n')) { | ||
delta.insert('\n'); | ||
if (!deltaEndsWith(delta, '\n')) { | ||
if (isLine(node) || (delta.length() > 0 && node.nextSibling && isLine(node.nextSibling))) { | ||
delta.insert('\n'); | ||
} | ||
} | ||
@@ -278,3 +314,3 @@ return delta; | ||
if (Object.keys(formats).length > 0) { | ||
delta = delta.compose(new Delta().retain(delta.length(), formats)); | ||
delta = applyFormat(delta, formats); | ||
} | ||
@@ -293,2 +329,5 @@ if (parseFloat(style.textIndent || 0) > 0) { // Could be 0.5in | ||
} | ||
if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) { | ||
return delta; | ||
} | ||
if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) { | ||
@@ -295,0 +334,0 @@ // eslint-disable-next-line func-style |
@@ -44,7 +44,7 @@ import clone from 'clone'; | ||
} | ||
// this.addBinding({ key: Keyboard.keys.BACKSPACE }, { ctrlKey: true }, function() {}); | ||
// this.addBinding({ key: Keyboard.keys.DELETE }, { ctrlKey: true }, function() {}); | ||
this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange); | ||
this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange); | ||
this.addBinding({ key: Keyboard.keys.BACKSPACE }, { empty: true, shortKey: true }, handleBackspace); | ||
this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, | ||
{ collapsed: true, offset: 0 }, | ||
handleBackspace); | ||
this.listen(); | ||
@@ -163,2 +163,6 @@ } | ||
collapsed: true, | ||
shiftKey: null, | ||
metaKey: null, | ||
ctrlKey: null, | ||
altKey: null, | ||
format: ['blockquote', 'indent', 'list'], | ||
@@ -238,3 +242,3 @@ offset: 0, | ||
format: { list: false }, | ||
prefix: /^\s*?(1\.|-|\[ \]|\[x\])$/, | ||
prefix: /^\s*?(1\.|-|\[ ?\]|\[x\])$/, | ||
handler: function(range, context) { | ||
@@ -245,3 +249,3 @@ if (this.quill.scroll.whitelist != null && !this.quill.scroll.whitelist['list']) return true; | ||
switch (context.prefix.trim()) { | ||
case '[ ]': | ||
case '[]': case '[ ]': | ||
value = 'unchecked'; | ||
@@ -283,5 +287,8 @@ break; | ||
if (context.offset === 0) { | ||
let curFormats = line.formats(); | ||
let prevFormats = this.quill.getFormat(range.index-1, 1); | ||
formats = DeltaOp.attributes.diff(curFormats, prevFormats) || {}; | ||
let [prev, ] = this.quill.getLine(range.index - 1); | ||
if (prev != null && prev.length() > 1) { | ||
let curFormats = line.formats(); | ||
let prevFormats = this.quill.getFormat(range.index-1, 1); | ||
formats = DeltaOp.attributes.diff(curFormats, prevFormats) || {}; | ||
} | ||
} | ||
@@ -301,3 +308,17 @@ // Check for astral symbols | ||
if (range.index >= this.quill.getLength() - length) return; | ||
let formats = {}, nextLength = 0; | ||
let [line, ] = this.quill.getLine(range.index); | ||
if (context.offset >= line.length() - 1) { | ||
let [next, ] = this.quill.getLine(range.index + 1); | ||
if (next) { | ||
let curFormats = line.formats(); | ||
let nextFormats = this.quill.getFormat(range.index, 1); | ||
formats = DeltaOp.attributes.diff(curFormats, nextFormats) || {}; | ||
nextLength = next.length(); | ||
} | ||
} | ||
this.quill.deleteText(range.index, length, Quill.sources.USER); | ||
if (Object.keys(formats).length > 0) { | ||
this.quill.formatLine(range.index + nextLength - 1, length, formats, Quill.sources.USER); | ||
} | ||
} | ||
@@ -304,0 +325,0 @@ |
{ | ||
"name": "quill", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Your powerful, rich text editor", | ||
@@ -37,16 +37,16 @@ "author": "Jason Chen <jhchen7@gmail.com>", | ||
"deep-equal": "~1.0.1", | ||
"eventemitter3": "~2.0.2", | ||
"eventemitter3": "~2.0.3", | ||
"extend": "~3.0.0", | ||
"parchment": "1.0.8", | ||
"parchment": "1.0.9", | ||
"quill-delta": "3.5.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.0", | ||
"babel-core": "^6.24.1", | ||
"babel-loader": "^6.4.1", | ||
"babel-plugin-istanbul": "^4.1.1", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.0", | ||
"babel-preset-es2015": "^6.24.0", | ||
"css-loader": "~0.27.3", | ||
"eslint": "^3.18.0", | ||
"eslint-loader": "^1.7.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"css-loader": "~0.28.0", | ||
"eslint": "^3.19.0", | ||
"eslint-loader": "^1.7.1", | ||
"extract-text-webpack-plugin": "^2.1.0", | ||
@@ -56,3 +56,3 @@ "html-loader": "~0.4.5", | ||
"jasmine-core": "^2.5.2", | ||
"karma": "^1.5.0", | ||
"karma": "^1.6.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
@@ -72,3 +72,3 @@ "karma-coverage": "^1.1.1", | ||
"webdriverio": "^4.6.2", | ||
"webpack": "^2.3.2", | ||
"webpack": "^2.4.1", | ||
"webpack-dev-server": "^2.4.2" | ||
@@ -75,0 +75,0 @@ }, |
@@ -127,3 +127,3 @@ import extend from 'extend'; | ||
fileInput.setAttribute('type', 'file'); | ||
fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon, image/svg+xml'); | ||
fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon'); | ||
fileInput.classList.add('ql-image'); | ||
@@ -130,0 +130,0 @@ fileInput.addEventListener('change', () => { |
@@ -105,3 +105,3 @@ import extend from 'extend'; | ||
'<div class="ql-tooltip-editor">', | ||
'<input type="text" data-formula="e=mc^2" data-link="quilljs.com" data-video="Embed URL">', | ||
'<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', | ||
'<a class="ql-close"></a>', | ||
@@ -108,0 +108,0 @@ '</div>' |
@@ -114,3 +114,3 @@ import extend from 'extend'; | ||
'<a class="ql-preview" target="_blank" href="about:blank"></a>', | ||
'<input type="text" data-formula="e=mc^2" data-link="quilljs.com" data-video="Embed URL">', | ||
'<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', | ||
'<a class="ql-action"></a>', | ||
@@ -117,0 +117,0 @@ '<a class="ql-remove"></a>' |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2179567
23526
+ Addedparchment@1.0.9(transitive)
- Removedparchment@1.0.8(transitive)
Updatedeventemitter3@~2.0.3
Updatedparchment@1.0.9