devextreme-quill
Advanced tools
Comparing version 1.5.18 to 1.5.19
@@ -12,3 +12,6 @@ import Delta from 'quill-delta'; | ||
import TextBlot from './text'; | ||
import { overrideParchment } from '../parchment/override'; | ||
overrideParchment(); | ||
const NEWLINE_LENGTH = 1; | ||
@@ -15,0 +18,0 @@ |
import prepareAttributor from './prepare_attributor'; | ||
import prepareStyleAttributor from './prepare_style_attributor'; | ||
const cellConfig = { | ||
name: 'cell', | ||
allowedTags: ['TH', 'TD'], | ||
}; | ||
const CellHeightAttribute = prepareAttributor(cellConfig, 'height'); | ||
const CellWidthAttribute = prepareAttributor(cellConfig, 'width'); | ||
const CellHeightStyle = prepareStyleAttributor(cellConfig, 'height'); | ||
const CellWidthStyle = prepareStyleAttributor(cellConfig, 'width'); | ||
const CellVerticalAlignStyle = prepareStyleAttributor( | ||
import { | ||
cellConfig, | ||
'vertical', | ||
'align', | ||
); | ||
TABLE_CELL_ATTRIBUTES, | ||
TABLE_CELL_STYLES, | ||
} from './cell_config'; | ||
const CellTextAlignStyle = prepareStyleAttributor(cellConfig, 'text', 'align'); | ||
const CellBackgroundColorStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'background', | ||
'color', | ||
export const TABLE_CELL_ATTR_ATTRIBUTORS = TABLE_CELL_ATTRIBUTES.map(attrName => | ||
prepareAttributor(cellConfig, attrName), | ||
); | ||
const CellBorderStyle = prepareStyleAttributor(cellConfig, 'border'); | ||
const CellBorderStyleStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'border', | ||
'style', | ||
export const TABLE_CELL_STYLE_ATTRIBUTORS = TABLE_CELL_STYLES.map(styleName => | ||
prepareStyleAttributor(cellConfig, styleName), | ||
); | ||
const CellBorderWidthStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'border', | ||
'width', | ||
); | ||
const CellBorderColorStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'border', | ||
'color', | ||
); | ||
const CellPaddingStyle = prepareStyleAttributor(cellConfig, 'padding'); | ||
const CellPaddingTopStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'padding', | ||
'top', | ||
export const CELL_FORMATS = TABLE_CELL_STYLE_ATTRIBUTORS.reduce( | ||
(result, attributor) => { | ||
result[attributor.attrName] = attributor; | ||
return result; | ||
}, | ||
{}, | ||
); | ||
const CellPaddingBottomStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'padding', | ||
'bottom', | ||
); | ||
const CellPaddingLeftStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'padding', | ||
'left', | ||
); | ||
const CellPaddingRightStyle = prepareStyleAttributor( | ||
cellConfig, | ||
'padding', | ||
'right', | ||
); | ||
const CELL_FORMATS = { | ||
cellBorder: CellBorderStyle, | ||
cellBorderStyle: CellBorderStyleStyle, | ||
cellBorderWidth: CellBorderWidthStyle, | ||
cellBorderColor: CellBorderColorStyle, | ||
cellBackgroundColor: CellBackgroundColorStyle, | ||
cellPadding: CellPaddingStyle, | ||
cellPaddingTop: CellPaddingTopStyle, | ||
cellPaddingBottom: CellPaddingBottomStyle, | ||
cellPaddingLeft: CellPaddingLeftStyle, | ||
cellPaddingRight: CellPaddingRightStyle, | ||
cellVerticalAlign: CellVerticalAlignStyle, | ||
cellTextAlign: CellTextAlignStyle, | ||
cellWidth: CellWidthStyle, | ||
cellHeight: CellHeightStyle, | ||
}; | ||
const CELL_ATTRIBUTORS = [ | ||
CellBackgroundColorStyle, | ||
CellBorderColorStyle, | ||
CellBorderStyle, | ||
CellBorderStyleStyle, | ||
CellBorderWidthStyle, | ||
CellPaddingBottomStyle, | ||
CellPaddingLeftStyle, | ||
CellPaddingRightStyle, | ||
CellPaddingStyle, | ||
CellPaddingTopStyle, | ||
CellVerticalAlignStyle, | ||
CellTextAlignStyle, | ||
CellHeightStyle, | ||
CellWidthStyle, | ||
CellWidthAttribute, | ||
CellHeightAttribute, | ||
].reduce((memo, attr) => { | ||
memo[attr.keyName] = attr; | ||
return memo; | ||
export const CELL_ATTRIBUTORS = [ | ||
...TABLE_CELL_ATTR_ATTRIBUTORS, | ||
...TABLE_CELL_STYLE_ATTRIBUTORS, | ||
].reduce((result, attributor) => { | ||
result[attributor.keyName] = attributor; | ||
return result; | ||
}, {}); | ||
export { | ||
CellVerticalAlignStyle, | ||
CellTextAlignStyle, | ||
CellBackgroundColorStyle, | ||
CellBorderStyle, | ||
CellBorderStyleStyle, | ||
CellBorderWidthStyle, | ||
CellBorderColorStyle, | ||
CellPaddingStyle, | ||
CellPaddingTopStyle, | ||
CellPaddingBottomStyle, | ||
CellPaddingLeftStyle, | ||
CellPaddingRightStyle, | ||
CellHeightStyle, | ||
CellWidthStyle, | ||
CellHeightAttribute, | ||
CellWidthAttribute, | ||
CELL_FORMATS, | ||
CELL_ATTRIBUTORS, | ||
}; |
@@ -1,13 +0,13 @@ | ||
import ElementAttributor from '../../../attributors/element_attributor'; | ||
import OverriddenAttributor from '../../../attributors/attributor'; | ||
import capitalize from '../../../utils/capitalize'; | ||
import { KeyNameType } from '../../../attributors/utils'; | ||
export default function prepareAttributor( | ||
{ name, ...elementConfig }, | ||
attrName, | ||
domAttrName, | ||
) { | ||
return new ElementAttributor( | ||
`${name}${capitalize(attrName)}`, | ||
attrName, | ||
elementConfig, | ||
); | ||
const attrName = `${name}${capitalize(domAttrName)}`; | ||
const keyName = `${KeyNameType.attribute}${name}_${domAttrName}`; | ||
return new OverriddenAttributor(attrName, keyName, elementConfig); | ||
} |
@@ -1,15 +0,17 @@ | ||
import ElementStyleAttributor from '../../../attributors/element_style'; | ||
import OverriddenStyleAttributor from '../../../attributors/style_attributor'; | ||
import capitalize from '../../../utils/capitalize'; | ||
import { KeyNameType } from '../../../attributors/utils'; | ||
export default function prepareStyleAttributor( | ||
{ name, formatName, ...elementConfig }, | ||
propName, | ||
subPropName = '', | ||
prop, | ||
) { | ||
const fullName = `${propName}${subPropName ? `-${subPropName}` : ''}`; | ||
return new ElementStyleAttributor( | ||
`${name}${capitalize(formatName ?? propName)}${capitalize(subPropName)}`, | ||
fullName, | ||
elementConfig, | ||
); | ||
const [propName, propSubName] = prop.split('-'); | ||
const attrName = `${name}${capitalize(formatName ?? propName)}${ | ||
propSubName ? capitalize(propSubName) : '' | ||
}`; | ||
const keyName = `${KeyNameType.style}${name}_${prop}`; | ||
return new OverriddenStyleAttributor(attrName, keyName, elementConfig); | ||
} |
import prepareAttributor from './prepare_attributor'; | ||
import prepareStyleAttributor from './prepare_style_attributor'; | ||
import { TABLE_ATTRIBUTES, TABLE_STYLES, tableConfig } from './table_config'; | ||
const tableConfig = { | ||
name: 'table', | ||
allowedTags: ['TABLE'], | ||
}; | ||
const TableHeightAttribute = prepareAttributor(tableConfig, 'height'); | ||
const TableWidthAttribute = prepareAttributor(tableConfig, 'width'); | ||
const TableHeightStyle = prepareStyleAttributor(tableConfig, 'height'); | ||
const TableWidthStyle = prepareStyleAttributor(tableConfig, 'width'); | ||
const TableTextAlignStyle = prepareStyleAttributor( | ||
tableConfig, | ||
'text', | ||
'align', | ||
export const TABLE_ATTR_ATTRIBUTORS = TABLE_ATTRIBUTES.map(attrName => | ||
prepareAttributor(tableConfig, attrName), | ||
); | ||
const TableBackgroundColorStyle = prepareStyleAttributor( | ||
tableConfig, | ||
'background', | ||
'color', | ||
export const TABLE_STYLE_ATTRIBUTORS = TABLE_STYLES.map(styleName => | ||
prepareStyleAttributor(tableConfig, styleName), | ||
); | ||
const TableBorderStyle = prepareStyleAttributor(tableConfig, 'border'); | ||
const TableBorderStyleStyle = prepareStyleAttributor( | ||
tableConfig, | ||
'border', | ||
'style', | ||
export const TABLE_FORMATS = TABLE_STYLE_ATTRIBUTORS.reduce( | ||
(result, attributor) => { | ||
result[attributor.attrName] = attributor; | ||
return result; | ||
}, | ||
{}, | ||
); | ||
const TableBorderWidthStyle = prepareStyleAttributor( | ||
tableConfig, | ||
'border', | ||
'width', | ||
); | ||
const TableBorderColorStyle = prepareStyleAttributor( | ||
tableConfig, | ||
'border', | ||
'color', | ||
); | ||
const TABLE_FORMATS = { | ||
tableTextAlign: TableTextAlignStyle, | ||
tableBackgroundColor: TableBackgroundColorStyle, | ||
tableBorder: TableBorderStyle, | ||
tableBorderStyle: TableBorderStyleStyle, | ||
tableBorderWidth: TableBorderWidthStyle, | ||
tableBorderColor: TableBorderColorStyle, | ||
tableWidth: TableWidthStyle, | ||
tableHeight: TableHeightStyle, | ||
}; | ||
const TABLE_ATTRIBUTORS = [ | ||
TableTextAlignStyle, | ||
TableBackgroundColorStyle, | ||
TableBorderStyle, | ||
TableBorderStyleStyle, | ||
TableBorderColorStyle, | ||
TableBorderWidthStyle, | ||
TableHeightStyle, | ||
TableWidthStyle, | ||
TableWidthAttribute, | ||
TableHeightAttribute, | ||
].reduce((memo, attr) => { | ||
memo[attr.keyName] = attr; | ||
return memo; | ||
export const TABLE_ATTRIBUTORS = [ | ||
...TABLE_ATTR_ATTRIBUTORS, | ||
...TABLE_STYLE_ATTRIBUTORS, | ||
].reduce((result, attributor) => { | ||
result[attributor.keyName] = attributor; | ||
return result; | ||
}, {}); | ||
export { | ||
TableTextAlignStyle, | ||
TableBackgroundColorStyle, | ||
TableBorderStyle, | ||
TableBorderStyleStyle, | ||
TableBorderWidthStyle, | ||
TableBorderColorStyle, | ||
TableHeightStyle, | ||
TableWidthStyle, | ||
TableWidthAttribute, | ||
TableHeightAttribute, | ||
TABLE_FORMATS, | ||
TABLE_ATTRIBUTORS, | ||
}; |
import { Scope } from 'parchment'; | ||
import ElementAttributor from '../../../attributors/element_attributor'; | ||
import ElementStyleAttributor from '../../../attributors/element_style'; | ||
import OverriddenAttributor from '../../../attributors/attributor'; | ||
import OverriddenStyleAttributor from '../../../attributors/style_attributor'; | ||
import { CELL_ATTRIBUTORS } from '../../../formats/table/attributors/cell'; | ||
@@ -16,4 +16,4 @@ import { TABLE_ATTRIBUTORS } from '../../../formats/table/attributors/table'; | ||
return (node, delta, scroll) => { | ||
const attributes = ElementAttributor.keys(node); | ||
const styles = ElementStyleAttributor.keys(node); | ||
const attributes = OverriddenAttributor.keys(node); | ||
const styles = OverriddenStyleAttributor.keys(node); | ||
const formats = {}; | ||
@@ -20,0 +20,0 @@ attributes.concat(styles).forEach(name => { |
{ | ||
"name": "devextreme-quill", | ||
"version": "1.5.18", | ||
"version": "1.5.19", | ||
"description": "Core of the DevExtreme HtmlEditor", | ||
@@ -70,3 +70,3 @@ "author": "Developer Express Inc.", | ||
"prettier": "^1.17.0", | ||
"puppeteer": "^2.1.1", | ||
"puppeteer": "^19.2.2", | ||
"rimraf": "^3.0.2", | ||
@@ -80,2 +80,3 @@ "source-map-loader": "^1.1.2", | ||
"typescript": "^3.8.3", | ||
"wait-on": "^6.0.1", | ||
"webpack": "^4.42.1", | ||
@@ -160,15 +161,17 @@ "webpack-cli": "^3.3.11" | ||
"scripts": { | ||
"install:legacy": "npm install --legacy-peer-deps", | ||
"clean": "rimraf dist/* && rimraf test/functional/example/src", | ||
"copy-dist": "ncp dist test/functional/example/src", | ||
"build": "npm run lint && npm run clean && npm run build:webpack", | ||
"build-dist": "npm run lint && npm run clean && npm run build:webpack-prod", | ||
"build": "npm run clean && npm run build:webpack", | ||
"build:prod": "npm run clean && npm run build:webpack-prod", | ||
"build:webpack": "webpack --config _develop/webpack.config.js && rimraf dist/dx-quill.core dist/dx-quill.bubble dist/dx-quill.snow", | ||
"build:webpack-prod": "webpack --config _develop/webpack.config.js --env.production && rimraf dist/dx-quill.core dist/dx-quill.bubble dist/dx-quill.snow", | ||
"develop": "npm run start", | ||
"lint": "eslint blots core formats modules test utils", | ||
"start": "npm run build && npm run copy-dist && http-server ./test/functional/example", | ||
"test": "npm run test:unit", | ||
"test:functional": "jasmine test/functional/epic.js", | ||
"test:unit": "npm run build && karma start _develop/karma.config.js", | ||
"test:coverage": "webpack --env.coverage --config _develop/webpack.config.js && karma start _develop/karma.config.js --reporters coverage" | ||
"dev:test:unit": "npm run build && npm run test:unit", | ||
"ci:test:functional": "http-server ./test/functional/example > .http-log & HTTP_PID=$! && npm run test:functional && kill $HTTP_PID && cat .http-log", | ||
"test:functional": "wait-on http://127.0.0.1:8080/index.html -i 1000 -t 10000 && jasmine test/functional/epic.js", | ||
"test:unit": "karma start _develop/karma.config.js", | ||
"test:coverage": "webpack --env.coverage --config _develop/webpack.config.js && karma start _develop/karma.config.js --reporters coverage", | ||
"version": "npm version --no-git-tag-version" | ||
}, | ||
@@ -175,0 +178,0 @@ "keywords": [ |
71
quill.js
@@ -38,40 +38,18 @@ import './polyfills'; | ||
import TableLite from './modules/table/lite'; | ||
import { | ||
CellBackgroundColorStyle, | ||
CellBorderColorStyle, | ||
CellBorderStyle, | ||
CellBorderStyleStyle, | ||
CellBorderWidthStyle, | ||
CellHeightAttribute, | ||
CellHeightStyle, | ||
CellPaddingBottomStyle, | ||
CellPaddingLeftStyle, | ||
CellPaddingRightStyle, | ||
CellPaddingStyle, | ||
CellPaddingTopStyle, | ||
CellTextAlignStyle, | ||
CellVerticalAlignStyle, | ||
CellWidthAttribute, | ||
CellWidthStyle, | ||
} from './formats/table/attributors/cell'; | ||
import { | ||
TableTextAlignStyle, | ||
TableBackgroundColorStyle, | ||
TableBorderColorStyle, | ||
TableBorderStyle, | ||
TableBorderStyleStyle, | ||
TableBorderWidthStyle, | ||
TableHeightAttribute, | ||
TableHeightStyle, | ||
TableWidthAttribute, | ||
TableWidthStyle, | ||
} from './formats/table/attributors/table'; | ||
import { TABLE_CELL_ATTR_ATTRIBUTORS, TABLE_CELL_STYLE_ATTRIBUTORS } from './formats/table/attributors/cell'; | ||
import { TABLE_STYLE_ATTRIBUTORS, TABLE_ATTR_ATTRIBUTORS } from './formats/table/attributors/table'; | ||
function registerAttributorArray(path, attributorArray) { | ||
return attributorArray.reduce((result, attributor) => { | ||
const key = `${path}${attributor.attrName}`; | ||
result[key] = attributor; | ||
return result; | ||
}, {}); | ||
} | ||
Quill.register( | ||
{ | ||
'attributors/attribute/direction': DirectionAttribute, | ||
'attributors/attribute/tableWidth': TableWidthAttribute, | ||
'attributors/attribute/tableHeight': TableHeightAttribute, | ||
'attributors/attribute/cellWidth': CellWidthAttribute, | ||
'attributors/attribute/cellHeight': CellHeightAttribute, | ||
...registerAttributorArray('attributors/attribute/', TABLE_ATTR_ATTRIBUTORS), | ||
...registerAttributorArray('attributors/attribute/', TABLE_CELL_ATTR_ATTRIBUTORS), | ||
@@ -91,24 +69,5 @@ 'attributors/class/align': AlignClass, | ||
'attributors/style/size': SizeStyle, | ||
'attributors/style/tableTextAlign': TableTextAlignStyle, | ||
'attributors/style/tableBackgroundColor': TableBackgroundColorStyle, | ||
'attributors/style/tableBorder': TableBorderStyle, | ||
'attributors/style/tableBorderStyle': TableBorderStyleStyle, | ||
'attributors/style/tableBorderColor': TableBorderColorStyle, | ||
'attributors/style/tableBorderWidth': TableBorderWidthStyle, | ||
'attributors/style/tableWidth': TableWidthStyle, | ||
'attributors/style/tableHeight': TableHeightStyle, | ||
'attributors/style/cellBackground': CellBackgroundColorStyle, | ||
'attributors/style/cellBorder': CellBorderStyle, | ||
'attributors/style/cellBorderStyle': CellBorderStyleStyle, | ||
'attributors/style/cellBorderWidth': CellBorderWidthStyle, | ||
'attributors/style/cellBorderColor': CellBorderColorStyle, | ||
'attributors/style/cellPadding': CellPaddingStyle, | ||
'attributors/style/cellPaddingTop': CellPaddingTopStyle, | ||
'attributors/style/cellPaddingBottom': CellPaddingBottomStyle, | ||
'attributors/style/cellPaddingLeft': CellPaddingLeftStyle, | ||
'attributors/style/cellPaddingRight': CellPaddingRightStyle, | ||
'attributors/style/cellVerticalAlign': CellVerticalAlignStyle, | ||
'attributors/style/cellTextAlign': CellTextAlignStyle, | ||
'attributors/style/cellWidth': CellWidthStyle, | ||
'attributors/style/cellHeight': CellHeightStyle, | ||
...registerAttributorArray('attributors/style/', TABLE_STYLE_ATTRIBUTORS), | ||
...registerAttributorArray('attributors/style/', TABLE_CELL_STYLE_ATTRIBUTORS), | ||
}, | ||
@@ -115,0 +74,0 @@ true, |
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
1881677
81
39963
42