@progress/kendo-editor-common 1.11.9-dev.202412020819 → 1.11.9-develop.1
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 +388 -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 +13 -32
- package/dist/npm/utils.js +133 -145
- package/package.json +34 -52
- 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/blockNode.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
var prosemirror_state_1 = require("prosemirror-state");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('./utils.js');
|
|
4
|
+
var prosemirrorTransform = require('prosemirror-transform');
|
|
5
|
+
var prosemirrorModel = require('prosemirror-model');
|
|
6
|
+
var prosemirrorState = require('prosemirror-state');
|
|
7
|
+
|
|
9
8
|
/**
|
|
10
9
|
* @hidden
|
|
11
10
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const canChangeType = (stateDoc, pos, type) => {
|
|
12
|
+
const $pos = stateDoc.resolve(pos), index = $pos.index();
|
|
14
13
|
return $pos.parent.canReplaceWith(index, index + 1, type);
|
|
15
14
|
};
|
|
16
15
|
/**
|
|
@@ -19,49 +18,47 @@ var canChangeType = function (stateDoc, pos, type) {
|
|
|
19
18
|
* @example
|
|
20
19
|
* See `cleanTextBlockFormatting` or `formatBlockElements` function.
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
const changeTextBlock = (tr, node, nodeType, attrs) => {
|
|
23
22
|
if (!nodeType.isTextblock) {
|
|
24
23
|
return false;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
ranges.forEach(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
tr.doc.nodesBetween(from, to,
|
|
25
|
+
const { ranges } = tr.selection;
|
|
26
|
+
ranges.forEach(range => {
|
|
27
|
+
const mapFrom = tr.steps.length;
|
|
28
|
+
const from = range.$from.pos;
|
|
29
|
+
const to = range.$to.pos;
|
|
30
|
+
tr.doc.nodesBetween(from, to, (currNode, pos) => {
|
|
32
31
|
if (currNode.eq(node) &&
|
|
33
32
|
currNode.isTextblock &&
|
|
34
33
|
!currNode.hasMarkup(nodeType, attrs) &&
|
|
35
34
|
canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), nodeType)) {
|
|
36
35
|
// Ensure all markup that isn't allowed in the new node type is cleared
|
|
37
36
|
tr.clearIncompatible(tr.mapping.slice(mapFrom).map(pos, 1), nodeType);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
tr.step(new
|
|
37
|
+
const mapping = tr.mapping.slice(mapFrom);
|
|
38
|
+
const startM = mapping.map(pos, 1), endM = mapping.map(pos + currNode.nodeSize, 1);
|
|
39
|
+
const slice = new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(nodeType.create(attrs, null, currNode.marks)), 0, 0);
|
|
40
|
+
tr.step(new prosemirrorTransform.ReplaceAroundStep(startM, endM, startM + 1, endM - 1, slice, 1, true));
|
|
42
41
|
return false; // this will skip the node children
|
|
43
42
|
}
|
|
44
43
|
});
|
|
45
44
|
});
|
|
46
45
|
};
|
|
47
|
-
exports.changeTextBlock = changeTextBlock;
|
|
48
46
|
/**
|
|
49
47
|
* Traverses the selection and returns the block nodes in it.
|
|
50
48
|
*
|
|
51
49
|
* @example
|
|
52
50
|
* See `cleanTextBlockFormatting` function.
|
|
53
51
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var selNode = selection instanceof prosemirror_state_1.NodeSelection ? selection.node : undefined;
|
|
52
|
+
const blockNodes = (state, options = { blocksInSelection: false }) => {
|
|
53
|
+
const { doc, selection } = state;
|
|
54
|
+
const { $from, ranges } = selection;
|
|
55
|
+
const { blocksInSelection } = options;
|
|
56
|
+
const result = [];
|
|
57
|
+
const selNode = selection instanceof prosemirrorState.NodeSelection ? selection.node : undefined;
|
|
61
58
|
if (selNode) {
|
|
62
59
|
if (selNode.isBlock) {
|
|
63
60
|
result.push(selNode);
|
|
64
|
-
selNode.nodesBetween(0, selNode.content.size,
|
|
61
|
+
selNode.nodesBetween(0, selNode.content.size, node => {
|
|
65
62
|
if (node.isBlock) {
|
|
66
63
|
result.push(node);
|
|
67
64
|
}
|
|
@@ -72,10 +69,10 @@ var blockNodes = function (state, options) {
|
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
else {
|
|
75
|
-
ranges.forEach(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
doc.nodesBetween(from, to,
|
|
72
|
+
ranges.forEach(range => {
|
|
73
|
+
const from = range.$from.pos;
|
|
74
|
+
const to = range.$to.pos;
|
|
75
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
79
76
|
if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) {
|
|
80
77
|
result.push(node);
|
|
81
78
|
}
|
|
@@ -84,36 +81,32 @@ var blockNodes = function (state, options) {
|
|
|
84
81
|
}
|
|
85
82
|
return result;
|
|
86
83
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
else if (value === 'blockquote') {
|
|
105
|
-
(0, exports.changeTextBlock)(tr, node, nodes.blockquote, node.attrs);
|
|
106
|
-
}
|
|
84
|
+
const formatBlockElements = (value, commandName) => (state, dispatch) => {
|
|
85
|
+
const blocks = blockNodes(state);
|
|
86
|
+
const nodes = state.schema.nodes;
|
|
87
|
+
const tr = state.tr;
|
|
88
|
+
tr.setMeta('commandName', commandName);
|
|
89
|
+
tr.setMeta('args', { value });
|
|
90
|
+
blocks.forEach(node => {
|
|
91
|
+
if (node.type.isTextblock) {
|
|
92
|
+
if (value === 'p') {
|
|
93
|
+
changeTextBlock(tr, node, nodes.paragraph, node.attrs);
|
|
94
|
+
}
|
|
95
|
+
else if (/^h[1-6]$/i.test(value)) {
|
|
96
|
+
const level = parseInt(value.substr(1), 10);
|
|
97
|
+
changeTextBlock(tr, node, nodes.heading, { ...node.attrs, level });
|
|
98
|
+
}
|
|
99
|
+
else if (value === 'blockquote') {
|
|
100
|
+
changeTextBlock(tr, node, nodes.blockquote, node.attrs);
|
|
107
101
|
}
|
|
108
|
-
});
|
|
109
|
-
var result = tr.docChanged;
|
|
110
|
-
if (result) {
|
|
111
|
-
dispatch(tr.scrollIntoView());
|
|
112
102
|
}
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
});
|
|
104
|
+
const result = tr.docChanged;
|
|
105
|
+
if (result) {
|
|
106
|
+
dispatch(tr.scrollIntoView());
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
115
109
|
};
|
|
116
|
-
exports.formatBlockElements = formatBlockElements;
|
|
117
110
|
/**
|
|
118
111
|
* Removes the style and class attributes of text block elements.
|
|
119
112
|
* Requires to dispatch the transaction.
|
|
@@ -121,31 +114,29 @@ exports.formatBlockElements = formatBlockElements;
|
|
|
121
114
|
* @example
|
|
122
115
|
* See `cleanFormatting` function.
|
|
123
116
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var nodeType = blockNodeType || node.type;
|
|
117
|
+
const cleanTextBlockFormatting = (tr, options = { blocksInSelection: true }) => {
|
|
118
|
+
const { doc, selection } = tr;
|
|
119
|
+
const { blocksInSelection, blockNodeType } = options;
|
|
120
|
+
const nodes = blockNodes({ doc, selection }, { blocksInSelection });
|
|
121
|
+
const textBlocks = nodes.filter(node => node.isTextblock);
|
|
122
|
+
textBlocks.forEach(node => {
|
|
123
|
+
const { style = '', class: className = '', ...attrs } = node.attrs || {};
|
|
124
|
+
const nodeType = blockNodeType || node.type;
|
|
133
125
|
if (style || className || nodeType !== node.type) {
|
|
134
|
-
|
|
126
|
+
changeTextBlock(tr, node, nodeType, attrs);
|
|
135
127
|
}
|
|
136
128
|
});
|
|
137
129
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
blocks.forEach(function (node) {
|
|
130
|
+
const getBlockFormats = (state) => {
|
|
131
|
+
const blocks = blockNodes(state);
|
|
132
|
+
const nodes = state.schema.nodes;
|
|
133
|
+
const result = [];
|
|
134
|
+
blocks.forEach((node) => {
|
|
144
135
|
if (node.type === nodes.paragraph) {
|
|
145
136
|
result.push('p');
|
|
146
137
|
}
|
|
147
138
|
else if (node.type === nodes.heading) {
|
|
148
|
-
result.push(
|
|
139
|
+
result.push(`h${node.attrs.level}`);
|
|
149
140
|
}
|
|
150
141
|
else if (node.type === nodes.blockquote && nodes.blockquote.isTextblock) {
|
|
151
142
|
// In case the blockquote can have inline content.
|
|
@@ -154,40 +145,45 @@ var getBlockFormats = function (state) {
|
|
|
154
145
|
});
|
|
155
146
|
return result;
|
|
156
147
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var currentStyles = node.attrs.style, changedStyleResult, toChange;
|
|
148
|
+
const addStyles = (node, stylesToApply) => {
|
|
149
|
+
let currentStyles = node.attrs.style, changedStyleResult, toChange;
|
|
160
150
|
if (currentStyles) {
|
|
161
|
-
stylesToApply.forEach(
|
|
151
|
+
stylesToApply.forEach(style => {
|
|
162
152
|
toChange = { style: style.name, value: /^.+$/, newValue: style.value };
|
|
163
|
-
changedStyleResult =
|
|
153
|
+
changedStyleResult = utils.changeStylesString(currentStyles, toChange);
|
|
164
154
|
currentStyles = changedStyleResult.changed ? changedStyleResult.style : currentStyles;
|
|
165
155
|
});
|
|
166
156
|
}
|
|
167
|
-
|
|
157
|
+
const reducer = (acc, curr) => ((acc && curr.value ? acc + ' ' : '') + curr.value ? `${curr.name}: ${curr.value};` : '');
|
|
168
158
|
currentStyles = currentStyles || stylesToApply.reduce(reducer, '');
|
|
169
159
|
return Object.assign({}, node.attrs, { style: currentStyles || null });
|
|
170
160
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
state.doc.nodesBetween(from, to, function (node) {
|
|
161
|
+
const hasNode = (state, nodeType) => {
|
|
162
|
+
const { from, to } = state.selection;
|
|
163
|
+
let result = false;
|
|
164
|
+
state.doc.nodesBetween(from, to, node => {
|
|
176
165
|
result = result || node.type === nodeType;
|
|
177
166
|
return !result;
|
|
178
167
|
});
|
|
179
168
|
return result;
|
|
180
169
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var formats = (0, exports.getBlockFormats)(state);
|
|
170
|
+
const parentBlockFormat = (state) => {
|
|
171
|
+
const formats = getBlockFormats(state);
|
|
184
172
|
return new Set(formats).size === 1 ? formats[0] : null;
|
|
185
173
|
};
|
|
186
|
-
exports.parentBlockFormat = parentBlockFormat;
|
|
187
174
|
/**
|
|
188
175
|
* **Deprecated.** Use `parentBlockFormat` function instead.
|
|
189
176
|
*/
|
|
190
|
-
|
|
191
|
-
return { tag:
|
|
177
|
+
const activeNode = (state) => {
|
|
178
|
+
return { tag: parentBlockFormat(state) || '' };
|
|
192
179
|
};
|
|
180
|
+
|
|
193
181
|
exports.activeNode = activeNode;
|
|
182
|
+
exports.addStyles = addStyles;
|
|
183
|
+
exports.blockNodes = blockNodes;
|
|
184
|
+
exports.changeTextBlock = changeTextBlock;
|
|
185
|
+
exports.cleanTextBlockFormatting = cleanTextBlockFormatting;
|
|
186
|
+
exports.formatBlockElements = formatBlockElements;
|
|
187
|
+
exports.getBlockFormats = getBlockFormats;
|
|
188
|
+
exports.hasNode = hasNode;
|
|
189
|
+
exports.parentBlockFormat = parentBlockFormat;
|
package/dist/npm/blockquote.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
declare const blockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
4
|
+
declare const liftBlockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
5
|
+
|
|
6
|
+
export { blockquote, liftBlockquote };
|
package/dist/npm/blockquote.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var prosemirrorCommands = require('prosemirror-commands');
|
|
4
|
+
|
|
5
|
+
const blockquote = (state, dispatch) => {
|
|
6
|
+
return prosemirrorCommands.wrapIn(state.schema.nodes.blockquote)(state, dispatch);
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var range = $from.blockRange($to);
|
|
8
|
+
const liftBlockquote = (state, dispatch) => {
|
|
9
|
+
const { $from, $to } = state.selection;
|
|
10
|
+
const nodeType = state.schema.nodes.blockquote;
|
|
11
|
+
const doc = state.doc;
|
|
12
|
+
let target = -1;
|
|
13
|
+
const range = $from.blockRange($to);
|
|
15
14
|
if (range) {
|
|
16
|
-
doc.nodesBetween(range.start, range.end,
|
|
15
|
+
doc.nodesBetween(range.start, range.end, (node, pos) => {
|
|
17
16
|
if (node.type === nodeType) {
|
|
18
17
|
target = pos;
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
const result = target !== -1;
|
|
23
22
|
if (dispatch && result) {
|
|
24
23
|
dispatch(state.tr.lift(range, doc.resolve(target).depth));
|
|
25
24
|
}
|
|
26
25
|
return result;
|
|
27
26
|
};
|
|
27
|
+
|
|
28
|
+
exports.blockquote = blockquote;
|
|
28
29
|
exports.liftBlockquote = liftBlockquote;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeType, MarkType } from 'prosemirror-model';
|
|
2
2
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
declare const cleanFormatting: (options?: CleanFormattingOptions) => (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
7
8
|
/**
|
|
8
9
|
* The cleanFormatting command options.
|
|
9
10
|
* Defaults to `{ blocksInSelection: true }`.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
interface CleanFormattingOptions {
|
|
12
13
|
/**
|
|
13
14
|
* If set to `true`, the command will skip the text-block nodes which are partially selected.
|
|
14
15
|
* This option affects the text-block nodes themselves(paragraph, heading) and does not affects marks cleaning.
|
|
@@ -25,3 +26,5 @@ export interface CleanFormattingOptions {
|
|
|
25
26
|
*/
|
|
26
27
|
exceptMarks?: Array<MarkType>;
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
export { type CleanFormattingOptions, cleanFormatting };
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var blockNode = require('./blockNode.js');
|
|
4
|
+
var mark = require('./mark.js');
|
|
5
|
+
|
|
6
6
|
/**
|
|
7
7
|
* A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
9
|
+
const cleanFormatting = (options = { blocksInSelection: true }) => (state, dispatch) => {
|
|
10
|
+
const tr = state.tr;
|
|
11
|
+
const { blocksInSelection, blockNodeType, exceptMarks } = options;
|
|
12
|
+
const except = (exceptMarks || [state.schema.marks.link]).filter(Boolean);
|
|
13
|
+
mark.cleanMarks(tr, { except });
|
|
14
|
+
blockNode.cleanTextBlockFormatting(tr, { blocksInSelection, blockNodeType });
|
|
15
|
+
const result = tr.docChanged;
|
|
16
|
+
if (result && dispatch) {
|
|
17
|
+
dispatch(tr);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
23
20
|
};
|
|
21
|
+
|
|
24
22
|
exports.cleanFormatting = cleanFormatting;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
interface AlignRule {
|
|
2
2
|
node: string;
|
|
3
3
|
style: Array<{
|
|
4
4
|
name: string;
|
|
5
5
|
value: string;
|
|
6
6
|
}>;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
declare const alignLeftRules: Array<AlignRule>;
|
|
9
|
+
declare const alignRightRules: Array<AlignRule>;
|
|
10
|
+
declare const alignCenterRules: Array<AlignRule>;
|
|
11
|
+
declare const alignJustifyRules: Array<AlignRule>;
|
|
12
|
+
declare const alignRemoveRules: Array<AlignRule>;
|
|
13
|
+
|
|
14
|
+
export { type AlignRule, alignCenterRules, alignJustifyRules, alignLeftRules, alignRemoveRules, alignRightRules };
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var style = function (name, value) {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const style = (name, value) => {
|
|
5
4
|
return { name: name, value: value };
|
|
6
5
|
};
|
|
7
|
-
|
|
6
|
+
const alignLeftRules = [
|
|
8
7
|
{ node: 'paragraph', style: [style('text-align', 'left')] },
|
|
9
8
|
{ node: 'heading', style: [style('text-align', 'left')] },
|
|
10
9
|
{ node: 'table_caption_external', style: [style('text-align', 'left')] }
|
|
11
10
|
];
|
|
12
|
-
|
|
11
|
+
const alignRightRules = [
|
|
13
12
|
{ node: 'paragraph', style: [style('text-align', 'right')] },
|
|
14
13
|
{ node: 'heading', style: [style('text-align', 'right')] },
|
|
15
14
|
{ node: 'table_caption_external', style: [style('text-align', 'right')] }
|
|
16
15
|
];
|
|
17
|
-
|
|
16
|
+
const alignCenterRules = [
|
|
18
17
|
{ node: 'paragraph', style: [style('text-align', 'center')] },
|
|
19
18
|
{ node: 'heading', style: [style('text-align', 'center')] },
|
|
20
19
|
{ node: 'table_caption_external', style: [style('text-align', 'center')] }
|
|
21
20
|
];
|
|
22
|
-
|
|
21
|
+
const alignJustifyRules = [
|
|
23
22
|
{ node: 'paragraph', style: [style('text-align', 'justify')] },
|
|
24
23
|
{ node: 'heading', style: [style('text-align', 'justify')] },
|
|
25
24
|
{ node: 'table_caption_external', style: [style('text-align', 'justify')] }
|
|
26
25
|
];
|
|
27
|
-
|
|
26
|
+
const alignRemoveRules = [
|
|
28
27
|
{ node: 'paragraph', style: [style('text-align', '')] },
|
|
29
28
|
{ node: 'heading', style: [style('text-align', '')] },
|
|
30
29
|
{ node: 'table_caption_external', style: [style('text-align', '')] }
|
|
31
30
|
];
|
|
31
|
+
|
|
32
|
+
exports.alignCenterRules = alignCenterRules;
|
|
33
|
+
exports.alignJustifyRules = alignJustifyRules;
|
|
34
|
+
exports.alignLeftRules = alignLeftRules;
|
|
35
|
+
exports.alignRemoveRules = alignRemoveRules;
|
|
36
|
+
exports.alignRightRules = alignRightRules;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The inline-formatting options.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
interface InlineFormatOptions {
|
|
5
5
|
/**
|
|
6
6
|
* The mark which will be applied or stripped.
|
|
7
7
|
*/
|
|
@@ -27,44 +27,36 @@ export interface InlineFormatOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* The object of the Bold command.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
declare const bold: InlineFormatOptions;
|
|
31
31
|
/**
|
|
32
32
|
* The object of the Italic command.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
declare const italic: InlineFormatOptions;
|
|
35
35
|
/**
|
|
36
36
|
* The object of the Underline command.
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
declare const underline: InlineFormatOptions;
|
|
39
39
|
/**
|
|
40
40
|
* The object of the Strikethrough command.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
declare const strikethrough: InlineFormatOptions;
|
|
43
43
|
/**
|
|
44
44
|
* The object of the Subscript command.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
declare const subscript: InlineFormatOptions;
|
|
47
47
|
/**
|
|
48
48
|
* The object of the Superscript command.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
declare const superscript: InlineFormatOptions;
|
|
51
51
|
/**
|
|
52
52
|
* The settings of the Link tool or dialog.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
interface LinkOptions {
|
|
55
55
|
mark: string;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* The object of the Link tool settings.
|
|
59
59
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
export interface UnlinkOptions {
|
|
65
|
-
mark: string;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* The object of the Unlink tool settings.
|
|
69
|
-
*/
|
|
70
|
-
export declare const unlink: UnlinkOptions;
|
|
60
|
+
declare const link: LinkOptions;
|
|
61
|
+
|
|
62
|
+
export { type InlineFormatOptions, type LinkOptions, bold, italic, link, strikethrough, subscript, superscript, underline };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.unlink = exports.link = exports.superscript = exports.subscript = exports.strikethrough = exports.underline = exports.italic = exports.bold = void 0;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
4
3
|
/**
|
|
5
4
|
* The object of the Bold command.
|
|
6
5
|
*/
|
|
7
|
-
|
|
6
|
+
const bold = {
|
|
8
7
|
mark: 'strong',
|
|
9
8
|
altMarks: ['b'],
|
|
10
9
|
altStyle: { name: 'font-weight', value: /^(bold(er)?|[5-9]\d{2,})$/ }
|
|
@@ -12,7 +11,7 @@ exports.bold = {
|
|
|
12
11
|
/**
|
|
13
12
|
* The object of the Italic command.
|
|
14
13
|
*/
|
|
15
|
-
|
|
14
|
+
const italic = {
|
|
16
15
|
mark: 'em',
|
|
17
16
|
altMarks: ['i'],
|
|
18
17
|
altStyle: { name: 'font-style', value: /^italic$/i }
|
|
@@ -20,38 +19,40 @@ exports.italic = {
|
|
|
20
19
|
/**
|
|
21
20
|
* The object of the Underline command.
|
|
22
21
|
*/
|
|
23
|
-
|
|
22
|
+
const underline = {
|
|
24
23
|
mark: 'u',
|
|
25
24
|
altStyle: { name: 'text-decoration', value: /^underline$/i }
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
27
|
* The object of the Strikethrough command.
|
|
29
28
|
*/
|
|
30
|
-
|
|
29
|
+
const strikethrough = {
|
|
31
30
|
mark: 'del',
|
|
32
31
|
altStyle: { name: 'text-decoration', value: /^line-through$/i }
|
|
33
32
|
};
|
|
34
33
|
/**
|
|
35
34
|
* The object of the Subscript command.
|
|
36
35
|
*/
|
|
37
|
-
|
|
36
|
+
const subscript = {
|
|
38
37
|
mark: 'sub'
|
|
39
38
|
};
|
|
40
39
|
/**
|
|
41
40
|
* The object of the Superscript command.
|
|
42
41
|
*/
|
|
43
|
-
|
|
42
|
+
const superscript = {
|
|
44
43
|
mark: 'sup'
|
|
45
44
|
};
|
|
46
45
|
/**
|
|
47
46
|
* The object of the Link tool settings.
|
|
48
47
|
*/
|
|
49
|
-
|
|
50
|
-
mark: 'link'
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* The object of the Unlink tool settings.
|
|
54
|
-
*/
|
|
55
|
-
exports.unlink = {
|
|
48
|
+
const link = {
|
|
56
49
|
mark: 'link'
|
|
57
50
|
};
|
|
51
|
+
|
|
52
|
+
exports.bold = bold;
|
|
53
|
+
exports.italic = italic;
|
|
54
|
+
exports.link = link;
|
|
55
|
+
exports.strikethrough = strikethrough;
|
|
56
|
+
exports.subscript = subscript;
|
|
57
|
+
exports.superscript = superscript;
|
|
58
|
+
exports.underline = underline;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const rowTypeAttr = 'k-parent-node';
|
|
4
|
+
const colgroupAttr = 'k-colgroup-data';
|
|
5
|
+
const resizableAttr = 'k-resizable-node';
|
|
6
|
+
const resizableWrap = 'k-editor-resize-wrap-element';
|
|
7
|
+
const resizeHandle = 'k-editor-resize-handle';
|
|
8
|
+
const dataResizeDirTable = 'data-dir-table-resize';
|
|
9
|
+
const dataResizeDirImage = 'data-dir-image-resize';
|
|
10
|
+
|
|
11
|
+
exports.colgroupAttr = colgroupAttr;
|
|
12
|
+
exports.dataResizeDirImage = dataResizeDirImage;
|
|
13
|
+
exports.dataResizeDirTable = dataResizeDirTable;
|
|
14
|
+
exports.resizableAttr = resizableAttr;
|
|
15
|
+
exports.resizableWrap = resizableWrap;
|
|
16
|
+
exports.resizeHandle = resizeHandle;
|
|
17
|
+
exports.rowTypeAttr = rowTypeAttr;
|