@progress/kendo-editor-common 1.9.1-dev.202205300804 → 1.9.1-dev.202206231329
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 -16
- package/dist/cdn/main.js +1 -1
- package/dist/es/blockNode.js +5 -5
- package/dist/es/config/indent-rules.js +3 -3
- package/dist/es/config/keymap.js +4 -4
- package/dist/es/config/list-settings.js +3 -3
- package/dist/es/config/schema.js +27 -27
- package/dist/es/find-replace.js +2 -2
- package/dist/es/inline-style.js +5 -5
- package/dist/es/lists.js +3 -3
- package/dist/es/main.js +1 -1
- package/dist/es/mark.js +2 -2
- package/dist/es/plugins/image-resize.js +3 -3
- package/dist/es/plugins/table-resize/column-resize.js +4 -4
- package/dist/es/plugins/table-resize/row-resize.js +1 -1
- package/dist/es/plugins/table-resize/table-resize.js +9 -9
- package/dist/es/plugins/table-resize/utils.js +5 -5
- package/dist/es/table.js +1 -1
- package/dist/es/types/active-marks.js +1 -0
- package/dist/es/types/command.js +1 -0
- package/dist/es/types/dispatchFn.js +1 -0
- package/dist/es/types/paste-cleanup-settings.js +1 -0
- package/dist/es/types/predicate.js +1 -0
- package/dist/es2015/blockNode.js +5 -5
- package/dist/es2015/config/keymap.js +3 -3
- package/dist/es2015/config/schema.js +17 -17
- package/dist/es2015/find-replace.js +2 -2
- package/dist/es2015/inline-style.js +3 -3
- package/dist/es2015/main.js +1 -1
- package/dist/es2015/plugins/image-resize.js +2 -2
- package/dist/es2015/plugins/table-resize/column-resize.js +3 -3
- package/dist/es2015/plugins/table-resize/row-resize.js +1 -1
- package/dist/es2015/plugins/table-resize/table-resize.js +5 -5
- package/dist/es2015/plugins/table-resize/utils.js +4 -4
- package/dist/es2015/table.js +1 -1
- package/dist/es2015/types/active-marks.js +1 -0
- package/dist/es2015/types/command.js +1 -0
- package/dist/es2015/types/dispatchFn.js +1 -0
- package/dist/es2015/types/paste-cleanup-settings.js +1 -0
- package/dist/es2015/types/predicate.js +1 -0
- package/dist/npm/align.d.ts +2 -2
- package/dist/npm/align.js +5 -2
- package/dist/npm/blockNode.d.ts +13 -13
- package/dist/npm/blockNode.js +20 -10
- package/dist/npm/blockquote.d.ts +2 -2
- package/dist/npm/blockquote.js +5 -2
- package/dist/npm/cleanFormatting.d.ts +1 -1
- package/dist/npm/cleanFormatting.js +3 -1
- package/dist/npm/config/align-rules.js +1 -0
- package/dist/npm/config/commands.js +1 -0
- package/dist/npm/config/constants.js +1 -0
- package/dist/npm/config/indent-rules.js +1 -0
- package/dist/npm/config/keymap.d.ts +2 -2
- package/dist/npm/config/keymap.js +8 -5
- package/dist/npm/config/list-settings.js +1 -0
- package/dist/npm/config/schema.js +21 -19
- package/dist/npm/find-replace.d.ts +9 -9
- package/dist/npm/find-replace.js +11 -5
- package/dist/npm/image.js +3 -1
- package/dist/npm/indent.d.ts +5 -5
- package/dist/npm/indent.js +15 -7
- package/dist/npm/inline-style.d.ts +3 -3
- package/dist/npm/inline-style.js +11 -7
- package/dist/npm/link.js +5 -2
- package/dist/npm/listConvert.js +3 -1
- package/dist/npm/lists.d.ts +4 -6
- package/dist/npm/lists.js +7 -3
- package/dist/npm/main.d.ts +1 -1
- package/dist/npm/main.js +146 -143
- package/dist/npm/mark.d.ts +10 -10
- package/dist/npm/mark.js +25 -13
- package/dist/npm/paste.js +17 -8
- package/dist/npm/plugins/caret-color.d.ts +1 -1
- package/dist/npm/plugins/caret-color.js +1 -0
- package/dist/npm/plugins/highlight.d.ts +1 -1
- package/dist/npm/plugins/highlight.js +1 -0
- package/dist/npm/plugins/image-resize.d.ts +24 -3
- package/dist/npm/plugins/image-resize.js +5 -3
- package/dist/npm/plugins/placeholder.js +1 -0
- package/dist/npm/plugins/resize-utils.d.ts +8 -8
- package/dist/npm/plugins/resize-utils.js +1 -0
- package/dist/npm/plugins/spaces-fix.d.ts +1 -1
- package/dist/npm/plugins/spaces-fix.js +3 -1
- package/dist/npm/plugins/table-resize/column-resize.js +8 -7
- package/dist/npm/plugins/table-resize/index.d.ts +1 -1
- package/dist/npm/plugins/table-resize/index.js +6 -4
- package/dist/npm/plugins/table-resize/row-resize.js +5 -4
- package/dist/npm/plugins/table-resize/table-resize.d.ts +16 -2
- package/dist/npm/plugins/table-resize/table-resize.js +8 -6
- package/dist/npm/plugins/table-resize/table-view.js +1 -0
- package/dist/npm/plugins/table-resize/utils.d.ts +4 -4
- package/dist/npm/plugins/table-resize/utils.js +7 -5
- package/dist/npm/source.d.ts +6 -6
- package/dist/npm/source.js +15 -7
- package/dist/npm/table.d.ts +7 -7
- package/dist/npm/table.js +12 -8
- package/dist/npm/text.js +3 -1
- package/dist/npm/utils.d.ts +8 -8
- package/dist/npm/utils.js +25 -12
- package/dist/systemjs/kendo-editor-common.js +1 -1
- package/package.json +15 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
|
2
|
-
import { tableNodes } from 'prosemirror-tables';
|
|
2
|
+
import { tableNodes } from 'prosemirror-tables-ts';
|
|
3
3
|
import { domToPmDoc, htmlToFragment, pmDocToFragment } from '../source';
|
|
4
4
|
import { rowTypeAttr, colgroupAttr, resizableAttr } from './constants';
|
|
5
5
|
const hole = 0;
|
|
@@ -49,16 +49,16 @@ const tagMark = tag => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
-
const marks = Object.assign({
|
|
52
|
+
const marks = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
53
53
|
// :: MarkSpec A link. Has `href` and `title` attributes. `title`
|
|
54
54
|
// defaults to the empty string. Rendered and parsed as an `<a>`
|
|
55
55
|
// element.
|
|
56
56
|
link: {
|
|
57
|
-
attrs: Object.assign({}, commonAttributes(), { href: { default: null }, target: { default: null }, title: { default: null } }),
|
|
57
|
+
attrs: Object.assign(Object.assign({}, commonAttributes()), { href: { default: null }, target: { default: null }, title: { default: null } }),
|
|
58
58
|
inclusive: false,
|
|
59
59
|
parseDOM: [{ tag: 'a', getAttrs: domAttributes }],
|
|
60
60
|
toDOM: (node) => ['a', pmAttributes(node.attrs), hole]
|
|
61
|
-
} }, tagMark('strong'), tagMark('b'), tagMark('em'), tagMark('i'), tagMark('u'), tagMark('del'), tagMark('sub'), tagMark('sup'), tagMark('code'), { style: {
|
|
61
|
+
} }, tagMark('strong')), tagMark('b')), tagMark('em')), tagMark('i')), tagMark('u')), tagMark('del')), tagMark('sub')), tagMark('sup')), tagMark('code')), { style: {
|
|
62
62
|
attrs: Object.assign({}, commonAttributes()),
|
|
63
63
|
parseDOM: [{
|
|
64
64
|
tag: 'span',
|
|
@@ -76,7 +76,7 @@ const cellAttribute = (name) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
-
const cellAttributes = Object.assign({}, cellAttribute('style'), cellAttribute('class'), cellAttribute('id'), cellAttribute('headers'));
|
|
79
|
+
const cellAttributes = Object.assign(Object.assign(Object.assign(Object.assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers'));
|
|
80
80
|
const colgroupNodes = {
|
|
81
81
|
doc: { content: 'colgroup*' },
|
|
82
82
|
col: {
|
|
@@ -113,10 +113,10 @@ export const parseStrColgroup = (colgroup) => {
|
|
|
113
113
|
return colgroupEl;
|
|
114
114
|
};
|
|
115
115
|
const tNodes = tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes });
|
|
116
|
-
tNodes.table_row.attrs = Object.assign({}, tNodes.table_row.attrs, defaultAttrs([rowTypeAttr, 'style', 'class', 'id']));
|
|
116
|
+
tNodes.table_row.attrs = Object.assign(Object.assign({}, tNodes.table_row.attrs), defaultAttrs([rowTypeAttr, 'style', 'class', 'id']));
|
|
117
117
|
tNodes.table_row.toDOM = node => ['tr', pmAttributes(node.attrs), 0];
|
|
118
118
|
tNodes.table_row.parseDOM = [{ tag: 'tr', getAttrs: domAttributes }];
|
|
119
|
-
tNodes.table.attrs = Object.assign({}, tNodes.table.attrs, defaultAttrs(['style', 'class', 'id', colgroupAttr, resizableAttr]));
|
|
119
|
+
tNodes.table.attrs = Object.assign(Object.assign({}, tNodes.table.attrs), defaultAttrs(['style', 'class', 'id', colgroupAttr, resizableAttr]));
|
|
120
120
|
tNodes.table.toDOM = (node) => {
|
|
121
121
|
const tableAttrs = hasAttrs(node.attrs) ? pmAttributes(node.attrs, [colgroupAttr, resizableAttr]) : {};
|
|
122
122
|
let colgroup = null;
|
|
@@ -194,17 +194,17 @@ const nodes = Object.assign({
|
|
|
194
194
|
// has to hold the numbers from 1 to 6. Parsed and serialized as `<h1>` to
|
|
195
195
|
// `<h6>` elements.
|
|
196
196
|
heading: {
|
|
197
|
-
attrs: Object.assign({}, commonAttributes(), { level: { default: 1 } }),
|
|
197
|
+
attrs: Object.assign(Object.assign({}, commonAttributes()), { level: { default: 1 } }),
|
|
198
198
|
content: 'inline*',
|
|
199
199
|
group: 'block',
|
|
200
200
|
defining: true,
|
|
201
201
|
parseDOM: [
|
|
202
|
-
{ tag: 'h1', getAttrs: node => (Object.assign({}, domAttributes(node), { level: 1 })) },
|
|
203
|
-
{ tag: 'h2', getAttrs: node => (Object.assign({}, domAttributes(node), { level: 2 })) },
|
|
204
|
-
{ tag: 'h3', getAttrs: node => (Object.assign({}, domAttributes(node), { level: 3 })) },
|
|
205
|
-
{ tag: 'h4', getAttrs: node => (Object.assign({}, domAttributes(node), { level: 4 })) },
|
|
206
|
-
{ tag: 'h5', getAttrs: node => (Object.assign({}, domAttributes(node), { level: 5 })) },
|
|
207
|
-
{ tag: 'h6', getAttrs: node => (Object.assign({}, domAttributes(node), { level: 6 })) }
|
|
202
|
+
{ tag: 'h1', getAttrs: node => (Object.assign(Object.assign({}, domAttributes(node)), { level: 1 })) },
|
|
203
|
+
{ tag: 'h2', getAttrs: node => (Object.assign(Object.assign({}, domAttributes(node)), { level: 2 })) },
|
|
204
|
+
{ tag: 'h3', getAttrs: node => (Object.assign(Object.assign({}, domAttributes(node)), { level: 3 })) },
|
|
205
|
+
{ tag: 'h4', getAttrs: node => (Object.assign(Object.assign({}, domAttributes(node)), { level: 4 })) },
|
|
206
|
+
{ tag: 'h5', getAttrs: node => (Object.assign(Object.assign({}, domAttributes(node)), { level: 5 })) },
|
|
207
|
+
{ tag: 'h6', getAttrs: node => (Object.assign(Object.assign({}, domAttributes(node)), { level: 6 })) }
|
|
208
208
|
],
|
|
209
209
|
toDOM: node => hasAttrs(node.attrs, 'level') ?
|
|
210
210
|
['h' + node.attrs.level, pmAttributes(node.attrs, ['level']), hole] :
|
|
@@ -258,14 +258,14 @@ const nodes = Object.assign({
|
|
|
258
258
|
ordered_list: {
|
|
259
259
|
content: 'list_item+',
|
|
260
260
|
group: 'block',
|
|
261
|
-
attrs: Object.assign({}, commonAttributes(), { type: { default: null }, order: { default: 1 } }),
|
|
261
|
+
attrs: Object.assign(Object.assign({}, commonAttributes()), { type: { default: null }, order: { default: 1 } }),
|
|
262
262
|
parseDOM: [{ tag: 'ol', getAttrs: (dom) => {
|
|
263
|
-
return Object.assign({}, domAttributes(dom), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
|
|
263
|
+
return Object.assign(Object.assign({}, domAttributes(dom)), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
|
|
264
264
|
} }],
|
|
265
265
|
toDOM: node => {
|
|
266
266
|
return node.attrs.order === 1 ?
|
|
267
267
|
(hasAttrs(node.attrs, 'order') ? ['ol', pmAttributes(node.attrs, ['order']), hole] : olDOM) :
|
|
268
|
-
['ol', Object.assign({}, pmAttributes(node.attrs, ['order']), { start: node.attrs.order }), hole];
|
|
268
|
+
['ol', Object.assign(Object.assign({}, pmAttributes(node.attrs, ['order'])), { start: node.attrs.order }), hole];
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
271
|
// :: NodeSpec
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
2
|
import { TextSelection } from 'prosemirror-state';
|
|
3
3
|
export const findAt = (doc, searchOptions, start, end, exit) => {
|
|
4
4
|
let result = [], exec, text, from, to, childText, nextSibling;
|
|
@@ -57,7 +57,7 @@ export const findAt = (doc, searchOptions, start, end, exit) => {
|
|
|
57
57
|
return result;
|
|
58
58
|
};
|
|
59
59
|
export const find = (state, searchOptions) => {
|
|
60
|
-
const { backward, matchCyclic } = searchOptions, options =
|
|
60
|
+
const { backward, matchCyclic } = searchOptions, options = __rest(searchOptions, ["backward", "matchCyclic"]);
|
|
61
61
|
const exit = backward ? () => false : r => r.length > 0;
|
|
62
62
|
const { doc, selection } = state;
|
|
63
63
|
let result = [];
|
|
@@ -21,7 +21,7 @@ const changeStyleMark = (tr, from, to, attrs, markType) => {
|
|
|
21
21
|
const style = newStyle.changed ?
|
|
22
22
|
{ style: newStyle.style || null } : { style: `${[attrs.style]}: ${attrs.newValue};` };
|
|
23
23
|
const currentMark = markType.isInSet(marks) ? marks.find(m => m.type.name === 'style') : null;
|
|
24
|
-
const newMarkAttrs = currentMark ? Object.assign({}, currentMark.attrs, style) : style;
|
|
24
|
+
const newMarkAttrs = currentMark ? Object.assign(Object.assign({}, currentMark.attrs), style) : style;
|
|
25
25
|
const newStyleMark = markType.create(newMarkAttrs);
|
|
26
26
|
let newSet = newStyleMark.addToSet(marks);
|
|
27
27
|
for (let i = 0; i < marks.length; i++) {
|
|
@@ -73,7 +73,7 @@ const changeStyle = (markType, attrs) => {
|
|
|
73
73
|
if (markType.isInSet(currentMarks)) {
|
|
74
74
|
const newStyle = changeStyleFromMark(currentMarks, attrs);
|
|
75
75
|
const styleMark = currentMarks.find(m => m.type.name === 'style');
|
|
76
|
-
const newAttrs = Object.assign({}, (styleMark ? styleMark.attrs : {}), { style: newStyle.style || null });
|
|
76
|
+
const newAttrs = Object.assign(Object.assign({}, (styleMark ? styleMark.attrs : {})), { style: newStyle.style || null });
|
|
77
77
|
if (shallowEqual(styleMark.attrs, newAttrs)) {
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
@@ -159,7 +159,7 @@ export const applyInlineStyle = (options, command) => (state, dispatch) => {
|
|
|
159
159
|
else if (attrs.newValue) {
|
|
160
160
|
newStyles.style = `${[attrs.style]}: ${attrs.newValue};`;
|
|
161
161
|
}
|
|
162
|
-
const newMarkAttrs = currentMark ? Object.assign({}, currentMark.attrs, newStyles) : newStyles;
|
|
162
|
+
const newMarkAttrs = currentMark ? Object.assign(Object.assign({}, currentMark.attrs), newStyles) : newStyles;
|
|
163
163
|
if (Object.keys(newMarkAttrs).some(attrName => newMarkAttrs[attrName] !== null)) {
|
|
164
164
|
dispatch(tr.addStoredMark(markType.create(newMarkAttrs)));
|
|
165
165
|
}
|
package/dist/es2015/main.js
CHANGED
|
@@ -36,7 +36,7 @@ export * from 'prosemirror-model';
|
|
|
36
36
|
export * from 'prosemirror-schema-list';
|
|
37
37
|
export * from 'prosemirror-state';
|
|
38
38
|
// Fixes an error related to setting over the addRowAfter and addRowBefore exports from the PM tables module
|
|
39
|
-
export { TableMap, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, fixTables, fixTablesKey, isInTable, deleteTable, inSameTable, CellSelection, selectedRect, selectionCell, setCellAttr, goToNextCell, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, splitCell, splitCellWithType, mergeCells, deleteColumn, deleteRow, rowIsHeader, addRow, addColSpan, addColumn, addColumnAfter, addColumnBefore, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, updateColumnsOnResize, cellAround, findCell, removeColSpan, moveCellForward, nextCell } from 'prosemirror-tables';
|
|
39
|
+
export { TableMap, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, fixTables, fixTablesKey, isInTable, deleteTable, inSameTable, CellSelection, selectedRect, selectionCell, setCellAttr, goToNextCell, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, splitCell, splitCellWithType, mergeCells, deleteColumn, deleteRow, rowIsHeader, addRow, addColSpan, addColumn, addColumnAfter, addColumnBefore, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, updateColumnsOnResize, cellAround, findCell, removeColSpan, moveCellForward, nextCell } from 'prosemirror-tables-ts';
|
|
40
40
|
export * from 'prosemirror-transform';
|
|
41
41
|
export * from 'prosemirror-view';
|
|
42
42
|
export { createTable, addRowAfter, addRowBefore, pmAddRowAfter, pmAddRowBefore } from './table';
|
|
@@ -73,10 +73,10 @@ const handleMouseUp = (view) => {
|
|
|
73
73
|
if (reSize.test(currAttrs.style || '')) {
|
|
74
74
|
const changedWidth = changeStylesString(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
|
|
75
75
|
const { style } = changeStylesString(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' });
|
|
76
|
-
attrs = Object.assign({}, currAttrs, { style });
|
|
76
|
+
attrs = Object.assign(Object.assign({}, currAttrs), { style });
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
|
-
attrs = Object.assign({}, currAttrs, { width, height });
|
|
79
|
+
attrs = Object.assign(Object.assign({}, currAttrs), { width, height });
|
|
80
80
|
}
|
|
81
81
|
const newImage = selection.node.type.createAndFill(attrs);
|
|
82
82
|
if (newImage) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'prosemirror-state';
|
|
2
|
-
import { tableNodeTypes, TableMap } from 'prosemirror-tables';
|
|
2
|
+
import { tableNodeTypes, TableMap } from 'prosemirror-tables-ts';
|
|
3
3
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
4
4
|
import { colgroupAttr } from '../../config/constants';
|
|
5
5
|
import { TableView } from './table-view';
|
|
@@ -145,7 +145,7 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
145
145
|
tableDom.insertBefore(colgroup, tableDom.firstChild);
|
|
146
146
|
col = cols[cellIndex];
|
|
147
147
|
col.style.width = col.offsetWidth + 'px';
|
|
148
|
-
tableAttrs = Object.assign({}, tableNode.attrs, { [colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>' });
|
|
148
|
+
tableAttrs = Object.assign(Object.assign({}, tableNode.attrs), { [colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>' });
|
|
149
149
|
}
|
|
150
150
|
let width = parseFloat(col.style.width);
|
|
151
151
|
const tr = view.state.tr.setMeta(key, { setDragging: { startX: event.clientX, startWidth: width } });
|
|
@@ -218,7 +218,7 @@ function updateColumnWidth(view, tr, cell, _width) {
|
|
|
218
218
|
let attrs = tableNode.attrs;
|
|
219
219
|
if (tableNode && attrs[colgroupAttr]) {
|
|
220
220
|
const colgroup = tableDom.firstChild;
|
|
221
|
-
attrs = Object.assign({}, attrs, { [colgroupAttr]: colgroup.outerHTML });
|
|
221
|
+
attrs = Object.assign(Object.assign({}, attrs), { [colgroupAttr]: colgroup.outerHTML });
|
|
222
222
|
}
|
|
223
223
|
const tableDomWidth = tableDom.style.width;
|
|
224
224
|
if (tableDom && tableDomWidth && parseStyle(attrs.style).width !== tableDomWidth) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'prosemirror-state';
|
|
2
|
-
import { TableMap, tableNodeTypes } from 'prosemirror-tables';
|
|
2
|
+
import { TableMap, tableNodeTypes } from 'prosemirror-tables-ts';
|
|
3
3
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
4
4
|
import { domCellAround, otherResizeHandle, otherResizing, parentNode, parseStyle, setNodeStyle, tableRowResizeKey as key } from './utils';
|
|
5
5
|
class TableRowView {
|
|
@@ -218,22 +218,22 @@ export const tableResizing = (options = { node: 'table' }) => {
|
|
|
218
218
|
tr.setMeta('addToHistory', false);
|
|
219
219
|
if (selected && prevSelected && selected.pos !== prevSelected.pos) {
|
|
220
220
|
tr.setMeta(key, { nodePosition: selected.pos });
|
|
221
|
-
tr.setNodeMarkup(prevSelected.pos, nodeType, Object.assign({}, prevSelected.node.attrs, { [resizableAttr]: false }));
|
|
222
|
-
tr.setNodeMarkup(selected.pos, nodeType, Object.assign({}, selected.node.attrs, { [resizableAttr]: true }));
|
|
221
|
+
tr.setNodeMarkup(prevSelected.pos, nodeType, Object.assign(Object.assign({}, prevSelected.node.attrs), { [resizableAttr]: false }));
|
|
222
|
+
tr.setNodeMarkup(selected.pos, nodeType, Object.assign(Object.assign({}, selected.node.attrs), { [resizableAttr]: true }));
|
|
223
223
|
view.dispatch(tr);
|
|
224
224
|
}
|
|
225
225
|
else if (selected && prevSelected && selected.pos === prevSelected.pos &&
|
|
226
226
|
!selected.node.attrs[resizableAttr] && !state.selection.eq(prevState.selection)) {
|
|
227
227
|
tr.setMeta(key, { nodePosition: selected.pos });
|
|
228
|
-
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, Object.assign({}, selected.node.attrs, { [resizableAttr]: true })));
|
|
228
|
+
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, Object.assign(Object.assign({}, selected.node.attrs), { [resizableAttr]: true })));
|
|
229
229
|
}
|
|
230
230
|
else if (selected && !prevSelected) {
|
|
231
231
|
tr.setMeta(key, { nodePosition: selected.pos });
|
|
232
|
-
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, Object.assign({}, selected.node.attrs, { [resizableAttr]: true })));
|
|
232
|
+
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, Object.assign(Object.assign({}, selected.node.attrs), { [resizableAttr]: true })));
|
|
233
233
|
}
|
|
234
234
|
else if (!selected && prevSelected) {
|
|
235
235
|
tr.setMeta(key, { nodePosition: -1 });
|
|
236
|
-
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, Object.assign({}, prevSelected.node.attrs, { [resizableAttr]: false })));
|
|
236
|
+
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, Object.assign(Object.assign({}, prevSelected.node.attrs), { [resizableAttr]: false })));
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -5,20 +5,20 @@ export const parseStyle = (styleText) => {
|
|
|
5
5
|
const styles = (styleText || '').split(/\s*;\s*/).filter(Boolean).map(s => {
|
|
6
6
|
const nameValue = s.split(/\s*:\s*/);
|
|
7
7
|
return { [nameValue[0]]: nameValue[1] };
|
|
8
|
-
}).reduce((acc, val) => (Object.assign({}, acc, val)), {});
|
|
8
|
+
}).reduce((acc, val) => (Object.assign(Object.assign({}, acc), val)), {});
|
|
9
9
|
return styles;
|
|
10
10
|
};
|
|
11
11
|
export function setNodeStyle(nodeAttrs, styleType, value) {
|
|
12
12
|
let attrs;
|
|
13
13
|
if (new RegExp('[^-]?' + styleType + ':').test(nodeAttrs.style || '')) {
|
|
14
14
|
const { style } = changeStylesString(nodeAttrs.style || '', { style: styleType, value: reAnyValue, newValue: value });
|
|
15
|
-
attrs = Object.assign({}, nodeAttrs, { style });
|
|
15
|
+
attrs = Object.assign(Object.assign({}, nodeAttrs), { style });
|
|
16
16
|
}
|
|
17
17
|
else if (nodeAttrs.style) {
|
|
18
|
-
attrs = Object.assign({}, nodeAttrs, { style: nodeAttrs.style.replace(/;$/, '') + '; ' + styleType + ': ' + value + ';' });
|
|
18
|
+
attrs = Object.assign(Object.assign({}, nodeAttrs), { style: nodeAttrs.style.replace(/;$/, '') + '; ' + styleType + ': ' + value + ';' });
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
attrs = Object.assign({}, nodeAttrs, { style: styleType + ': ' + value + ';' });
|
|
21
|
+
attrs = Object.assign(Object.assign({}, nodeAttrs), { style: styleType + ': ' + value + ';' });
|
|
22
22
|
}
|
|
23
23
|
return attrs;
|
|
24
24
|
}
|
package/dist/es2015/table.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addRowAfter as pmAddRowAfter, addRowBefore as pmAddRowBefore } from 'prosemirror-tables';
|
|
1
|
+
import { addRowAfter as pmAddRowAfter, addRowBefore as pmAddRowBefore } from 'prosemirror-tables-ts';
|
|
2
2
|
import { rowTypeAttr } from './config/constants';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a table.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/npm/align.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import { Command } from './types/command';
|
|
|
6
6
|
*
|
|
7
7
|
* @returns {boolean} - Returns true if any alignment is applied.
|
|
8
8
|
*/
|
|
9
|
-
export declare const alignBlocks: (actions: AlignRule
|
|
10
|
-
export declare const isAligned: (state: EditorState
|
|
9
|
+
export declare const alignBlocks: (actions: Array<AlignRule>, commandName?: string) => Command;
|
|
10
|
+
export declare const isAligned: (state: EditorState, actions: Array<AlignRule>) => boolean;
|
package/dist/npm/align.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAligned = exports.alignBlocks = void 0;
|
|
3
4
|
var blockNode_1 = require("./blockNode");
|
|
4
5
|
/**
|
|
5
6
|
* Aligning block elements in the selection.
|
|
6
7
|
*
|
|
7
8
|
* @returns {boolean} - Returns true if any alignment is applied.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
var alignBlocks = function (actions, commandName) { return function (state, dispatch) {
|
|
10
11
|
var blocks = blockNode_1.blockNodes(state);
|
|
11
12
|
var tr = state.tr;
|
|
12
13
|
tr.setMeta('commandName', commandName);
|
|
@@ -26,7 +27,8 @@ exports.alignBlocks = function (actions, commandName) { return function (state,
|
|
|
26
27
|
}
|
|
27
28
|
return result;
|
|
28
29
|
}; };
|
|
29
|
-
exports.
|
|
30
|
+
exports.alignBlocks = alignBlocks;
|
|
31
|
+
var isAligned = function (state, actions) {
|
|
30
32
|
var blocks = blockNode_1.blockNodes(state);
|
|
31
33
|
var result = false;
|
|
32
34
|
blocks.forEach(function (node) {
|
|
@@ -41,3 +43,4 @@ exports.isAligned = function (state, actions) {
|
|
|
41
43
|
});
|
|
42
44
|
return result;
|
|
43
45
|
};
|
|
46
|
+
exports.isAligned = isAligned;
|
package/dist/npm/blockNode.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { CleanFormattingOptions } from './cleanFormatting';
|
|
|
7
7
|
* @example
|
|
8
8
|
* See `cleanTextBlockFormatting` or `formatBlockElements` function.
|
|
9
9
|
*/
|
|
10
|
-
export declare const changeTextBlock: (tr: Transaction
|
|
10
|
+
export declare const changeTextBlock: (tr: Transaction, node: Node, nodeType: NodeType, attrs?: {
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
}) => boolean;
|
|
13
13
|
/**
|
|
@@ -16,13 +16,13 @@ export declare const changeTextBlock: (tr: Transaction<any>, node: Node<any>, no
|
|
|
16
16
|
* @example
|
|
17
17
|
* See `cleanTextBlockFormatting` function.
|
|
18
18
|
*/
|
|
19
|
-
export declare const blockNodes: (state: EditorState
|
|
20
|
-
doc: Node
|
|
21
|
-
selection: Selection
|
|
19
|
+
export declare const blockNodes: (state: EditorState | {
|
|
20
|
+
doc: Node;
|
|
21
|
+
selection: Selection;
|
|
22
22
|
}, options?: {
|
|
23
23
|
blocksInSelection: boolean;
|
|
24
|
-
}) => Node
|
|
25
|
-
export declare const formatBlockElements: (value:
|
|
24
|
+
}) => Array<Node>;
|
|
25
|
+
export declare const formatBlockElements: (value: 'p' | 'blockquote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', commandName?: string) => (state: any, dispatch: any) => any;
|
|
26
26
|
/**
|
|
27
27
|
* Removes the style and class attributes of text block elements.
|
|
28
28
|
* Requires to dispatch the transaction.
|
|
@@ -30,17 +30,17 @@ export declare const formatBlockElements: (value: "blockquote" | "h1" | "h2" | "
|
|
|
30
30
|
* @example
|
|
31
31
|
* See `cleanFormatting` function.
|
|
32
32
|
*/
|
|
33
|
-
export declare const cleanTextBlockFormatting: (tr: Transaction
|
|
34
|
-
export declare const getBlockFormats: (state: EditorState
|
|
35
|
-
export declare const addStyles: (node: Node
|
|
33
|
+
export declare const cleanTextBlockFormatting: (tr: Transaction, options?: CleanFormattingOptions) => void;
|
|
34
|
+
export declare const getBlockFormats: (state: EditorState) => Array<string>;
|
|
35
|
+
export declare const addStyles: (node: Node, stylesToApply: Array<{
|
|
36
36
|
name: string;
|
|
37
37
|
value: string;
|
|
38
|
-
}
|
|
39
|
-
export declare const hasNode: (state: EditorState
|
|
40
|
-
export declare const parentBlockFormat: (state: EditorState
|
|
38
|
+
}>) => {};
|
|
39
|
+
export declare const hasNode: (state: EditorState, nodeType: NodeType) => boolean;
|
|
40
|
+
export declare const parentBlockFormat: (state: EditorState) => string | null;
|
|
41
41
|
/**
|
|
42
42
|
* **Deprecated.** Use `parentBlockFormat` function instead.
|
|
43
43
|
*/
|
|
44
|
-
export declare const activeNode: (state: EditorState
|
|
44
|
+
export declare const activeNode: (state: EditorState) => {
|
|
45
45
|
tag: string;
|
|
46
46
|
};
|
package/dist/npm/blockNode.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.activeNode = exports.parentBlockFormat = exports.hasNode = exports.addStyles = exports.getBlockFormats = exports.cleanTextBlockFormatting = exports.formatBlockElements = exports.blockNodes = exports.changeTextBlock = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var utils_1 = require("./utils");
|
|
5
6
|
var prosemirror_transform_1 = require("prosemirror-transform");
|
|
@@ -18,7 +19,7 @@ var canChangeType = function (stateDoc, pos, type) {
|
|
|
18
19
|
* @example
|
|
19
20
|
* See `cleanTextBlockFormatting` or `formatBlockElements` function.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
var changeTextBlock = function (tr, node, nodeType, attrs) {
|
|
22
23
|
if (!nodeType.isTextblock) {
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
@@ -43,13 +44,14 @@ exports.changeTextBlock = function (tr, node, nodeType, attrs) {
|
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
46
|
};
|
|
47
|
+
exports.changeTextBlock = changeTextBlock;
|
|
46
48
|
/**
|
|
47
49
|
* Traverses the selection and returns the block nodes in it.
|
|
48
50
|
*
|
|
49
51
|
* @example
|
|
50
52
|
* See `cleanTextBlockFormatting` function.
|
|
51
53
|
*/
|
|
52
|
-
|
|
54
|
+
var blockNodes = function (state, options) {
|
|
53
55
|
if (options === void 0) { options = { blocksInSelection: false }; }
|
|
54
56
|
var doc = state.doc, selection = state.selection;
|
|
55
57
|
var $from = selection.$from, ranges = selection.ranges;
|
|
@@ -82,7 +84,8 @@ exports.blockNodes = function (state, options) {
|
|
|
82
84
|
}
|
|
83
85
|
return result;
|
|
84
86
|
};
|
|
85
|
-
exports.
|
|
87
|
+
exports.blockNodes = blockNodes;
|
|
88
|
+
var formatBlockElements = function (value, commandName) {
|
|
86
89
|
return function (state, dispatch) {
|
|
87
90
|
var blocks = exports.blockNodes(state);
|
|
88
91
|
var nodes = state.schema.nodes;
|
|
@@ -97,7 +100,7 @@ exports.formatBlockElements = function (value, commandName) {
|
|
|
97
100
|
}
|
|
98
101
|
else if (/^h[1-6]$/i.test(value)) {
|
|
99
102
|
var level = parseInt(value.substr(1), 10);
|
|
100
|
-
exports.changeTextBlock(tr, node, nodes.heading, tslib_1.__assign({}, node.attrs, { level: level }));
|
|
103
|
+
exports.changeTextBlock(tr, node, nodes.heading, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { level: level }));
|
|
101
104
|
}
|
|
102
105
|
else if (value === 'blockquote') {
|
|
103
106
|
var _b = node.attrs, level = _b.level, attrs = tslib_1.__rest(_b, ["level"]);
|
|
@@ -112,6 +115,7 @@ exports.formatBlockElements = function (value, commandName) {
|
|
|
112
115
|
return result;
|
|
113
116
|
};
|
|
114
117
|
};
|
|
118
|
+
exports.formatBlockElements = formatBlockElements;
|
|
115
119
|
/**
|
|
116
120
|
* Removes the style and class attributes of text block elements.
|
|
117
121
|
* Requires to dispatch the transaction.
|
|
@@ -119,7 +123,7 @@ exports.formatBlockElements = function (value, commandName) {
|
|
|
119
123
|
* @example
|
|
120
124
|
* See `cleanFormatting` function.
|
|
121
125
|
*/
|
|
122
|
-
|
|
126
|
+
var cleanTextBlockFormatting = function (tr, options) {
|
|
123
127
|
if (options === void 0) { options = { blocksInSelection: true }; }
|
|
124
128
|
var doc = tr.doc, selection = tr.selection;
|
|
125
129
|
var blocksInSelection = options.blocksInSelection, blockNodeType = options.blockNodeType;
|
|
@@ -133,7 +137,8 @@ exports.cleanTextBlockFormatting = function (tr, options) {
|
|
|
133
137
|
}
|
|
134
138
|
});
|
|
135
139
|
};
|
|
136
|
-
exports.
|
|
140
|
+
exports.cleanTextBlockFormatting = cleanTextBlockFormatting;
|
|
141
|
+
var getBlockFormats = function (state) {
|
|
137
142
|
var blocks = exports.blockNodes(state);
|
|
138
143
|
var nodes = state.schema.nodes;
|
|
139
144
|
var result = [];
|
|
@@ -151,7 +156,8 @@ exports.getBlockFormats = function (state) {
|
|
|
151
156
|
});
|
|
152
157
|
return result;
|
|
153
158
|
};
|
|
154
|
-
exports.
|
|
159
|
+
exports.getBlockFormats = getBlockFormats;
|
|
160
|
+
var addStyles = function (node, stylesToApply) {
|
|
155
161
|
var currentStyles = node.attrs.style, changedStyleResult, toChange;
|
|
156
162
|
if (currentStyles) {
|
|
157
163
|
stylesToApply.forEach(function (style) {
|
|
@@ -164,7 +170,8 @@ exports.addStyles = function (node, stylesToApply) {
|
|
|
164
170
|
currentStyles = currentStyles || stylesToApply.reduce(reducer, '');
|
|
165
171
|
return Object.assign({}, node.attrs, { style: currentStyles || null });
|
|
166
172
|
};
|
|
167
|
-
exports.
|
|
173
|
+
exports.addStyles = addStyles;
|
|
174
|
+
var hasNode = function (state, nodeType) {
|
|
168
175
|
var _a = state.selection, from = _a.from, to = _a.to;
|
|
169
176
|
var result = false;
|
|
170
177
|
state.doc.nodesBetween(from, to, function (node) {
|
|
@@ -173,13 +180,16 @@ exports.hasNode = function (state, nodeType) {
|
|
|
173
180
|
});
|
|
174
181
|
return result;
|
|
175
182
|
};
|
|
176
|
-
exports.
|
|
183
|
+
exports.hasNode = hasNode;
|
|
184
|
+
var parentBlockFormat = function (state) {
|
|
177
185
|
var formats = exports.getBlockFormats(state);
|
|
178
186
|
return new Set(formats).size === 1 ? formats[0] : null;
|
|
179
187
|
};
|
|
188
|
+
exports.parentBlockFormat = parentBlockFormat;
|
|
180
189
|
/**
|
|
181
190
|
* **Deprecated.** Use `parentBlockFormat` function instead.
|
|
182
191
|
*/
|
|
183
|
-
|
|
192
|
+
var activeNode = function (state) {
|
|
184
193
|
return { tag: exports.parentBlockFormat(state) || '' };
|
|
185
194
|
};
|
|
195
|
+
exports.activeNode = activeNode;
|
package/dist/npm/blockquote.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
-
export declare const blockquote: (state: EditorState
|
|
3
|
-
export declare const liftBlockquote: (state: EditorState
|
|
2
|
+
export declare const blockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
3
|
+
export declare const liftBlockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
package/dist/npm/blockquote.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.liftBlockquote = exports.blockquote = void 0;
|
|
3
4
|
var prosemirror_commands_1 = require("prosemirror-commands");
|
|
4
|
-
|
|
5
|
+
var blockquote = function (state, dispatch) {
|
|
5
6
|
return prosemirror_commands_1.wrapIn(state.schema.nodes.blockquote)(state, dispatch);
|
|
6
7
|
};
|
|
7
|
-
exports.
|
|
8
|
+
exports.blockquote = blockquote;
|
|
9
|
+
var liftBlockquote = function (state, dispatch) {
|
|
8
10
|
var _a = state.selection, $from = _a.$from, $to = _a.$to;
|
|
9
11
|
var nodeType = state.schema.nodes.blockquote;
|
|
10
12
|
var doc = state.doc;
|
|
@@ -23,3 +25,4 @@ exports.liftBlockquote = function (state, dispatch) {
|
|
|
23
25
|
}
|
|
24
26
|
return result;
|
|
25
27
|
};
|
|
28
|
+
exports.liftBlockquote = liftBlockquote;
|
|
@@ -3,7 +3,7 @@ import { EditorState, Transaction } from 'prosemirror-state';
|
|
|
3
3
|
/**
|
|
4
4
|
* A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
|
|
5
5
|
*/
|
|
6
|
-
export declare const cleanFormatting: (options?: CleanFormattingOptions) => (state: EditorState
|
|
6
|
+
export declare const cleanFormatting: (options?: CleanFormattingOptions) => (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
7
7
|
/**
|
|
8
8
|
* The cleanFormatting command options.
|
|
9
9
|
* Defaults to `{ blocksInSelection: true }`.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanFormatting = void 0;
|
|
3
4
|
var blockNode_1 = require("./blockNode");
|
|
4
5
|
var mark_1 = require("./mark");
|
|
5
6
|
/**
|
|
6
7
|
* A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
var cleanFormatting = function (options) {
|
|
9
10
|
if (options === void 0) { options = { blocksInSelection: true }; }
|
|
10
11
|
return function (state, dispatch) {
|
|
11
12
|
var tr = state.tr;
|
|
@@ -20,3 +21,4 @@ exports.cleanFormatting = function (options) {
|
|
|
20
21
|
return result;
|
|
21
22
|
};
|
|
22
23
|
};
|
|
24
|
+
exports.cleanFormatting = cleanFormatting;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alignRemoveRules = exports.alignJustifyRules = exports.alignCenterRules = exports.alignRightRules = exports.alignLeftRules = void 0;
|
|
3
4
|
var style = function (name, value) {
|
|
4
5
|
return { name: name, value: value };
|
|
5
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unlink = exports.link = exports.superscript = exports.subscript = exports.strikethrough = exports.underline = exports.italic = exports.bold = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* The object of the Bold command.
|
|
5
6
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataResizeDirImage = exports.dataResizeDirTable = exports.resizeHandle = exports.resizableWrap = exports.resizableAttr = exports.colgroupAttr = exports.rowTypeAttr = void 0;
|
|
3
4
|
exports.rowTypeAttr = 'k-parent-node';
|
|
4
5
|
exports.colgroupAttr = 'k-colgroup-data';
|
|
5
6
|
exports.resizableAttr = 'k-resizable-node';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
|
2
|
-
export declare const buildKeymap: (schema: Schema
|
|
3
|
-
export declare const buildListKeymap: (schema: Schema
|
|
2
|
+
export declare const buildKeymap: (schema: Schema, options?: any) => any;
|
|
3
|
+
export declare const buildListKeymap: (schema: Schema) => any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildListKeymap = exports.buildKeymap = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var prosemirror_commands_1 = require("prosemirror-commands");
|
|
5
6
|
var prosemirror_history_1 = require("prosemirror-history");
|
|
@@ -10,7 +11,7 @@ var inline_style_1 = require("./../inline-style");
|
|
|
10
11
|
var utils_1 = require("../utils");
|
|
11
12
|
var mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
|
|
12
13
|
// https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/keymap.js
|
|
13
|
-
|
|
14
|
+
var buildKeymap = function (schema, options) {
|
|
14
15
|
var keys = {};
|
|
15
16
|
var applyToWord = (options && options.applyToWord) || false;
|
|
16
17
|
keys['Mod-z'] = prosemirror_history_1.undo;
|
|
@@ -23,13 +24,13 @@ exports.buildKeymap = function (schema, options) {
|
|
|
23
24
|
keys['Mod-y'] = prosemirror_history_1.redo;
|
|
24
25
|
}
|
|
25
26
|
if (schema.marks.strong) {
|
|
26
|
-
keys['Mod-b'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign({}, commands_1.bold, { applyToWord: applyToWord }));
|
|
27
|
+
keys['Mod-b'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.bold), { applyToWord: applyToWord }));
|
|
27
28
|
}
|
|
28
29
|
if (schema.marks.em) {
|
|
29
|
-
keys['Mod-i'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign({}, commands_1.italic, { applyToWord: applyToWord }));
|
|
30
|
+
keys['Mod-i'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.italic), { applyToWord: applyToWord }));
|
|
30
31
|
}
|
|
31
32
|
if (schema.marks.u) {
|
|
32
|
-
keys['Mod-u'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign({}, commands_1.underline, { applyToWord: applyToWord }));
|
|
33
|
+
keys['Mod-u'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.underline), { applyToWord: applyToWord }));
|
|
33
34
|
}
|
|
34
35
|
if (schema.nodes.hard_break) {
|
|
35
36
|
var br_1 = schema.nodes.hard_break;
|
|
@@ -41,7 +42,8 @@ exports.buildKeymap = function (schema, options) {
|
|
|
41
42
|
}
|
|
42
43
|
return keys;
|
|
43
44
|
};
|
|
44
|
-
exports.
|
|
45
|
+
exports.buildKeymap = buildKeymap;
|
|
46
|
+
var buildListKeymap = function (schema) {
|
|
45
47
|
var keys = {};
|
|
46
48
|
if (schema.nodes.list_item) {
|
|
47
49
|
// tslint:disable-next-line:no-string-literal
|
|
@@ -49,3 +51,4 @@ exports.buildListKeymap = function (schema) {
|
|
|
49
51
|
}
|
|
50
52
|
return keys;
|
|
51
53
|
};
|
|
54
|
+
exports.buildListKeymap = buildListKeymap;
|