@progress/kendo-editor-common 1.11.9-dev.202412020819 → 1.11.9-develop.2
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/main.js +1 -1
- package/dist/es/DOMSerializer.js +71 -75
- package/dist/es/align.js +19 -16
- package/dist/es/blockNode.js +76 -78
- package/dist/es/blockquote.js +12 -9
- package/dist/es/cleanFormatting.js +16 -16
- package/dist/es/config/align-rules.js +8 -6
- package/dist/es/config/commands.js +9 -13
- package/dist/es/config/constants.js +9 -7
- package/dist/es/config/indent-rules.js +8 -6
- package/dist/es/config/keymap.js +20 -18
- package/dist/es/config/list-settings.js +7 -6
- package/dist/es/config/schema.js +184 -126
- package/dist/es/find-replace.js +34 -32
- package/dist/es/image.js +10 -7
- package/dist/es/indent.js +47 -44
- package/dist/es/inline-style.js +72 -70
- package/dist/es/link.js +51 -52
- package/dist/es/listConvert.js +37 -34
- package/dist/es/lists.js +83 -82
- package/dist/es/main.js +32 -33
- package/dist/es/mark.js +87 -92
- package/dist/es/paste.js +48 -46
- package/dist/es/plugins/caret-color.js +14 -11
- package/dist/es/plugins/csp-fix.js +23 -23
- package/dist/es/plugins/highlight.js +12 -10
- package/dist/es/plugins/image-resize.js +81 -81
- package/dist/es/plugins/list-markers-styles.js +43 -39
- package/dist/es/plugins/placeholder.js +12 -9
- package/dist/es/plugins/resize-utils.js +11 -9
- package/dist/es/plugins/spaces-fix.js +13 -10
- package/dist/es/plugins/table-resize/column-resize.js +104 -102
- package/dist/es/plugins/table-resize/index.js +10 -7
- package/dist/es/plugins/table-resize/row-resize.js +88 -89
- package/dist/es/plugins/table-resize/table-resize.js +129 -122
- package/dist/es/plugins/table-resize/table-view.js +46 -48
- package/dist/es/plugins/table-resize/utils.js +39 -41
- package/dist/es/source.js +78 -74
- package/dist/es/table.js +64 -66
- package/dist/es/text.js +4 -2
- package/dist/es/utils.js +107 -116
- package/dist/es2015/DOMSerializer.js +20 -17
- package/dist/es2015/align.js +6 -3
- package/dist/es2015/blockNode.js +15 -12
- package/dist/es2015/blockquote.js +5 -2
- package/dist/es2015/cleanFormatting.js +6 -3
- package/dist/es2015/config/align-rules.js +7 -5
- package/dist/es2015/config/commands.js +9 -13
- package/dist/es2015/config/constants.js +9 -7
- package/dist/es2015/config/indent-rules.js +6 -3
- package/dist/es2015/config/keymap.js +10 -7
- package/dist/es2015/config/list-settings.js +5 -3
- package/dist/es2015/config/schema.js +8 -6
- package/dist/es2015/find-replace.js +9 -6
- package/dist/es2015/image.js +5 -2
- package/dist/es2015/indent.js +14 -11
- package/dist/es2015/inline-style.js +9 -6
- package/dist/es2015/link.js +7 -4
- package/dist/es2015/listConvert.js +5 -2
- package/dist/es2015/lists.js +14 -11
- package/dist/es2015/main.js +32 -33
- package/dist/es2015/mark.js +15 -12
- package/dist/es2015/node_modules/tslib/tslib.es6.js +35 -0
- package/dist/es2015/paste.js +14 -11
- package/dist/es2015/plugins/caret-color.js +8 -5
- package/dist/es2015/plugins/csp-fix.js +5 -2
- package/dist/es2015/plugins/highlight.js +6 -3
- package/dist/es2015/plugins/image-resize.js +10 -7
- package/dist/es2015/plugins/list-markers-styles.js +6 -3
- package/dist/es2015/plugins/placeholder.js +5 -2
- package/dist/es2015/plugins/resize-utils.js +11 -9
- package/dist/es2015/plugins/spaces-fix.js +4 -1
- package/dist/es2015/plugins/table-resize/column-resize.js +24 -21
- package/dist/es2015/plugins/table-resize/index.js +9 -6
- package/dist/es2015/plugins/table-resize/row-resize.js +23 -20
- package/dist/es2015/plugins/table-resize/table-resize.js +20 -17
- package/dist/es2015/plugins/table-resize/table-view.js +9 -6
- package/dist/es2015/plugins/table-resize/utils.js +13 -10
- package/dist/es2015/source.js +24 -13
- package/dist/es2015/table.js +18 -15
- package/dist/es2015/text.js +3 -1
- package/dist/es2015/utils.js +22 -25
- package/dist/npm/DOMSerializer.js +73 -78
- package/dist/npm/align.d.ts +7 -4
- package/dist/npm/align.js +22 -21
- package/dist/npm/blockNode.d.ts +14 -15
- package/dist/npm/blockNode.js +91 -95
- package/dist/npm/blockquote.d.ts +5 -2
- package/dist/npm/blockquote.js +16 -15
- package/dist/npm/cleanFormatting.d.ts +6 -3
- package/dist/npm/cleanFormatting.js +17 -19
- package/dist/npm/config/align-rules.d.ts +8 -6
- package/dist/npm/config/align-rules.js +14 -9
- package/dist/npm/config/commands.d.ts +11 -19
- package/dist/npm/config/commands.js +17 -16
- package/dist/npm/config/constants.js +17 -10
- package/dist/npm/config/indent-rules.d.ts +6 -4
- package/dist/npm/config/indent-rules.js +11 -9
- package/dist/npm/config/keymap.d.ts +5 -2
- package/dist/npm/config/keymap.js +30 -30
- package/dist/npm/config/list-settings.js +13 -11
- package/dist/npm/config/schema.d.ts +4 -3
- package/dist/npm/config/schema.js +191 -134
- package/dist/npm/find-replace.d.ts +10 -7
- package/dist/npm/find-replace.js +47 -47
- package/dist/npm/image.d.ts +6 -3
- package/dist/npm/image.js +11 -10
- package/dist/npm/indent.d.ts +12 -9
- package/dist/npm/indent.js +68 -67
- package/dist/npm/inline-style.d.ts +7 -4
- package/dist/npm/inline-style.js +83 -83
- package/dist/npm/link.d.ts +4 -2
- package/dist/npm/link.js +58 -61
- package/dist/npm/listConvert.d.ts +3 -1
- package/dist/npm/listConvert.js +40 -39
- package/dist/npm/lists.d.ts +9 -9
- package/dist/npm/lists.js +94 -95
- package/dist/npm/main.d.ts +34 -33
- package/dist/npm/main.js +389 -198
- package/dist/npm/mark.d.ts +13 -18
- package/dist/npm/mark.js +104 -111
- package/dist/npm/paste.d.ts +12 -9
- package/dist/npm/paste.js +61 -61
- package/dist/npm/plugins/caret-color.d.ts +6 -3
- package/dist/npm/plugins/caret-color.js +21 -19
- package/dist/npm/plugins/csp-fix.d.ts +4 -1
- package/dist/npm/plugins/csp-fix.js +28 -30
- package/dist/npm/plugins/highlight.d.ts +7 -4
- package/dist/npm/plugins/highlight.js +17 -16
- package/dist/npm/plugins/image-resize.d.ts +7 -5
- package/dist/npm/plugins/image-resize.js +96 -97
- package/dist/npm/plugins/list-markers-styles.d.ts +5 -2
- package/dist/npm/plugins/list-markers-styles.js +49 -47
- package/dist/npm/plugins/placeholder.d.ts +4 -1
- package/dist/npm/plugins/placeholder.js +18 -17
- package/dist/npm/plugins/resize-utils.js +14 -12
- package/dist/npm/plugins/spaces-fix.d.ts +4 -1
- package/dist/npm/plugins/spaces-fix.js +19 -18
- package/dist/npm/plugins/table-resize/column-resize.js +117 -117
- package/dist/npm/plugins/table-resize/index.d.ts +5 -2
- package/dist/npm/plugins/table-resize/index.js +16 -15
- package/dist/npm/plugins/table-resize/row-resize.js +98 -101
- package/dist/npm/plugins/table-resize/table-resize.js +144 -139
- package/dist/npm/plugins/table-resize/table-view.js +59 -61
- package/dist/npm/plugins/table-resize/utils.d.ts +7 -17
- package/dist/npm/plugins/table-resize/utils.js +51 -52
- package/dist/npm/source.d.ts +18 -11
- package/dist/npm/source.js +94 -91
- package/dist/npm/table.d.ts +10 -9
- package/dist/npm/table.js +93 -82
- package/dist/npm/text.d.ts +6 -3
- package/dist/npm/text.js +5 -5
- package/dist/npm/types/active-marks.d.ts +4 -1
- package/dist/npm/types/command.d.ts +5 -2
- package/dist/npm/types/dispatchFn.d.ts +4 -1
- package/dist/npm/types/paste-cleanup-settings.d.ts +3 -1
- package/dist/npm/utils.d.ts +14 -29
- package/dist/npm/utils.js +133 -145
- package/package.json +35 -53
- package/dist/cdn/js/kendo-editor-common.js +0 -1
- package/dist/es/types/active-marks.js +0 -1
- package/dist/es/types/command.js +0 -1
- package/dist/es/types/dispatchFn.js +0 -1
- package/dist/es/types/paste-cleanup-settings.js +0 -1
- package/dist/es/types/predicate.js +0 -1
- package/dist/es2015/types/active-marks.js +0 -1
- package/dist/es2015/types/command.js +0 -1
- package/dist/es2015/types/dispatchFn.js +0 -1
- package/dist/es2015/types/paste-cleanup-settings.js +0 -1
- package/dist/es2015/types/predicate.js +0 -1
- package/dist/npm/DOMSerializer.d.ts +0 -35
- package/dist/npm/config/constants.d.ts +0 -7
- package/dist/npm/config/list-settings.d.ts +0 -30
- package/dist/npm/plugins/resize-utils.d.ts +0 -35
- package/dist/npm/plugins/table-resize/column-resize.d.ts +0 -2
- package/dist/npm/plugins/table-resize/row-resize.d.ts +0 -2
- package/dist/npm/plugins/table-resize/table-resize.d.ts +0 -18
- package/dist/npm/plugins/table-resize/table-view.d.ts +0 -28
- package/dist/npm/types/active-marks.js +0 -2
- package/dist/npm/types/command.js +0 -2
- package/dist/npm/types/dispatchFn.js +0 -2
- package/dist/npm/types/paste-cleanup-settings.js +0 -2
- package/dist/npm/types/predicate.d.ts +0 -1
- package/dist/npm/types/predicate.js +0 -2
- package/dist/systemjs/kendo-editor-common.js +0 -1
package/dist/npm/table.js
CHANGED
|
@@ -1,147 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "pmAddRowBefore", { enumerable: true, get: function () { return prosemirror_tables_1.addRowBefore; } });
|
|
8
|
-
Object.defineProperty(exports, "pmAddColumnBefore", { enumerable: true, get: function () { return prosemirror_tables_1.addColumnBefore; } });
|
|
9
|
-
Object.defineProperty(exports, "pmAddColumnAfter", { enumerable: true, get: function () { return prosemirror_tables_1.addColumnAfter; } });
|
|
10
|
-
Object.defineProperty(exports, "pmDeleteColumn", { enumerable: true, get: function () { return prosemirror_tables_1.deleteColumn; } });
|
|
11
|
-
var constants_1 = require("./config/constants");
|
|
12
|
-
var schema_1 = require("./config/schema");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var prosemirrorTables = require('prosemirror-tables');
|
|
4
|
+
var constants = require('./config/constants.js');
|
|
5
|
+
var schema = require('./config/schema.js');
|
|
6
|
+
|
|
13
7
|
/**
|
|
14
8
|
* Creates a table.
|
|
15
9
|
*
|
|
16
10
|
* @returns Node
|
|
17
11
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (
|
|
12
|
+
const createTable = (nodes, rows, columns) => {
|
|
13
|
+
const { table, table_row, table_cell } = nodes;
|
|
14
|
+
const tableRows = [];
|
|
15
|
+
let cells;
|
|
16
|
+
for (let r = 0; r < rows + 1; r++) {
|
|
23
17
|
cells = [];
|
|
24
|
-
for (
|
|
18
|
+
for (let c = 0; c < columns + 1; c++) {
|
|
25
19
|
cells.push(table_cell.createAndFill());
|
|
26
20
|
}
|
|
27
21
|
tableRows.push(table_row.createAndFill(undefined, cells));
|
|
28
22
|
}
|
|
29
23
|
return table.createAndFill(undefined, tableRows);
|
|
30
24
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var node = pos.node(i);
|
|
25
|
+
const reTable = /^table$/;
|
|
26
|
+
const reRow = /^table_row$/;
|
|
27
|
+
const reCell = /^table_cell|table_header$/;
|
|
28
|
+
const closest = (selection, name) => {
|
|
29
|
+
const pos = selection.$head;
|
|
30
|
+
for (let i = pos.depth; i > 0; i--) {
|
|
31
|
+
const node = pos.node(i);
|
|
39
32
|
if (name.test(node.type.name)) {
|
|
40
33
|
return {
|
|
41
34
|
pos: pos.before(i),
|
|
42
|
-
node
|
|
35
|
+
node
|
|
43
36
|
};
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
39
|
return null;
|
|
47
40
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
for (var i = 0; i < table.node.nodeSize; i++) {
|
|
41
|
+
const addRowBefore = (state, dispatch) => {
|
|
42
|
+
const cmdDispatch = dispatch && (tr => {
|
|
43
|
+
const row = closest(tr.selection, reRow);
|
|
44
|
+
const table = closest(tr.selection, reTable);
|
|
45
|
+
if (row && table && row.node.attrs[constants.rowTypeAttr]) {
|
|
46
|
+
let index = 0;
|
|
47
|
+
for (let i = 0; i < table.node.nodeSize; i++) {
|
|
56
48
|
if (table.node.child(i).eq(row.node)) {
|
|
57
49
|
index = i;
|
|
58
50
|
break;
|
|
59
51
|
}
|
|
60
52
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
tr.setNodeMarkup(from, undefined,
|
|
53
|
+
const next = table.node.child(index - 1);
|
|
54
|
+
const from = row.pos - next.nodeSize;
|
|
55
|
+
tr.setNodeMarkup(from, undefined, { [constants.rowTypeAttr]: row.node.attrs[constants.rowTypeAttr] });
|
|
64
56
|
}
|
|
65
57
|
return dispatch(tr);
|
|
66
58
|
});
|
|
67
|
-
return
|
|
59
|
+
return prosemirrorTables.addRowBefore(state, cmdDispatch);
|
|
68
60
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var from = row.pos + row.node.nodeSize;
|
|
76
|
-
tr.setNodeMarkup(from, undefined, (_a = {}, _a[constants_1.rowTypeAttr] = row.node.attrs[constants_1.rowTypeAttr], _a));
|
|
61
|
+
const addRowAfter = (state, dispatch) => {
|
|
62
|
+
const cmdDispatch = dispatch && (tr => {
|
|
63
|
+
const row = closest(tr.selection, reRow);
|
|
64
|
+
if (row && row.node.attrs[constants.rowTypeAttr]) {
|
|
65
|
+
const from = row.pos + row.node.nodeSize;
|
|
66
|
+
tr.setNodeMarkup(from, undefined, { [constants.rowTypeAttr]: row.node.attrs[constants.rowTypeAttr] });
|
|
77
67
|
}
|
|
78
68
|
return dispatch(tr);
|
|
79
69
|
});
|
|
80
|
-
return
|
|
70
|
+
return prosemirrorTables.addRowAfter(state, cmdDispatch);
|
|
81
71
|
};
|
|
82
|
-
|
|
83
|
-
var columnIndex = function (table, selection) {
|
|
72
|
+
const columnIndex = (table, selection) => {
|
|
84
73
|
if (!table) {
|
|
85
74
|
return -1;
|
|
86
75
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
const map = prosemirrorTables.TableMap.get(table.node);
|
|
77
|
+
const tableCell = closest(selection, reCell);
|
|
78
|
+
const idx = map.map.indexOf(tableCell.pos - table.pos - 1);
|
|
79
|
+
let colIndex = -1;
|
|
91
80
|
if (idx !== -1) {
|
|
92
81
|
colIndex = idx % map.width;
|
|
93
82
|
}
|
|
94
83
|
return colIndex;
|
|
95
84
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var colgroup = (0, schema_1.parseStrColgroup)(table.node.attrs[constants_1.colgroupAttr]);
|
|
85
|
+
const addCol = (tr, table, to) => {
|
|
86
|
+
const colIndex = columnIndex(table, tr.selection);
|
|
87
|
+
const colgroup = schema.parseStrColgroup(table.node.attrs[constants.colgroupAttr]);
|
|
100
88
|
colgroup.insertBefore(colgroup.ownerDocument.createElement('col'), colgroup.children[colIndex + to]);
|
|
101
|
-
tr.setNodeMarkup(table.pos, null,
|
|
89
|
+
tr.setNodeMarkup(table.pos, null, { ...table.node.attrs, [constants.colgroupAttr]: colgroup.outerHTML });
|
|
102
90
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var colgroup = (0, schema_1.parseStrColgroup)(table.node.attrs[constants_1.colgroupAttr]);
|
|
91
|
+
const deleteCol = (tr, table, colIndex) => {
|
|
92
|
+
const colgroup = schema.parseStrColgroup(table.node.attrs[constants.colgroupAttr]);
|
|
106
93
|
colgroup.removeChild(colgroup.children[colIndex]);
|
|
107
|
-
tr.setNodeMarkup(table.pos, null,
|
|
94
|
+
tr.setNodeMarkup(table.pos, null, { ...table.node.attrs, [constants.colgroupAttr]: colgroup.outerHTML });
|
|
108
95
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (!table.node.attrs[
|
|
96
|
+
const addColumnBefore = (state, dispatch) => {
|
|
97
|
+
const cmdDispatch = dispatch && (tr => {
|
|
98
|
+
const table = closest(tr.selection, reTable);
|
|
99
|
+
if (!table.node.attrs[constants.colgroupAttr]) {
|
|
113
100
|
return dispatch(tr);
|
|
114
101
|
}
|
|
115
102
|
addCol(tr, table, -1);
|
|
116
103
|
return dispatch(tr);
|
|
117
104
|
});
|
|
118
|
-
return
|
|
105
|
+
return prosemirrorTables.addColumnBefore(state, cmdDispatch);
|
|
119
106
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!table.node.attrs[constants_1.colgroupAttr]) {
|
|
107
|
+
const addColumnAfter = (state, dispatch) => {
|
|
108
|
+
const cmdDispatch = dispatch && (tr => {
|
|
109
|
+
const table = closest(tr.selection, reTable);
|
|
110
|
+
if (!table.node.attrs[constants.colgroupAttr]) {
|
|
125
111
|
return dispatch(tr);
|
|
126
112
|
}
|
|
127
113
|
addCol(tr, table, 1);
|
|
128
114
|
return dispatch(tr);
|
|
129
115
|
});
|
|
130
|
-
return
|
|
116
|
+
return prosemirrorTables.addColumnAfter(state, cmdDispatch);
|
|
131
117
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var cmdDispatch = dispatch && (function (tr) {
|
|
118
|
+
const deleteColumn = (state, dispatch) => {
|
|
119
|
+
const parentTable = closest(state.selection, reTable);
|
|
120
|
+
const colgroup = parentTable && parentTable.node.attrs[constants.colgroupAttr];
|
|
121
|
+
const colIndex = columnIndex(parentTable, state.selection);
|
|
122
|
+
const cmdDispatch = dispatch && ((tr) => {
|
|
138
123
|
if (!colgroup) {
|
|
139
124
|
return dispatch(tr);
|
|
140
125
|
}
|
|
141
|
-
|
|
126
|
+
const table = tr.doc.nodeAt(parentTable.pos);
|
|
142
127
|
deleteCol(tr, { node: table, pos: parentTable.pos }, colIndex);
|
|
143
128
|
return dispatch(tr);
|
|
144
129
|
});
|
|
145
|
-
return
|
|
130
|
+
return prosemirrorTables.deleteColumn(state, cmdDispatch);
|
|
146
131
|
};
|
|
132
|
+
|
|
133
|
+
Object.defineProperty(exports, "pmAddColumnAfter", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function () { return prosemirrorTables.addColumnAfter; }
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "pmAddColumnBefore", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () { return prosemirrorTables.addColumnBefore; }
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(exports, "pmAddRowAfter", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () { return prosemirrorTables.addRowAfter; }
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(exports, "pmAddRowBefore", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function () { return prosemirrorTables.addRowBefore; }
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(exports, "pmDeleteColumn", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () { return prosemirrorTables.deleteColumn; }
|
|
152
|
+
});
|
|
153
|
+
exports.addColumnAfter = addColumnAfter;
|
|
154
|
+
exports.addColumnBefore = addColumnBefore;
|
|
155
|
+
exports.addRowAfter = addRowAfter;
|
|
156
|
+
exports.addRowBefore = addRowBefore;
|
|
157
|
+
exports.createTable = createTable;
|
|
147
158
|
exports.deleteColumn = deleteColumn;
|
package/dist/npm/text.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { Command } from './types/command';
|
|
2
|
-
|
|
1
|
+
import { Command } from './types/command.js';
|
|
2
|
+
|
|
3
|
+
interface TextData {
|
|
3
4
|
text: string;
|
|
4
5
|
from?: number;
|
|
5
6
|
to?: number;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
declare const insertText: (attrs: TextData) => Command;
|
|
9
|
+
|
|
10
|
+
export { type TextData, insertText };
|
package/dist/npm/text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var insertText = function (attrs) { return function (state, dispatch) {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const insertText = (attrs) => (state, dispatch) => {
|
|
5
4
|
dispatch(state.tr.insertText(attrs.text, attrs.from, attrs.to));
|
|
6
|
-
};
|
|
5
|
+
};
|
|
6
|
+
|
|
7
7
|
exports.insertText = insertText;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
|
-
import { DispatchFn } from './dispatchFn';
|
|
4
|
-
|
|
3
|
+
import { DispatchFn } from './dispatchFn.js';
|
|
4
|
+
|
|
5
|
+
type Command = (state: EditorState, dispatch: DispatchFn, view?: EditorView) => boolean | void;
|
|
6
|
+
|
|
7
|
+
export type { Command };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The settings passed to the `pasteCleanup` function.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
interface PasteCleanupSettings {
|
|
5
5
|
/**
|
|
6
6
|
* If set to `true`, converts the MS Word lists into HTML lists.
|
|
7
7
|
*/
|
|
@@ -18,3 +18,5 @@ export interface PasteCleanupSettings {
|
|
|
18
18
|
[attributeName: string]: (attr: Attr) => void;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
export type { PasteCleanupSettings };
|
package/dist/npm/utils.d.ts
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeType, ResolvedPos, Node } from 'prosemirror-model';
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
|
-
import { Command } from './types/command';
|
|
4
|
-
|
|
5
|
-
style: string;
|
|
6
|
-
value: RegExp;
|
|
7
|
-
newValue?: string;
|
|
8
|
-
}) => {
|
|
9
|
-
changed: boolean;
|
|
10
|
-
style: string | null;
|
|
11
|
-
};
|
|
12
|
-
export declare function setNodeStyle(nodeAttrs: any, styleType: string, value: string): any;
|
|
3
|
+
import { Command } from './types/command.js';
|
|
4
|
+
|
|
13
5
|
/**
|
|
14
6
|
* Determines if a given node type can be inserted at the current cursor position.
|
|
15
7
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare function parentNode(pos: ResolvedPos, predicate: (node: Node) => boolean): {
|
|
8
|
+
declare const canInsert: (state: EditorState, nodeType: NodeType) => boolean;
|
|
9
|
+
declare function parentNode(pos: ResolvedPos, predicate: (node: Node) => boolean): {
|
|
19
10
|
node: Node;
|
|
20
11
|
depth: number;
|
|
21
12
|
} | null;
|
|
22
13
|
/**
|
|
23
14
|
* Inserts the given node at the place of current selection.
|
|
24
15
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare const getNodeFromSelection: (state: EditorState) => Node;
|
|
16
|
+
declare const insertNode: (node: Node, scrollIntoView?: boolean) => Command;
|
|
17
|
+
declare const getSelectionText: (state: EditorState) => string;
|
|
18
|
+
declare const getNodeFromSelection: (state: EditorState) => Node;
|
|
29
19
|
/**
|
|
30
20
|
* Returns the text from the selection if only text is selected on a single line.
|
|
31
21
|
* If selection contains leaf nodes (br, image) between text elements or
|
|
@@ -34,17 +24,16 @@ export declare const getNodeFromSelection: (state: EditorState) => Node;
|
|
|
34
24
|
* Useful for values of the inputs of Link and Find&Replace dialogs where the inputs value has been retrieved from the selection and
|
|
35
25
|
* should be single line text only.
|
|
36
26
|
*/
|
|
37
|
-
|
|
27
|
+
declare const selectedLineTextOnly: (state: EditorState) => string;
|
|
38
28
|
/**
|
|
39
29
|
* Used by ViewHtml/ViewSource dialogs for making the HTML more readable.
|
|
40
30
|
*/
|
|
41
|
-
|
|
42
|
-
export declare const shallowEqual: (object1: any, object2: any) => boolean;
|
|
31
|
+
declare const indentHtml: (content: string) => string;
|
|
43
32
|
/**
|
|
44
33
|
* if options.applyToWord is set, expands the selection to the word where the cursor is and
|
|
45
34
|
* returns modified state and dispatch.
|
|
46
35
|
*/
|
|
47
|
-
|
|
36
|
+
declare const expandSelection: (state: any, dispatch: any, options: any) => {
|
|
48
37
|
state: any;
|
|
49
38
|
dispatch: any;
|
|
50
39
|
};
|
|
@@ -60,10 +49,6 @@ export declare const expandSelection: (state: any, dispatch: any, options: any)
|
|
|
60
49
|
* const command = expandToWordWrap(toggleInlineFormat, {...bold, applyToWord );
|
|
61
50
|
* command(view.state, view.dispatch);
|
|
62
51
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
export declare const applyStyle: (styleText: string | null, styleType: string, styleValue: string) => string;
|
|
68
|
-
export declare const setStyleAttr: (element: HTMLElement, styleString: string) => void;
|
|
69
|
-
export declare const setAttribute: (node: HTMLElement, attrName: string, value?: string) => void;
|
|
52
|
+
declare const expandToWordWrap: (command: any, options: any) => (state: any, dispatch: any) => any;
|
|
53
|
+
|
|
54
|
+
export { canInsert, expandSelection, expandToWordWrap, getNodeFromSelection, getSelectionText, indentHtml, insertNode, parentNode, selectedLineTextOnly };
|