devextreme-quill
Advanced tools
Comparing version 1.1.2 to 1.2.1
@@ -1,2 +0,2 @@ | ||
import { ClassAttributor, Scope, StyleAttributor } from 'parchment'; | ||
import { Attributor, ClassAttributor, Scope, StyleAttributor } from 'parchment'; | ||
@@ -12,2 +12,10 @@ const SizeClass = new ClassAttributor('size', 'ql-size', { | ||
export { SizeClass, SizeStyle }; | ||
const config = { | ||
scope: Scope.BLOCK, | ||
whitelist: null, | ||
}; | ||
const WidthAttribute = new Attributor('width', 'width', config); | ||
const HeightAttribute = new Attributor('height', 'height', config); | ||
export { SizeClass, SizeStyle, WidthAttribute, HeightAttribute }; |
import Block from '../blots/block'; | ||
import Container from '../blots/container'; | ||
const TABLE_TAGS = ['TD', 'TH', 'TR', 'TBODY', 'THEAD', 'TABLE']; | ||
class TableCell extends Block { | ||
@@ -191,2 +193,2 @@ static create(value) { | ||
export { TableCell, TableRow, TableBody, TableContainer, tableId }; | ||
export { TableCell, TableRow, TableBody, TableContainer, tableId, TABLE_TAGS }; |
@@ -21,4 +21,5 @@ import Delta from 'quill-delta'; | ||
import { FontStyle } from '../formats/font'; | ||
import { SizeStyle } from '../formats/size'; | ||
import { SizeStyle, WidthAttribute, HeightAttribute } from '../formats/size'; | ||
import { deleteRange } from './keyboard'; | ||
import { TABLE_TAGS } from '../formats/table'; | ||
@@ -42,2 +43,3 @@ const debug = logger('quill:clipboard'); | ||
['tr', matchTable], | ||
[ELEMENT_NODE, matchDimensions], | ||
['b', matchAlias.bind(matchAlias, 'bold')], | ||
@@ -49,9 +51,11 @@ ['i', matchAlias.bind(matchAlias, 'italic')], | ||
const ATTRIBUTE_ATTRIBUTORS = [AlignAttribute, DirectionAttribute].reduce( | ||
(memo, attr) => { | ||
memo[attr.keyName] = attr; | ||
return memo; | ||
}, | ||
{}, | ||
); | ||
const ATTRIBUTE_ATTRIBUTORS = [ | ||
AlignAttribute, | ||
DirectionAttribute, | ||
WidthAttribute, | ||
HeightAttribute, | ||
].reduce((memo, attr) => { | ||
memo[attr.keyName] = attr; | ||
return memo; | ||
}, {}); | ||
@@ -444,2 +448,14 @@ const STYLE_ATTRIBUTORS = [ | ||
function matchDimensions(node, delta) { | ||
const isTableNode = TABLE_TAGS.indexOf(node.tagName) !== -1; | ||
return delta.reduce((newDelta, op) => { | ||
const isEmbed = typeof op.insert === 'object'; | ||
const attributes = op.attributes || {}; | ||
const { width, height, ...rest } = attributes; | ||
const formats = | ||
attributes.table || isTableNode || isEmbed ? attributes : { ...rest }; | ||
return newDelta.insert(op.insert, formats); | ||
}, new Delta()); | ||
} | ||
function matchBreak(node, delta) { | ||
@@ -518,2 +534,8 @@ if (!deltaEndsWith(delta, '\n')) { | ||
const style = node.style || {}; | ||
['height', 'width'].forEach(dimension => { | ||
if (['TD', 'TH'].indexOf(node.tagName) !== -1 && style[dimension]) { | ||
formats[dimension] = style[dimension]; | ||
} | ||
}); | ||
if (style.fontStyle === 'italic') { | ||
@@ -520,0 +542,0 @@ formats.italic = true; |
{ | ||
"name": "devextreme-quill", | ||
"version": "1.1.2", | ||
"version": "1.2.1", | ||
"description": "Core of the DevExtrene HtmlEditor", | ||
@@ -5,0 +5,0 @@ "author": "Developer Express Inc.", |
12
quill.js
@@ -19,3 +19,8 @@ import './polyfills'; | ||
import { FontClass, FontStyle } from './formats/font'; | ||
import { SizeClass, SizeStyle } from './formats/size'; | ||
import { | ||
SizeClass, | ||
SizeStyle, | ||
WidthAttribute, | ||
HeightAttribute, | ||
} from './formats/size'; | ||
@@ -42,2 +47,4 @@ import Bold from './formats/bold'; | ||
'attributors/attribute/direction': DirectionAttribute, | ||
'attributors/attribute/width': WidthAttribute, | ||
'attributors/attribute/height': HeightAttribute, | ||
@@ -67,2 +74,5 @@ 'attributors/class/align': AlignClass, | ||
'formats/width': WidthAttribute, | ||
'formats/height': HeightAttribute, | ||
'formats/background': BackgroundStyle, | ||
@@ -69,0 +79,0 @@ 'formats/color': ColorStyle, |
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
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
1671369
36087