Comparing version 1.0.3 to 1.0.4
@@ -32,2 +32,12 @@ import extend from 'extend'; | ||
} | ||
optimize() { | ||
super.optimize(); | ||
let ref = this.parent.parent; | ||
if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) { | ||
let parent = this.parent.isolate(this.offset(), this.length()); | ||
this.moveChildren(parent); | ||
parent.wrap(this); | ||
} | ||
} | ||
} | ||
@@ -34,0 +44,0 @@ Inline.allowedChildren = [Inline, Embed, Text]; |
@@ -0,1 +1,12 @@ | ||
# 1.0.4 | ||
- Fix bubble theme defaults [#963](https://github.com/quilljs/quill/issues/963) | ||
- Fix browsers modifying inline nesting order [#971](https://github.com/quilljs/quill/issues/971) | ||
- Do not fire selection-change event on paste [#974](https://github.com/quilljs/quill/issues/974) | ||
- Support alt attribute in images [#975](https://github.com/quilljs/quill/issues/975) | ||
- Deprecate `pasteHTML` for removal in Quill 2.0 [#981](https://github.com/quilljs/quill/issues/981) | ||
Thank you [jackmu95](https://github.com/jackmu95), [kristeehan](https://github.com/kristeehan), [ruffle1986](https://github.com/ruffle1986), [sergop321](https://github.com/sergop321), [sferoze](https://github.com/sferoze), and [sijad](https://github.com/sijad) for contributions to this release. | ||
# 1.0.3 | ||
@@ -5,3 +16,3 @@ | ||
Thank you [@scottmessinger] for the bug report. | ||
Thank you [@scottmessinger](https://github.com/scottmessinger) for the bug report. | ||
@@ -224,3 +235,3 @@ | ||
- Use native cut [#785](https://github.com/quilljs/quill/issues/785) | ||
- Fix inializing document where last line is formatted [#786](https://github.com/quilljs/quill/issues/786) | ||
- Fix initializing document where last line is formatted [#786](https://github.com/quilljs/quill/issues/786) | ||
@@ -358,3 +369,3 @@ Thanks to [benbro](https://github.com/benbro), [bram2w](https://github.com/bram2w), [clemmy](https://github.com/clemmy), [DadaMonad](https://github.com/DadaMonad), [ersommer](https://github.com/ersommer), [michaeljosephrosenthal](https://github.com/michaeljosephrosenthal), [mmorearty](https://github.com/mmorearty), [mshamaiev-intel471](https://github.com/mshamaiev-intel471), and [sachinrekhi](https://github.com/sachinrekhi) for their contributions to this release. | ||
- removeFormat() removes last line block formats [#649](https://github.com/quilljs/quill/issues/649) | ||
- Fix text direction icon directon [#654](https://github.com/quilljs/quill/issues/654) | ||
- Fix text direction icon direction [#654](https://github.com/quilljs/quill/issues/654) | ||
- Fix text insertion into root scroll [#655](https://github.com/quilljs/quill/issues/655) | ||
@@ -361,0 +372,0 @@ - Fix focusing on placeholder text in FF [#656](https://github.com/quilljs/quill/issues/656) |
@@ -75,3 +75,4 @@ import './polyfill'; | ||
this.theme.init(); | ||
this.pasteHTML(`<div class='ql-editor' style="white-space: normal;">${html}<p><br></p></div>`); | ||
let contents = this.clipboard.convert(`<div class='ql-editor' style="white-space: normal;">${html}<p><br></p></div>`); | ||
this.setContents(contents); | ||
this.history.clear(); | ||
@@ -238,9 +239,4 @@ if (options.readOnly) { | ||
pasteHTML(index, html, source = Emitter.sources.API) { | ||
if (typeof index === 'string') { | ||
return this.setContents(this.clipboard.convert(index), html); | ||
} else { | ||
let paste = this.clipboard.convert(html); | ||
return this.updateContents(new Delta().retain(index).concat(paste), source); | ||
} | ||
pasteHTML(index, html, source) { | ||
this.clipboard.dangerouslyPasteHTML(index, html, source); | ||
} | ||
@@ -303,3 +299,3 @@ | ||
Quill.DEFAULTS = { | ||
bounds: document.body, | ||
bounds: null, | ||
formats: null, | ||
@@ -332,3 +328,3 @@ modules: {}, | ||
}, userConfig); | ||
if (userConfig.theme == null || userConfig.theme === Quill.DEFAULTS.theme) { | ||
if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) { | ||
userConfig.theme = Theme; | ||
@@ -361,3 +357,3 @@ } else { | ||
// Special case toolbar shorthand | ||
if (userConfig.modules != null && userConfig.modules.toolbar != null && | ||
if (userConfig.modules != null && userConfig.modules.toolbar && | ||
userConfig.modules.toolbar.constructor !== Object) { | ||
@@ -374,2 +370,8 @@ userConfig.modules.toolbar = { | ||
}); | ||
userConfig.modules = Object.keys(userConfig.modules).reduce(function(config, name) { | ||
if (userConfig.modules[name]) { | ||
config[name] = userConfig.modules[name]; | ||
} | ||
return config; | ||
}, {}); | ||
return userConfig; | ||
@@ -376,0 +378,0 @@ } |
@@ -173,3 +173,2 @@ import Parchment from 'parchment'; | ||
getRange() { | ||
if (!this.hasFocus()) return [null, null]; | ||
let range = this.getNativeRange(); | ||
@@ -176,0 +175,0 @@ if (range == null) return [null, null]; |
@@ -8,5 +8,6 @@ import Parchment from 'parchment'; | ||
let AlignAttribute = new Parchment.Attributor.Attribute('align', 'align', config); | ||
let AlignClass = new Parchment.Attributor.Class('align', 'ql-align', config); | ||
let AlignStyle = new Parchment.Attributor.Style('align', 'text-align', config); | ||
export { AlignClass, AlignStyle }; | ||
export { AlignAttribute, AlignClass, AlignStyle }; |
@@ -8,5 +8,6 @@ import Parchment from 'parchment'; | ||
let DirectionAttribute = new Parchment.Attributor.Attribute('direction', 'dir', config); | ||
let DirectionClass = new Parchment.Attributor.Class('direction', 'ql-direction', config); | ||
let DirectionStyle = new Parchment.Attributor.Style('direction', 'direction', config); | ||
export { DirectionClass, DirectionStyle }; | ||
export { DirectionAttribute, DirectionClass, DirectionStyle }; |
@@ -9,4 +9,11 @@ import Parchment from 'parchment'; | ||
let FontClass = new Parchment.Attributor.Class('font', 'ql-font', config); | ||
let FontStyle = new Parchment.Attributor.Style('font', 'font-family', config); | ||
class FontStyleAttributor extends Parchment.Attributor.Style { | ||
value(node) { | ||
return super.value(node).replace(/["']/g, ''); | ||
} | ||
} | ||
let FontStyle = new FontStyleAttributor('font', 'font-family', config); | ||
export { FontStyle, FontClass }; |
import Embed from '../blots/embed'; | ||
import Link, { sanitize } from '../formats/link'; | ||
const ATTRIBUTES = [ | ||
'alt', | ||
'height', | ||
'width' | ||
]; | ||
class Image extends Embed { | ||
@@ -15,6 +21,8 @@ static create(value) { | ||
static formats(domNode) { | ||
let formats = {}; | ||
if (domNode.hasAttribute('height')) formats['height'] = domNode.getAttribute('height'); | ||
if (domNode.hasAttribute('width')) formats['width'] = domNode.getAttribute('width'); | ||
return formats; | ||
return ATTRIBUTES.reduce(function(formats, attribute) { | ||
if (domNode.hasAttribute(attribute)) { | ||
formats[attribute] = domNode.getAttribute(attribute); | ||
} | ||
return formats; | ||
}, {}); | ||
} | ||
@@ -35,3 +43,3 @@ | ||
format(name, value) { | ||
if (name === 'height' || name === 'width') { | ||
if (ATTRIBUTES.indexOf(name) > -1) { | ||
if (value) { | ||
@@ -38,0 +46,0 @@ this.domNode.setAttribute(name, value); |
import { BlockEmbed } from '../blots/block'; | ||
import Link from '../formats/link'; | ||
const ATTRIBUTES = [ | ||
'height', | ||
'width' | ||
]; | ||
class Video extends BlockEmbed { | ||
@@ -15,6 +20,8 @@ static create(value) { | ||
static formats(domNode) { | ||
let formats = {}; | ||
if (domNode.hasAttribute('height')) formats['height'] = domNode.getAttribute('height'); | ||
if (domNode.hasAttribute('width')) formats['width'] = domNode.getAttribute('width'); | ||
return formats; | ||
return ATTRIBUTES.reduce(function(formats, attribute) { | ||
if (domNode.hasAttribute(attribute)) { | ||
formats[attribute] = domNode.getAttribute(attribute); | ||
} | ||
return formats; | ||
}, {}); | ||
} | ||
@@ -31,3 +38,3 @@ | ||
format(name, value) { | ||
if (name === 'height' || name === 'width') { | ||
if (ATTRIBUTES.indexOf(name) > -1) { | ||
if (value) { | ||
@@ -34,0 +41,0 @@ this.domNode.setAttribute(name, value); |
@@ -7,6 +7,6 @@ import Delta from 'rich-text/lib/delta'; | ||
import { AlignStyle } from '../formats/align'; | ||
import { AlignAttribute, AlignStyle } from '../formats/align'; | ||
import { BackgroundStyle } from '../formats/background'; | ||
import { ColorStyle } from '../formats/color'; | ||
import { DirectionStyle } from '../formats/direction'; | ||
import { DirectionAttribute, DirectionStyle } from '../formats/direction'; | ||
import { FontStyle } from '../formats/font'; | ||
@@ -30,2 +30,10 @@ import { SizeStyle } from '../formats/size'; | ||
const ATTRIBUTE_ATTRIBUTORS = [ | ||
AlignAttribute, | ||
DirectionAttribute | ||
].reduce(function(memo, attr) { | ||
memo[attr.keyName] = attr; | ||
return memo; | ||
}, {}); | ||
const STYLE_ATTRIBUTORS = [ | ||
@@ -117,2 +125,11 @@ AlignStyle, | ||
dangerouslyPasteHTML(index, html, source = Quill.sources.API) { | ||
if (typeof index === 'string') { | ||
return this.quill.setContents(this.convert(index), html); | ||
} else { | ||
let paste = this.convert(html); | ||
return this.quill.updateContents(new Delta().retain(index).concat(paste), source); | ||
} | ||
} | ||
onPaste(e) { | ||
@@ -125,2 +142,3 @@ if (e.defaultPrevented) return; | ||
setTimeout(() => { | ||
this.quill.selection.update(Quill.sources.SILENT); | ||
delta = delta.concat(this.convert()); | ||
@@ -177,2 +195,6 @@ this.quill.updateContents(delta, Quill.sources.USER); | ||
} | ||
if (ATTRIBUTE_ATTRIBUTORS[name] != null) { | ||
attr = ATTRIBUTE_ATTRIBUTORS[name]; | ||
formats[attr.attrName] = attr.value(node); | ||
} | ||
if (STYLE_ATTRIBUTORS[name] != null) { | ||
@@ -179,0 +201,0 @@ attr = STYLE_ATTRIBUTORS[name]; |
{ | ||
"name": "quill", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Cross browser rich text editor", | ||
@@ -59,3 +59,2 @@ "author": "Jason Chen <jhchen7@gmail.com>", | ||
"lodash": "^4.15.0", | ||
"quill-docs": "quilljs/quilljs.github.io.git#1.0", | ||
"style-loader": "~0.13.1", | ||
@@ -62,0 +61,0 @@ "stylus": "~0.54.5", |
import Quill from './core'; | ||
import { AlignClass, AlignStyle } from './formats/align'; | ||
import { DirectionClass, DirectionStyle } from './formats/direction'; | ||
import { AlignAttribute, AlignClass, AlignStyle } from './formats/align'; | ||
import { DirectionAttribute, DirectionClass, DirectionStyle } from './formats/direction'; | ||
import { IndentClass as Indent } from './formats/indent'; | ||
@@ -43,2 +43,4 @@ | ||
Quill.register({ | ||
'attributors/attribute/direction': DirectionAttribute, | ||
'attributors/class/align': AlignClass, | ||
@@ -45,0 +47,0 @@ 'attributors/class/background': BackgroundClass, |
@@ -16,3 +16,3 @@ import extend from 'extend'; | ||
const COLORS = [ | ||
"#000000", "#e60000", "#ff9900", "#ffff00", "#008A00", "#0066cc", "#9933ff", | ||
"#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", | ||
"#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", | ||
@@ -19,0 +19,0 @@ "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", |
@@ -30,3 +30,3 @@ import extend from 'extend'; | ||
} | ||
BubbleTheme.DEFAULTS = extend(true, {}, BaseTooltip.DEFAULTS, { | ||
BubbleTheme.DEFAULTS = extend(true, {}, BaseTheme.DEFAULTS, { | ||
modules: { | ||
@@ -33,0 +33,0 @@ toolbar: { |
class Tooltip { | ||
constructor(quill, boundsContainer) { | ||
this.quill = quill; | ||
this.boundsContainer = boundsContainer; | ||
this.boundsContainer = boundsContainer || document.body; | ||
this.root = quill.addContainer('ql-tooltip'); | ||
@@ -6,0 +6,0 @@ this.root.innerHTML = this.constructor.TEMPLATE; |
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
2052989
26
21649