@progress/kendo-editor-common 1.9.7-dev.202306221639 → 1.10.0-dev.202307161520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-editor-common.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/config/schema.js +26 -1
- package/dist/es/main.js +1 -1
- package/dist/es/source.js +40 -1
- package/dist/es2015/config/schema.js +26 -1
- package/dist/es2015/main.js +1 -1
- package/dist/es2015/source.js +40 -1
- package/dist/npm/config/schema.js +26 -1
- package/dist/npm/main.d.ts +1 -1
- package/dist/npm/main.js +4 -3
- package/dist/npm/source.js +40 -1
- package/dist/systemjs/kendo-editor-common.js +1 -1
- package/package.json +2 -2
package/dist/es/config/schema.js
CHANGED
|
@@ -83,7 +83,7 @@ var cellAttribute = function (name) {
|
|
|
83
83
|
},
|
|
84
84
|
_a;
|
|
85
85
|
};
|
|
86
|
-
var cellAttributes = __assign(__assign(__assign(__assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers'));
|
|
86
|
+
var cellAttributes = __assign(__assign(__assign(__assign(__assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers')), cellAttribute('scope'));
|
|
87
87
|
var colgroupNodes = {
|
|
88
88
|
doc: { content: 'colgroup*' },
|
|
89
89
|
col: {
|
|
@@ -167,6 +167,31 @@ var nodes = __assign({
|
|
|
167
167
|
getAttrs: domAttributes
|
|
168
168
|
}],
|
|
169
169
|
toDOM: function (node) { return hasAttrs(node.attrs) ? ['p', pmAttributes(node.attrs), hole] : ['p', hole]; }
|
|
170
|
+
}, table_wrapper: {
|
|
171
|
+
content: '(table_caption_external | table)+',
|
|
172
|
+
group: 'block',
|
|
173
|
+
defining: true,
|
|
174
|
+
attrs: {
|
|
175
|
+
table: { default: null },
|
|
176
|
+
style: { default: null }
|
|
177
|
+
},
|
|
178
|
+
parseDOM: [{
|
|
179
|
+
tag: 'div[table]',
|
|
180
|
+
getAttrs: domAttributes
|
|
181
|
+
}],
|
|
182
|
+
toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
|
|
183
|
+
}, table_caption_external: {
|
|
184
|
+
content: 'inline+',
|
|
185
|
+
group: 'block',
|
|
186
|
+
attrs: {
|
|
187
|
+
caption: { default: null },
|
|
188
|
+
style: { default: null }
|
|
189
|
+
},
|
|
190
|
+
parseDOM: [{
|
|
191
|
+
tag: 'div[caption]',
|
|
192
|
+
getAttrs: domAttributes
|
|
193
|
+
}],
|
|
194
|
+
toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
|
|
170
195
|
}, div: {
|
|
171
196
|
// Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
|
|
172
197
|
// content: '(block | inline)*',
|
package/dist/es/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment } from './source';
|
|
1
|
+
export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment, fragmentToHtml } from './source';
|
|
2
2
|
export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style';
|
|
3
3
|
export { applyLink, removeLink } from './link';
|
|
4
4
|
export { insertText } from './text';
|
package/dist/es/source.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DOMSerializer, DOMParser as ProseMirrorDOMParser } from 'prosemirror-mo
|
|
|
2
2
|
import { AllSelection } from 'prosemirror-state';
|
|
3
3
|
import { rowTypeAttr, colgroupAttr } from './config/constants';
|
|
4
4
|
var blockWrappers = [
|
|
5
|
-
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'td', 'th', 'p',
|
|
5
|
+
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'caption', 'td', 'th', 'p',
|
|
6
6
|
'tr', 'col', 'colgroup', 'article', 'main', 'nav', 'header', 'footer', 'aside', 'section'
|
|
7
7
|
];
|
|
8
8
|
var removeRowType = function (table, nodeName) {
|
|
@@ -24,6 +24,23 @@ var restoreTables = function (fragment) {
|
|
|
24
24
|
if (emptyElement) {
|
|
25
25
|
emptyElement.remove();
|
|
26
26
|
}
|
|
27
|
+
var wrapper = table.parentNode instanceof HTMLDivElement ? table.parentNode : null;
|
|
28
|
+
if (wrapper && wrapper.matches('div[table]')) {
|
|
29
|
+
table.style.marginLeft = wrapper.style.marginLeft;
|
|
30
|
+
table.style.marginRight = wrapper.style.marginRight;
|
|
31
|
+
var captionDiv = Array.from(wrapper.children).find(function (el) { return el.matches('div[caption]'); });
|
|
32
|
+
if (captionDiv) {
|
|
33
|
+
var caption = table.createCaption();
|
|
34
|
+
caption.style.textAlign = captionDiv.style.textAlign;
|
|
35
|
+
caption.style.verticalAlign = captionDiv.style.verticalAlign;
|
|
36
|
+
caption.style.captionSide = captionDiv.style.captionSide;
|
|
37
|
+
while (captionDiv.firstChild) {
|
|
38
|
+
caption.appendChild(captionDiv.firstChild);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
wrapper.parentNode.insertBefore(table, wrapper);
|
|
42
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
43
|
+
}
|
|
27
44
|
});
|
|
28
45
|
};
|
|
29
46
|
var setRowType = function (children, nodeName) {
|
|
@@ -51,6 +68,28 @@ var validateTablesToPmSchema = function (fragment) {
|
|
|
51
68
|
table.setAttribute(colgroupAttr, colgroup.outerHTML);
|
|
52
69
|
colgroup.remove();
|
|
53
70
|
}
|
|
71
|
+
if (table.caption || table.style.marginLeft || table.style.marginRight) {
|
|
72
|
+
var wrapper = document.createElement('div');
|
|
73
|
+
wrapper.setAttribute('table', '');
|
|
74
|
+
wrapper.style.display = 'table';
|
|
75
|
+
wrapper.style.marginLeft = table.style.marginLeft;
|
|
76
|
+
wrapper.style.marginRight = table.style.marginRight;
|
|
77
|
+
if (table.caption) {
|
|
78
|
+
var captionDiv = document.createElement('div');
|
|
79
|
+
captionDiv.setAttribute('caption', '');
|
|
80
|
+
captionDiv.style.display = 'table-caption';
|
|
81
|
+
captionDiv.style.textAlign = table.caption.style.textAlign;
|
|
82
|
+
captionDiv.style.verticalAlign = table.caption.style.verticalAlign;
|
|
83
|
+
captionDiv.style.captionSide = table.caption.style.captionSide;
|
|
84
|
+
while (table.caption.firstChild) {
|
|
85
|
+
captionDiv.appendChild(table.caption.firstChild);
|
|
86
|
+
}
|
|
87
|
+
table.removeChild(table.caption);
|
|
88
|
+
wrapper.appendChild(captionDiv);
|
|
89
|
+
}
|
|
90
|
+
table.parentNode.insertBefore(wrapper, table);
|
|
91
|
+
wrapper.appendChild(table);
|
|
92
|
+
}
|
|
54
93
|
});
|
|
55
94
|
};
|
|
56
95
|
/**
|
|
@@ -76,7 +76,7 @@ const cellAttribute = (name) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
-
const cellAttributes = Object.assign(Object.assign(Object.assign(Object.assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers'));
|
|
79
|
+
const cellAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers')), cellAttribute('scope'));
|
|
80
80
|
const colgroupNodes = {
|
|
81
81
|
doc: { content: 'colgroup*' },
|
|
82
82
|
col: {
|
|
@@ -160,6 +160,31 @@ const nodes = Object.assign({
|
|
|
160
160
|
getAttrs: domAttributes
|
|
161
161
|
}],
|
|
162
162
|
toDOM: node => hasAttrs(node.attrs) ? ['p', pmAttributes(node.attrs), hole] : ['p', hole]
|
|
163
|
+
}, table_wrapper: {
|
|
164
|
+
content: '(table_caption_external | table)+',
|
|
165
|
+
group: 'block',
|
|
166
|
+
defining: true,
|
|
167
|
+
attrs: {
|
|
168
|
+
table: { default: null },
|
|
169
|
+
style: { default: null }
|
|
170
|
+
},
|
|
171
|
+
parseDOM: [{
|
|
172
|
+
tag: 'div[table]',
|
|
173
|
+
getAttrs: domAttributes
|
|
174
|
+
}],
|
|
175
|
+
toDOM: node => hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]
|
|
176
|
+
}, table_caption_external: {
|
|
177
|
+
content: 'inline+',
|
|
178
|
+
group: 'block',
|
|
179
|
+
attrs: {
|
|
180
|
+
caption: { default: null },
|
|
181
|
+
style: { default: null }
|
|
182
|
+
},
|
|
183
|
+
parseDOM: [{
|
|
184
|
+
tag: 'div[caption]',
|
|
185
|
+
getAttrs: domAttributes
|
|
186
|
+
}],
|
|
187
|
+
toDOM: node => hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]
|
|
163
188
|
}, div: {
|
|
164
189
|
// Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
|
|
165
190
|
// content: '(block | inline)*',
|
package/dist/es2015/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment } from './source';
|
|
1
|
+
export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment, fragmentToHtml } from './source';
|
|
2
2
|
export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style';
|
|
3
3
|
export { applyLink, removeLink } from './link';
|
|
4
4
|
export { insertText } from './text';
|
package/dist/es2015/source.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DOMSerializer, DOMParser as ProseMirrorDOMParser } from 'prosemirror-mo
|
|
|
2
2
|
import { AllSelection } from 'prosemirror-state';
|
|
3
3
|
import { rowTypeAttr, colgroupAttr } from './config/constants';
|
|
4
4
|
const blockWrappers = [
|
|
5
|
-
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'td', 'th', 'p',
|
|
5
|
+
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'caption', 'td', 'th', 'p',
|
|
6
6
|
'tr', 'col', 'colgroup', 'article', 'main', 'nav', 'header', 'footer', 'aside', 'section'
|
|
7
7
|
];
|
|
8
8
|
const removeRowType = (table, nodeName) => {
|
|
@@ -24,6 +24,23 @@ const restoreTables = (fragment) => {
|
|
|
24
24
|
if (emptyElement) {
|
|
25
25
|
emptyElement.remove();
|
|
26
26
|
}
|
|
27
|
+
const wrapper = table.parentNode instanceof HTMLDivElement ? table.parentNode : null;
|
|
28
|
+
if (wrapper && wrapper.matches('div[table]')) {
|
|
29
|
+
table.style.marginLeft = wrapper.style.marginLeft;
|
|
30
|
+
table.style.marginRight = wrapper.style.marginRight;
|
|
31
|
+
const captionDiv = Array.from(wrapper.children).find(el => el.matches('div[caption]'));
|
|
32
|
+
if (captionDiv) {
|
|
33
|
+
const caption = table.createCaption();
|
|
34
|
+
caption.style.textAlign = captionDiv.style.textAlign;
|
|
35
|
+
caption.style.verticalAlign = captionDiv.style.verticalAlign;
|
|
36
|
+
caption.style.captionSide = captionDiv.style.captionSide;
|
|
37
|
+
while (captionDiv.firstChild) {
|
|
38
|
+
caption.appendChild(captionDiv.firstChild);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
wrapper.parentNode.insertBefore(table, wrapper);
|
|
42
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
43
|
+
}
|
|
27
44
|
});
|
|
28
45
|
};
|
|
29
46
|
const setRowType = (children, nodeName) => {
|
|
@@ -51,6 +68,28 @@ const validateTablesToPmSchema = (fragment) => {
|
|
|
51
68
|
table.setAttribute(colgroupAttr, colgroup.outerHTML);
|
|
52
69
|
colgroup.remove();
|
|
53
70
|
}
|
|
71
|
+
if (table.caption || table.style.marginLeft || table.style.marginRight) {
|
|
72
|
+
const wrapper = document.createElement('div');
|
|
73
|
+
wrapper.setAttribute('table', '');
|
|
74
|
+
wrapper.style.display = 'table';
|
|
75
|
+
wrapper.style.marginLeft = table.style.marginLeft;
|
|
76
|
+
wrapper.style.marginRight = table.style.marginRight;
|
|
77
|
+
if (table.caption) {
|
|
78
|
+
const captionDiv = document.createElement('div');
|
|
79
|
+
captionDiv.setAttribute('caption', '');
|
|
80
|
+
captionDiv.style.display = 'table-caption';
|
|
81
|
+
captionDiv.style.textAlign = table.caption.style.textAlign;
|
|
82
|
+
captionDiv.style.verticalAlign = table.caption.style.verticalAlign;
|
|
83
|
+
captionDiv.style.captionSide = table.caption.style.captionSide;
|
|
84
|
+
while (table.caption.firstChild) {
|
|
85
|
+
captionDiv.appendChild(table.caption.firstChild);
|
|
86
|
+
}
|
|
87
|
+
table.removeChild(table.caption);
|
|
88
|
+
wrapper.appendChild(captionDiv);
|
|
89
|
+
}
|
|
90
|
+
table.parentNode.insertBefore(wrapper, table);
|
|
91
|
+
wrapper.appendChild(table);
|
|
92
|
+
}
|
|
54
93
|
});
|
|
55
94
|
};
|
|
56
95
|
/**
|
|
@@ -87,7 +87,7 @@ var cellAttribute = function (name) {
|
|
|
87
87
|
},
|
|
88
88
|
_a;
|
|
89
89
|
};
|
|
90
|
-
var cellAttributes = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers'));
|
|
90
|
+
var cellAttributes = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers')), cellAttribute('scope'));
|
|
91
91
|
var colgroupNodes = {
|
|
92
92
|
doc: { content: 'colgroup*' },
|
|
93
93
|
col: {
|
|
@@ -172,6 +172,31 @@ var nodes = tslib_1.__assign({
|
|
|
172
172
|
getAttrs: domAttributes
|
|
173
173
|
}],
|
|
174
174
|
toDOM: function (node) { return hasAttrs(node.attrs) ? ['p', pmAttributes(node.attrs), hole] : ['p', hole]; }
|
|
175
|
+
}, table_wrapper: {
|
|
176
|
+
content: '(table_caption_external | table)+',
|
|
177
|
+
group: 'block',
|
|
178
|
+
defining: true,
|
|
179
|
+
attrs: {
|
|
180
|
+
table: { default: null },
|
|
181
|
+
style: { default: null }
|
|
182
|
+
},
|
|
183
|
+
parseDOM: [{
|
|
184
|
+
tag: 'div[table]',
|
|
185
|
+
getAttrs: domAttributes
|
|
186
|
+
}],
|
|
187
|
+
toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
|
|
188
|
+
}, table_caption_external: {
|
|
189
|
+
content: 'inline+',
|
|
190
|
+
group: 'block',
|
|
191
|
+
attrs: {
|
|
192
|
+
caption: { default: null },
|
|
193
|
+
style: { default: null }
|
|
194
|
+
},
|
|
195
|
+
parseDOM: [{
|
|
196
|
+
tag: 'div[caption]',
|
|
197
|
+
getAttrs: domAttributes
|
|
198
|
+
}],
|
|
199
|
+
toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
|
|
175
200
|
}, div: {
|
|
176
201
|
// Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
|
|
177
202
|
// content: '(block | inline)*',
|
package/dist/npm/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment } from './source';
|
|
1
|
+
export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment, fragmentToHtml } from './source';
|
|
2
2
|
export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style';
|
|
3
3
|
export { applyLink, removeLink } from './link';
|
|
4
4
|
export { insertText } from './text';
|
package/dist/npm/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.pmDeleteColumn = exports.pmAddRowBefore = exports.pmAddRowAfter = exports.pmAddColumnAfter = exports.pmAddColumnBefore = exports.deleteColumn = exports.addColumnAfter = exports.addColumnBefore = exports.addRowBefore = exports.addRowAfter = exports.createTable = exports.nextCell = exports.moveCellForward = exports.removeColSpan = exports.findCell = exports.cellAround = exports.updateColumnsOnResize = exports.columnResizingPluginKey = exports.columnResizing = exports.columnIsHeader = exports.colCount = exports.addColumn = exports.addColSpan = exports.addRow = exports.rowIsHeader = exports.deleteRow = exports.mergeCells = exports.splitCellWithType = exports.splitCell = exports.toggleHeaderRow = exports.toggleHeaderColumn = exports.toggleHeaderCell = exports.toggleHeader = exports.goToNextCell = exports.setCellAttr = exports.selectionCell = exports.selectedRect = exports.CellSelection = exports.inSameTable = exports.deleteTable = exports.isInTable = exports.fixTablesKey = exports.fixTables = exports.tableNodes = exports.tableNodeTypes = void 0;
|
|
3
|
+
exports.expandSelection = exports.selectedLineTextOnly = exports.getNodeFromSelection = exports.getSelectionText = exports.hasSameMarkup = exports.liftBlockquote = exports.blockquote = exports.listStyle = exports.toggleList = exports.toggleUnorderedList = exports.toggleOrderedList = exports.indentBlocks = exports.canBeIndented = exports.isIndented = exports.canOutdentAsListItem = exports.outdent = exports.canIndentAsListItem = exports.indent = exports.selectionMarks = exports.cleanMarks = exports.removeAllMarks = exports.getActiveMarks = exports.getMark = exports.hasMark = exports.cleanTextBlockFormatting = exports.blockNodes = exports.changeTextBlock = exports.parentBlockFormat = exports.getBlockFormats = exports.formatBlockElements = exports.activeNode = exports.hasNode = exports.cleanFormatting = exports.isAligned = exports.alignBlocks = exports.insertImage = exports.insertText = exports.removeLink = exports.applyLink = exports.toggleInlineFormat = exports.getInlineStyles = exports.applyInlineStyle = exports.fragmentToHtml = exports.pmDocToFragment = exports.domToPmDoc = exports.htmlToFragment = exports.trimWhitespace = exports.parseContent = exports.setHtml = exports.getHtml = void 0;
|
|
4
|
+
exports.tableEditing = exports.TableMap = exports.tableRowResizeKey = exports.tableColumnResizeKey = exports.tableResizeKey = exports.tableResizing = exports.caretColorKey = exports.caretColor = exports.imageResizeKey = exports.imageResizing = exports.textHighlightKey = exports.textHighlight = exports.spacesFix = exports.placeholder = exports.replaceAll = exports.replace = exports.findAll = exports.findAt = exports.find = exports.convertMsLists = exports.replaceImageSourcesFromRtf = exports.removeAttribute = exports.sanitizeStyleAttr = exports.sanitizeClassAttr = exports.pasteCleanup = exports.removeTag = exports.removeComments = exports.sanitize = exports.link = exports.superscript = exports.subscript = exports.strikethrough = exports.underline = exports.italic = exports.bold = exports.buildListKeymap = exports.buildKeymap = exports.marks = exports.nodes = exports.outdentRules = exports.indentRules = exports.alignRemoveRules = exports.alignJustifyRules = exports.alignRightRules = exports.alignCenterRules = exports.alignLeftRules = exports.indentHtml = exports.insertNode = exports.canInsert = exports.expandToWordWrap = void 0;
|
|
5
|
+
exports.pmDeleteColumn = exports.pmAddRowBefore = exports.pmAddRowAfter = exports.pmAddColumnAfter = exports.pmAddColumnBefore = exports.deleteColumn = exports.addColumnAfter = exports.addColumnBefore = exports.addRowBefore = exports.addRowAfter = exports.createTable = exports.nextCell = exports.moveCellForward = exports.removeColSpan = exports.findCell = exports.cellAround = exports.updateColumnsOnResize = exports.columnResizingPluginKey = exports.columnResizing = exports.columnIsHeader = exports.colCount = exports.addColumn = exports.addColSpan = exports.addRow = exports.rowIsHeader = exports.deleteRow = exports.mergeCells = exports.splitCellWithType = exports.splitCell = exports.toggleHeaderRow = exports.toggleHeaderColumn = exports.toggleHeaderCell = exports.toggleHeader = exports.goToNextCell = exports.setCellAttr = exports.selectionCell = exports.selectedRect = exports.CellSelection = exports.inSameTable = exports.deleteTable = exports.isInTable = exports.fixTablesKey = exports.fixTables = exports.tableNodes = exports.tableNodeTypes = exports.tableEditingKey = void 0;
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var source_1 = require("./source");
|
|
8
8
|
Object.defineProperty(exports, "getHtml", { enumerable: true, get: function () { return source_1.getHtml; } });
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "trimWhitespace", { enumerable: true, get: functi
|
|
|
12
12
|
Object.defineProperty(exports, "htmlToFragment", { enumerable: true, get: function () { return source_1.htmlToFragment; } });
|
|
13
13
|
Object.defineProperty(exports, "domToPmDoc", { enumerable: true, get: function () { return source_1.domToPmDoc; } });
|
|
14
14
|
Object.defineProperty(exports, "pmDocToFragment", { enumerable: true, get: function () { return source_1.pmDocToFragment; } });
|
|
15
|
+
Object.defineProperty(exports, "fragmentToHtml", { enumerable: true, get: function () { return source_1.fragmentToHtml; } });
|
|
15
16
|
var inline_style_1 = require("./inline-style");
|
|
16
17
|
Object.defineProperty(exports, "applyInlineStyle", { enumerable: true, get: function () { return inline_style_1.applyInlineStyle; } });
|
|
17
18
|
Object.defineProperty(exports, "getInlineStyles", { enumerable: true, get: function () { return inline_style_1.getInlineStyles; } });
|
package/dist/npm/source.js
CHANGED
|
@@ -5,7 +5,7 @@ var prosemirror_model_1 = require("prosemirror-model");
|
|
|
5
5
|
var prosemirror_state_1 = require("prosemirror-state");
|
|
6
6
|
var constants_1 = require("./config/constants");
|
|
7
7
|
var blockWrappers = [
|
|
8
|
-
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'td', 'th', 'p',
|
|
8
|
+
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'caption', 'td', 'th', 'p',
|
|
9
9
|
'tr', 'col', 'colgroup', 'article', 'main', 'nav', 'header', 'footer', 'aside', 'section'
|
|
10
10
|
];
|
|
11
11
|
var removeRowType = function (table, nodeName) {
|
|
@@ -27,6 +27,23 @@ var restoreTables = function (fragment) {
|
|
|
27
27
|
if (emptyElement) {
|
|
28
28
|
emptyElement.remove();
|
|
29
29
|
}
|
|
30
|
+
var wrapper = table.parentNode instanceof HTMLDivElement ? table.parentNode : null;
|
|
31
|
+
if (wrapper && wrapper.matches('div[table]')) {
|
|
32
|
+
table.style.marginLeft = wrapper.style.marginLeft;
|
|
33
|
+
table.style.marginRight = wrapper.style.marginRight;
|
|
34
|
+
var captionDiv = Array.from(wrapper.children).find(function (el) { return el.matches('div[caption]'); });
|
|
35
|
+
if (captionDiv) {
|
|
36
|
+
var caption = table.createCaption();
|
|
37
|
+
caption.style.textAlign = captionDiv.style.textAlign;
|
|
38
|
+
caption.style.verticalAlign = captionDiv.style.verticalAlign;
|
|
39
|
+
caption.style.captionSide = captionDiv.style.captionSide;
|
|
40
|
+
while (captionDiv.firstChild) {
|
|
41
|
+
caption.appendChild(captionDiv.firstChild);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
wrapper.parentNode.insertBefore(table, wrapper);
|
|
45
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
46
|
+
}
|
|
30
47
|
});
|
|
31
48
|
};
|
|
32
49
|
var setRowType = function (children, nodeName) {
|
|
@@ -54,6 +71,28 @@ var validateTablesToPmSchema = function (fragment) {
|
|
|
54
71
|
table.setAttribute(constants_1.colgroupAttr, colgroup.outerHTML);
|
|
55
72
|
colgroup.remove();
|
|
56
73
|
}
|
|
74
|
+
if (table.caption || table.style.marginLeft || table.style.marginRight) {
|
|
75
|
+
var wrapper = document.createElement('div');
|
|
76
|
+
wrapper.setAttribute('table', '');
|
|
77
|
+
wrapper.style.display = 'table';
|
|
78
|
+
wrapper.style.marginLeft = table.style.marginLeft;
|
|
79
|
+
wrapper.style.marginRight = table.style.marginRight;
|
|
80
|
+
if (table.caption) {
|
|
81
|
+
var captionDiv = document.createElement('div');
|
|
82
|
+
captionDiv.setAttribute('caption', '');
|
|
83
|
+
captionDiv.style.display = 'table-caption';
|
|
84
|
+
captionDiv.style.textAlign = table.caption.style.textAlign;
|
|
85
|
+
captionDiv.style.verticalAlign = table.caption.style.verticalAlign;
|
|
86
|
+
captionDiv.style.captionSide = table.caption.style.captionSide;
|
|
87
|
+
while (table.caption.firstChild) {
|
|
88
|
+
captionDiv.appendChild(table.caption.firstChild);
|
|
89
|
+
}
|
|
90
|
+
table.removeChild(table.caption);
|
|
91
|
+
wrapper.appendChild(captionDiv);
|
|
92
|
+
}
|
|
93
|
+
table.parentNode.insertBefore(wrapper, table);
|
|
94
|
+
wrapper.appendChild(table);
|
|
95
|
+
}
|
|
57
96
|
});
|
|
58
97
|
};
|
|
59
98
|
/**
|