@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,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.marks = exports.nodes = exports.parseStrColgroup = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var prosemirror_model_1 = require("prosemirror-model");
|
|
5
|
-
var
|
|
6
|
+
var prosemirror_tables_ts_1 = require("prosemirror-tables-ts");
|
|
6
7
|
var source_1 = require("../source");
|
|
7
8
|
var constants_1 = require("./constants");
|
|
8
9
|
var hole = 0;
|
|
@@ -57,16 +58,16 @@ var tagMark = function (tag) {
|
|
|
57
58
|
},
|
|
58
59
|
_a;
|
|
59
60
|
};
|
|
60
|
-
var marks = tslib_1.__assign({
|
|
61
|
+
var marks = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({
|
|
61
62
|
// :: MarkSpec A link. Has `href` and `title` attributes. `title`
|
|
62
63
|
// defaults to the empty string. Rendered and parsed as an `<a>`
|
|
63
64
|
// element.
|
|
64
65
|
link: {
|
|
65
|
-
attrs: tslib_1.__assign({}, commonAttributes(), { href: { default: null }, target: { default: null }, title: { default: null } }),
|
|
66
|
+
attrs: tslib_1.__assign(tslib_1.__assign({}, commonAttributes()), { href: { default: null }, target: { default: null }, title: { default: null } }),
|
|
66
67
|
inclusive: false,
|
|
67
68
|
parseDOM: [{ tag: 'a', getAttrs: domAttributes }],
|
|
68
69
|
toDOM: function (node) { return ['a', pmAttributes(node.attrs), hole]; }
|
|
69
|
-
} }, tagMark('strong'), tagMark('b'), tagMark('em'), tagMark('i'), tagMark('u'), tagMark('del'), tagMark('sub'), tagMark('sup'), tagMark('code'), { style: {
|
|
70
|
+
} }, tagMark('strong')), tagMark('b')), tagMark('em')), tagMark('i')), tagMark('u')), tagMark('del')), tagMark('sub')), tagMark('sup')), tagMark('code')), { style: {
|
|
70
71
|
attrs: tslib_1.__assign({}, commonAttributes()),
|
|
71
72
|
parseDOM: [{
|
|
72
73
|
tag: 'span',
|
|
@@ -86,7 +87,7 @@ var cellAttribute = function (name) {
|
|
|
86
87
|
},
|
|
87
88
|
_a;
|
|
88
89
|
};
|
|
89
|
-
var cellAttributes = tslib_1.__assign({}, cellAttribute('style'), cellAttribute('class'), cellAttribute('id'), cellAttribute('headers'));
|
|
90
|
+
var cellAttributes = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers'));
|
|
90
91
|
var colgroupNodes = {
|
|
91
92
|
doc: { content: 'colgroup*' },
|
|
92
93
|
col: {
|
|
@@ -116,17 +117,18 @@ var shouldSkipColgroup = function (node) {
|
|
|
116
117
|
}
|
|
117
118
|
return shouldSkip;
|
|
118
119
|
};
|
|
119
|
-
|
|
120
|
+
var parseStrColgroup = function (colgroup) {
|
|
120
121
|
var doc = source_1.domToPmDoc(source_1.htmlToFragment(colgroup), colgroupSchema, { preserveWhitespace: false });
|
|
121
122
|
var fragment = source_1.pmDocToFragment(doc);
|
|
122
123
|
var colgroupEl = fragment.firstChild;
|
|
123
124
|
return colgroupEl;
|
|
124
125
|
};
|
|
125
|
-
|
|
126
|
-
tNodes
|
|
126
|
+
exports.parseStrColgroup = parseStrColgroup;
|
|
127
|
+
var tNodes = prosemirror_tables_ts_1.tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes: cellAttributes });
|
|
128
|
+
tNodes.table_row.attrs = tslib_1.__assign(tslib_1.__assign({}, tNodes.table_row.attrs), defaultAttrs([constants_1.rowTypeAttr, 'style', 'class', 'id']));
|
|
127
129
|
tNodes.table_row.toDOM = function (node) { return ['tr', pmAttributes(node.attrs), 0]; };
|
|
128
130
|
tNodes.table_row.parseDOM = [{ tag: 'tr', getAttrs: domAttributes }];
|
|
129
|
-
tNodes.table.attrs = tslib_1.__assign({}, tNodes.table.attrs, defaultAttrs(['style', 'class', 'id', constants_1.colgroupAttr, constants_1.resizableAttr]));
|
|
131
|
+
tNodes.table.attrs = tslib_1.__assign(tslib_1.__assign({}, tNodes.table.attrs), defaultAttrs(['style', 'class', 'id', constants_1.colgroupAttr, constants_1.resizableAttr]));
|
|
130
132
|
tNodes.table.toDOM = function (node) {
|
|
131
133
|
var tableAttrs = hasAttrs(node.attrs) ? pmAttributes(node.attrs, [constants_1.colgroupAttr, constants_1.resizableAttr]) : {};
|
|
132
134
|
var colgroup = null;
|
|
@@ -204,17 +206,17 @@ var nodes = tslib_1.__assign({
|
|
|
204
206
|
// has to hold the numbers from 1 to 6. Parsed and serialized as `<h1>` to
|
|
205
207
|
// `<h6>` elements.
|
|
206
208
|
heading: {
|
|
207
|
-
attrs: tslib_1.__assign({}, commonAttributes(), { level: { default: 1 } }),
|
|
209
|
+
attrs: tslib_1.__assign(tslib_1.__assign({}, commonAttributes()), { level: { default: 1 } }),
|
|
208
210
|
content: 'inline*',
|
|
209
211
|
group: 'block',
|
|
210
212
|
defining: true,
|
|
211
213
|
parseDOM: [
|
|
212
|
-
{ tag: 'h1', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 1 })); } },
|
|
213
|
-
{ tag: 'h2', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 2 })); } },
|
|
214
|
-
{ tag: 'h3', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 3 })); } },
|
|
215
|
-
{ tag: 'h4', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 4 })); } },
|
|
216
|
-
{ tag: 'h5', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 5 })); } },
|
|
217
|
-
{ tag: 'h6', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 6 })); } }
|
|
214
|
+
{ tag: 'h1', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 1 })); } },
|
|
215
|
+
{ tag: 'h2', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 2 })); } },
|
|
216
|
+
{ tag: 'h3', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 3 })); } },
|
|
217
|
+
{ tag: 'h4', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 4 })); } },
|
|
218
|
+
{ tag: 'h5', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 5 })); } },
|
|
219
|
+
{ tag: 'h6', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 6 })); } }
|
|
218
220
|
],
|
|
219
221
|
toDOM: function (node) { return hasAttrs(node.attrs, 'level') ?
|
|
220
222
|
['h' + node.attrs.level, pmAttributes(node.attrs, ['level']), hole] :
|
|
@@ -268,14 +270,14 @@ var nodes = tslib_1.__assign({
|
|
|
268
270
|
ordered_list: {
|
|
269
271
|
content: 'list_item+',
|
|
270
272
|
group: 'block',
|
|
271
|
-
attrs: tslib_1.__assign({}, commonAttributes(), { type: { default: null }, order: { default: 1 } }),
|
|
273
|
+
attrs: tslib_1.__assign(tslib_1.__assign({}, commonAttributes()), { type: { default: null }, order: { default: 1 } }),
|
|
272
274
|
parseDOM: [{ tag: 'ol', getAttrs: function (dom) {
|
|
273
|
-
return tslib_1.__assign({}, domAttributes(dom), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
|
|
275
|
+
return tslib_1.__assign(tslib_1.__assign({}, domAttributes(dom)), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
|
|
274
276
|
} }],
|
|
275
277
|
toDOM: function (node) {
|
|
276
278
|
return node.attrs.order === 1 ?
|
|
277
279
|
(hasAttrs(node.attrs, 'order') ? ['ol', pmAttributes(node.attrs, ['order']), hole] : olDOM) :
|
|
278
|
-
['ol', tslib_1.__assign({}, pmAttributes(node.attrs, ['order']), { start: node.attrs.order }), hole];
|
|
280
|
+
['ol', tslib_1.__assign(tslib_1.__assign({}, pmAttributes(node.attrs, ['order'])), { start: node.attrs.order }), hole];
|
|
279
281
|
}
|
|
280
282
|
},
|
|
281
283
|
// :: NodeSpec
|
|
@@ -8,14 +8,14 @@ export interface SearchOptions {
|
|
|
8
8
|
matchWord?: boolean | ((exec: RegExpExecArray) => boolean);
|
|
9
9
|
useRegExp?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare const findAt: (doc: Node
|
|
12
|
-
export declare const find: (state: EditorState
|
|
13
|
-
doc: Node
|
|
14
|
-
selection: Selection
|
|
15
|
-
}, searchOptions: SearchOptions) => TextSelection
|
|
16
|
-
export declare const findAll: (doc: Node
|
|
17
|
-
export declare const replace: (selection: Selection
|
|
11
|
+
export declare const findAt: (doc: Node, searchOptions: SearchOptions, start: number, end: number, exit: (result: TextSelection[]) => boolean) => TextSelection[];
|
|
12
|
+
export declare const find: (state: EditorState | {
|
|
13
|
+
doc: Node;
|
|
14
|
+
selection: Selection;
|
|
15
|
+
}, searchOptions: SearchOptions) => TextSelection | null;
|
|
16
|
+
export declare const findAll: (doc: Node, searchOptions: SearchOptions) => TextSelection[];
|
|
17
|
+
export declare const replace: (selection: Selection | {
|
|
18
18
|
from: number;
|
|
19
19
|
to: number;
|
|
20
|
-
}, text: string, transaction: Transaction
|
|
21
|
-
export declare const replaceAll: (state: EditorState
|
|
20
|
+
}, text: string, transaction: Transaction) => Transaction;
|
|
21
|
+
export declare const replaceAll: (state: EditorState, replaceText: string, searchOptions: SearchOptions) => Transaction | null;
|
package/dist/npm/find-replace.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceAll = exports.replace = exports.findAll = exports.find = exports.findAt = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var prosemirror_state_1 = require("prosemirror-state");
|
|
5
|
-
|
|
6
|
+
var findAt = function (doc, searchOptions, start, end, exit) {
|
|
6
7
|
var result = [], exec, text, from, to, childText, nextSibling;
|
|
7
8
|
var nodes = [];
|
|
8
9
|
var matchCase = searchOptions.matchCase, matchWord = searchOptions.matchWord, useRegExp = searchOptions.useRegExp;
|
|
@@ -58,7 +59,8 @@ exports.findAt = function (doc, searchOptions, start, end, exit) {
|
|
|
58
59
|
});
|
|
59
60
|
return result;
|
|
60
61
|
};
|
|
61
|
-
exports.
|
|
62
|
+
exports.findAt = findAt;
|
|
63
|
+
var find = function (state, searchOptions) {
|
|
62
64
|
var backward = searchOptions.backward, matchCyclic = searchOptions.matchCyclic, options = tslib_1.__rest(searchOptions, ["backward", "matchCyclic"]);
|
|
63
65
|
var exit = backward ? function () { return false; } : function (r) { return r.length > 0; };
|
|
64
66
|
var doc = state.doc, selection = state.selection;
|
|
@@ -77,16 +79,19 @@ exports.find = function (state, searchOptions) {
|
|
|
77
79
|
}
|
|
78
80
|
return result.length ? result[result.length - 1] : null;
|
|
79
81
|
};
|
|
80
|
-
exports.
|
|
82
|
+
exports.find = find;
|
|
83
|
+
var findAll = function (doc, searchOptions) {
|
|
81
84
|
return exports.findAt(doc, searchOptions, 0, doc.content.size, function () { return false; });
|
|
82
85
|
};
|
|
83
|
-
exports.
|
|
86
|
+
exports.findAll = findAll;
|
|
87
|
+
var replace = function (selection, text, transaction) {
|
|
84
88
|
var from = selection.from, to = selection.to;
|
|
85
89
|
transaction.insertText(text, from, to)
|
|
86
90
|
.setSelection(prosemirror_state_1.TextSelection.create(transaction.doc, from, from + text.length));
|
|
87
91
|
return transaction;
|
|
88
92
|
};
|
|
89
|
-
exports.
|
|
93
|
+
exports.replace = replace;
|
|
94
|
+
var replaceAll = function (state, replaceText, searchOptions) {
|
|
90
95
|
var result = exports.findAll(state.doc, searchOptions);
|
|
91
96
|
if (result.length === 0) {
|
|
92
97
|
return null;
|
|
@@ -97,6 +102,7 @@ exports.replaceAll = function (state, replaceText, searchOptions) {
|
|
|
97
102
|
}
|
|
98
103
|
return transaction;
|
|
99
104
|
};
|
|
105
|
+
exports.replaceAll = replaceAll;
|
|
100
106
|
var notLetter = /^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/;
|
|
101
107
|
var shouldMatchWord = function (exec, matchWord) {
|
|
102
108
|
if (!matchWord) {
|
package/dist/npm/image.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insertImage = void 0;
|
|
3
4
|
var utils_1 = require("./utils");
|
|
4
|
-
|
|
5
|
+
var insertImage = function (attrs) { return function (state, dispatch) {
|
|
5
6
|
var image = state.schema.nodes.image;
|
|
6
7
|
var commandName = 'insertImage';
|
|
7
8
|
var newImage = image.createAndFill(attrs);
|
|
8
9
|
utils_1.insertNode(newImage)(state, function (tr) { return dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)); });
|
|
9
10
|
}; };
|
|
11
|
+
exports.insertImage = insertImage;
|
package/dist/npm/indent.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { Command } from './types/command';
|
|
|
7
7
|
*
|
|
8
8
|
* @returns {boolean} - Returns true if any indentation is applied.
|
|
9
9
|
*/
|
|
10
|
-
export declare const indentBlocks: (actions: IndentRule
|
|
11
|
-
export declare const isIndented: (state: EditorState
|
|
12
|
-
export declare const canIndentAsListItem: (state: EditorState
|
|
13
|
-
export declare const canOutdentAsListItem: (state: EditorState
|
|
14
|
-
export declare const canBeIndented: (state: EditorState
|
|
10
|
+
export declare const indentBlocks: (actions: Array<IndentRule>, command?: string, dir?: string) => Command;
|
|
11
|
+
export declare const isIndented: (state: EditorState, rules: Array<IndentRule>, dir?: string) => boolean;
|
|
12
|
+
export declare const canIndentAsListItem: (state: EditorState, nodeType: NodeType) => boolean;
|
|
13
|
+
export declare const canOutdentAsListItem: (state: EditorState, rules: IndentationRules) => boolean;
|
|
14
|
+
export declare const canBeIndented: (state: EditorState, rules: IndentationRules) => boolean;
|
|
15
15
|
export declare const indent: Command;
|
|
16
16
|
export declare const outdent: Command;
|
package/dist/npm/indent.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.outdent = exports.indent = exports.canBeIndented = exports.canOutdentAsListItem = exports.canIndentAsListItem = exports.isIndented = exports.indentBlocks = void 0;
|
|
3
4
|
var prosemirror_schema_list_1 = require("prosemirror-schema-list");
|
|
4
5
|
var indent_rules_1 = require("./config/indent-rules");
|
|
5
6
|
var blockNode_1 = require("./blockNode");
|
|
@@ -10,7 +11,7 @@ var blockquote_1 = require("./blockquote");
|
|
|
10
11
|
*
|
|
11
12
|
* @returns {boolean} - Returns true if any indentation is applied.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
var indentBlocks = function (actions, command, dir) { return function (state, dispatch) {
|
|
14
15
|
var blocks = blockNode_1.blockNodes(state);
|
|
15
16
|
var tr = state.tr;
|
|
16
17
|
tr.setMeta('commandName', command);
|
|
@@ -46,7 +47,8 @@ exports.indentBlocks = function (actions, command, dir) { return function (state
|
|
|
46
47
|
}
|
|
47
48
|
return result;
|
|
48
49
|
}; };
|
|
49
|
-
exports.
|
|
50
|
+
exports.indentBlocks = indentBlocks;
|
|
51
|
+
var isIndented = function (state, rules, dir) {
|
|
50
52
|
var blocks = blockNode_1.blockNodes(state);
|
|
51
53
|
var result = false;
|
|
52
54
|
blocks.forEach(function (node) {
|
|
@@ -61,10 +63,12 @@ exports.isIndented = function (state, rules, dir) {
|
|
|
61
63
|
});
|
|
62
64
|
return result;
|
|
63
65
|
};
|
|
64
|
-
exports.
|
|
66
|
+
exports.isIndented = isIndented;
|
|
67
|
+
var canIndentAsListItem = function (state, nodeType) {
|
|
65
68
|
return prosemirror_schema_list_1.sinkListItem(nodeType)(state);
|
|
66
69
|
};
|
|
67
|
-
exports.
|
|
70
|
+
exports.canIndentAsListItem = canIndentAsListItem;
|
|
71
|
+
var canOutdentAsListItem = function (state, rules) {
|
|
68
72
|
var listItem = state.schema.nodes[rules.listsTypes.listItem];
|
|
69
73
|
var orderedList = state.schema.nodes[rules.listsTypes.orderedList];
|
|
70
74
|
var bulletList = state.schema.nodes[rules.listsTypes.bulletList];
|
|
@@ -72,13 +76,15 @@ exports.canOutdentAsListItem = function (state, rules) {
|
|
|
72
76
|
var isNestedInUL = !!utils_1.findNthParentNodeOfType(bulletList, 2)(state.selection);
|
|
73
77
|
return (isNestedInOL || isNestedInUL) && prosemirror_schema_list_1.liftListItem(listItem)(state);
|
|
74
78
|
};
|
|
75
|
-
exports.
|
|
79
|
+
exports.canOutdentAsListItem = canOutdentAsListItem;
|
|
80
|
+
var canBeIndented = function (state, rules) {
|
|
76
81
|
var nodes = state.schema.nodes;
|
|
77
82
|
var listItem = nodes[indent_rules_1.indentRules.listsTypes.listItem];
|
|
78
83
|
return ((exports.isIndented(state, rules.nodes) || indent_rules_1.indentRules.nodes.some(function (rule) { return nodes[rule.node] && blockNode_1.hasNode(state, nodes[rule.node]); })) &&
|
|
79
84
|
!blockNode_1.hasNode(state, listItem));
|
|
80
85
|
};
|
|
81
|
-
exports.
|
|
86
|
+
exports.canBeIndented = canBeIndented;
|
|
87
|
+
var indent = function (state, dispatch) {
|
|
82
88
|
var listItem = state.schema.nodes[indent_rules_1.indentRules.listsTypes.listItem];
|
|
83
89
|
var isIndentableBlock = exports.canBeIndented(state, indent_rules_1.indentRules);
|
|
84
90
|
if (exports.canIndentAsListItem(state, listItem)) {
|
|
@@ -88,7 +94,8 @@ exports.indent = function (state, dispatch) {
|
|
|
88
94
|
exports.indentBlocks(indent_rules_1.indentRules.nodes)(state, dispatch);
|
|
89
95
|
}
|
|
90
96
|
};
|
|
91
|
-
exports.
|
|
97
|
+
exports.indent = indent;
|
|
98
|
+
var outdent = function (state, dispatch) {
|
|
92
99
|
var nodes = state.schema.nodes;
|
|
93
100
|
var listItem = nodes[indent_rules_1.outdentRules.listsTypes.listItem];
|
|
94
101
|
var isIndentableBlock = exports.canBeIndented(state, indent_rules_1.outdentRules);
|
|
@@ -102,3 +109,4 @@ exports.outdent = function (state, dispatch) {
|
|
|
102
109
|
exports.indentBlocks(indent_rules_1.outdentRules.nodes)(state, dispatch);
|
|
103
110
|
}
|
|
104
111
|
};
|
|
112
|
+
exports.outdent = outdent;
|
|
@@ -3,14 +3,14 @@ import { InlineFormatOptions } from './config/commands';
|
|
|
3
3
|
/**
|
|
4
4
|
* Used by FontSize and FontName tools for getting their state.
|
|
5
5
|
*/
|
|
6
|
-
export declare const getInlineStyles: (state: EditorState
|
|
6
|
+
export declare const getInlineStyles: (state: EditorState, style: {
|
|
7
7
|
name: string;
|
|
8
8
|
value: RegExp;
|
|
9
|
-
}) => string
|
|
9
|
+
}) => Array<string>;
|
|
10
10
|
/**
|
|
11
11
|
* Used by bold, italic, ... and link commands.
|
|
12
12
|
*/
|
|
13
|
-
export declare const toggleInlineFormat: (options: InlineFormatOptions, tr?: Transaction
|
|
13
|
+
export declare const toggleInlineFormat: (options: InlineFormatOptions, tr?: Transaction, markAttrs?: any) => (state: any, dispatch: any) => boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Used by FontSize, FontName, Color and BackColor commands.
|
|
16
16
|
*/
|
package/dist/npm/inline-style.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyInlineStyle = exports.toggleInlineFormat = exports.getInlineStyles = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var prosemirror_transform_1 = require("prosemirror-transform");
|
|
5
6
|
var utils_1 = require("./utils");
|
|
@@ -24,7 +25,7 @@ var changeStyleMark = function (tr, from, to, attrs, markType) {
|
|
|
24
25
|
var style = newStyle.changed ?
|
|
25
26
|
{ style: newStyle.style || null } : { style: [attrs.style] + ": " + attrs.newValue + ";" };
|
|
26
27
|
var currentMark = markType.isInSet(marks) ? marks.find(function (m) { return m.type.name === 'style'; }) : null;
|
|
27
|
-
var newMarkAttrs_1 = currentMark ? tslib_1.__assign({}, currentMark.attrs, style) : style;
|
|
28
|
+
var newMarkAttrs_1 = currentMark ? tslib_1.__assign(tslib_1.__assign({}, currentMark.attrs), style) : style;
|
|
28
29
|
var newStyleMark = markType.create(newMarkAttrs_1);
|
|
29
30
|
var newSet = newStyleMark.addToSet(marks);
|
|
30
31
|
for (var i = 0; i < marks.length; i++) {
|
|
@@ -57,11 +58,12 @@ var changeStyleMark = function (tr, from, to, attrs, markType) {
|
|
|
57
58
|
/**
|
|
58
59
|
* Used by FontSize and FontName tools for getting their state.
|
|
59
60
|
*/
|
|
60
|
-
|
|
61
|
+
var getInlineStyles = function (state, style) {
|
|
61
62
|
var styleMark = state.schema.marks.style;
|
|
62
63
|
var marks = styleMark ? mark_1.selectionMarks(state, styleMark) : [];
|
|
63
64
|
return marks.map(function (mark) { return mark_1.styleValue(mark, style); }).filter(function (m) { return m !== null; });
|
|
64
65
|
};
|
|
66
|
+
exports.getInlineStyles = getInlineStyles;
|
|
65
67
|
var changeStyle = function (markType, attrs) {
|
|
66
68
|
return function (state, dispatch, tr) {
|
|
67
69
|
var _a = state.selection, empty = _a.empty, $cursor = _a.$cursor, ranges = _a.ranges;
|
|
@@ -76,7 +78,7 @@ var changeStyle = function (markType, attrs) {
|
|
|
76
78
|
if (markType.isInSet(currentMarks)) {
|
|
77
79
|
var newStyle = changeStyleFromMark(currentMarks, attrs);
|
|
78
80
|
var styleMark = currentMarks.find(function (m) { return m.type.name === 'style'; });
|
|
79
|
-
var newAttrs_1 = tslib_1.__assign({}, (styleMark ? styleMark.attrs : {}), { style: newStyle.style || null });
|
|
81
|
+
var newAttrs_1 = tslib_1.__assign(tslib_1.__assign({}, (styleMark ? styleMark.attrs : {})), { style: newStyle.style || null });
|
|
80
82
|
if (utils_1.shallowEqual(styleMark.attrs, newAttrs_1)) {
|
|
81
83
|
return false;
|
|
82
84
|
}
|
|
@@ -104,7 +106,7 @@ var changeStyle = function (markType, attrs) {
|
|
|
104
106
|
/**
|
|
105
107
|
* Used by bold, italic, ... and link commands.
|
|
106
108
|
*/
|
|
107
|
-
|
|
109
|
+
var toggleInlineFormat = function (options, tr, markAttrs) { return function (state, dispatch) {
|
|
108
110
|
var marks = state.schema.marks;
|
|
109
111
|
var altStyle = options.altStyle, _a = options.altMarks, altMarks = _a === void 0 ? [] : _a, mark = options.mark;
|
|
110
112
|
var transaction = tr || state.tr;
|
|
@@ -115,7 +117,7 @@ exports.toggleInlineFormat = function (options, tr, markAttrs) { return function
|
|
|
115
117
|
var cmd = changeStyle(marks.style, { style: altStyle.name, value: altStyle.value });
|
|
116
118
|
styleRemoved = cmd(state, markDispatched, transaction);
|
|
117
119
|
}
|
|
118
|
-
var allMarks = [mark]
|
|
120
|
+
var allMarks = tslib_1.__spreadArray([mark], altMarks).filter(function (m) { return marks[m]; });
|
|
119
121
|
var toRemove = allMarks.map(function (m) { return mark_1.hasMark(state, { mark: m }) && marks[m]; }).filter(function (m) { return m; });
|
|
120
122
|
if (toRemove.length) {
|
|
121
123
|
mark_1.removeMarks(toRemove, state, markDispatched, transaction);
|
|
@@ -130,10 +132,11 @@ exports.toggleInlineFormat = function (options, tr, markAttrs) { return function
|
|
|
130
132
|
}
|
|
131
133
|
return dispatched;
|
|
132
134
|
}; };
|
|
135
|
+
exports.toggleInlineFormat = toggleInlineFormat;
|
|
133
136
|
/**
|
|
134
137
|
* Used by FontSize, FontName, Color and BackColor commands.
|
|
135
138
|
*/
|
|
136
|
-
|
|
139
|
+
var applyInlineStyle = function (options, command) { return function (state, dispatch) {
|
|
137
140
|
var marks = state.schema.marks;
|
|
138
141
|
var markType = marks.style;
|
|
139
142
|
var attrs = {
|
|
@@ -162,7 +165,7 @@ exports.applyInlineStyle = function (options, command) { return function (state,
|
|
|
162
165
|
else if (attrs.newValue) {
|
|
163
166
|
newStyles.style = [attrs.style] + ": " + attrs.newValue + ";";
|
|
164
167
|
}
|
|
165
|
-
var newMarkAttrs_2 = currentMark ? tslib_1.__assign({}, currentMark.attrs, newStyles) : newStyles;
|
|
168
|
+
var newMarkAttrs_2 = currentMark ? tslib_1.__assign(tslib_1.__assign({}, currentMark.attrs), newStyles) : newStyles;
|
|
166
169
|
if (Object.keys(newMarkAttrs_2).some(function (attrName) { return newMarkAttrs_2[attrName] !== null; })) {
|
|
167
170
|
dispatch(tr.addStoredMark(markType.create(newMarkAttrs_2)));
|
|
168
171
|
}
|
|
@@ -173,3 +176,4 @@ exports.applyInlineStyle = function (options, command) { return function (state,
|
|
|
173
176
|
}
|
|
174
177
|
return changeStyle(markType, attrs)(state, dispatch, tr);
|
|
175
178
|
}; };
|
|
179
|
+
exports.applyInlineStyle = applyInlineStyle;
|
package/dist/npm/link.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyLink = exports.removeLink = void 0;
|
|
3
4
|
var inline_style_1 = require("./inline-style");
|
|
4
5
|
var mark_1 = require("./mark");
|
|
5
6
|
var prosemirror_state_1 = require("prosemirror-state");
|
|
@@ -38,7 +39,7 @@ var modifyLink = function (options, tr) { return function (state, dispatch) {
|
|
|
38
39
|
dispatch(tr);
|
|
39
40
|
}
|
|
40
41
|
}; };
|
|
41
|
-
|
|
42
|
+
var removeLink = function (options, tr) { return function (state, dispatch) {
|
|
42
43
|
var $cursor = state.selection.$cursor;
|
|
43
44
|
if (!$cursor) {
|
|
44
45
|
inline_style_1.toggleInlineFormat(options, tr)(state, dispatch);
|
|
@@ -65,6 +66,7 @@ exports.removeLink = function (options, tr) { return function (state, dispatch)
|
|
|
65
66
|
dispatch(mark_1.removeMark(tr || state.tr, linkStart, linkStart + linkSize, mark));
|
|
66
67
|
}
|
|
67
68
|
}; };
|
|
69
|
+
exports.removeLink = removeLink;
|
|
68
70
|
/**
|
|
69
71
|
* Returns a mark which wraps the selection.
|
|
70
72
|
*/
|
|
@@ -72,7 +74,7 @@ var getParentMark = function (state, markType) {
|
|
|
72
74
|
var marks = mark_1.selectionMarks(state, markType);
|
|
73
75
|
return marks.length === 1 && marks[0] ? marks[0] : null;
|
|
74
76
|
};
|
|
75
|
-
|
|
77
|
+
var applyLink = function (_a, commandName) {
|
|
76
78
|
var mark = _a.mark, attrs = _a.attrs;
|
|
77
79
|
if (commandName === void 0) { commandName = 'link'; }
|
|
78
80
|
return function (state, dispatch) {
|
|
@@ -106,3 +108,4 @@ exports.applyLink = function (_a, commandName) {
|
|
|
106
108
|
return dispatched;
|
|
107
109
|
};
|
|
108
110
|
};
|
|
111
|
+
exports.applyLink = applyLink;
|
package/dist/npm/listConvert.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertMsLists = void 0;
|
|
3
4
|
var msoListRegExp = /style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi;
|
|
4
5
|
var extractListLevels = function (html) {
|
|
5
6
|
html = html.replace(msoListRegExp, function (match, list, level) {
|
|
@@ -177,7 +178,7 @@ var toList = function (blockNodes) {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
};
|
|
180
|
-
|
|
181
|
+
var convertMsLists = function (html) {
|
|
181
182
|
var container = document.createElement('div');
|
|
182
183
|
container.innerHTML = extractListLevels(html);
|
|
183
184
|
var groups = new Set();
|
|
@@ -185,3 +186,4 @@ exports.convertMsLists = function (html) {
|
|
|
185
186
|
groups.forEach(function (listsCandidates) { return toList(listsCandidates); });
|
|
186
187
|
return container.innerHTML;
|
|
187
188
|
};
|
|
189
|
+
exports.convertMsLists = convertMsLists;
|
package/dist/npm/lists.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeType,
|
|
1
|
+
import { NodeType, Node } from 'prosemirror-model';
|
|
2
2
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
3
|
import { EditorView } from 'prosemirror-view';
|
|
4
4
|
import { Command } from './types/command';
|
|
@@ -14,11 +14,9 @@ declare type ListOptions = {
|
|
|
14
14
|
* @param attrs - The attributes of the list node
|
|
15
15
|
* @returns The extracted list-style-type.
|
|
16
16
|
*/
|
|
17
|
-
export declare const listStyle: (attrs:
|
|
18
|
-
|
|
19
|
-
}) => string;
|
|
20
|
-
export declare const toggleList: (state: EditorState<any>, dispatch: (tr: Transaction<any>) => void, view: EditorView<any>, options: ListOptions, command?: string) => boolean;
|
|
17
|
+
export declare const listStyle: (attrs: Node['attrs']) => string;
|
|
18
|
+
export declare const toggleList: (state: EditorState, dispatch: (tr: Transaction) => void, view: EditorView, options: ListOptions, command?: string) => boolean;
|
|
21
19
|
export declare function toggleUnorderedList(state: EditorState, dispatch: (tr: Transaction) => void, view: EditorView): any;
|
|
22
20
|
export declare function toggleOrderedList(state: EditorState, dispatch: (tr: Transaction) => void, view: EditorView): any;
|
|
23
|
-
export declare const splitListItemKeepMarks: (itemType: NodeType
|
|
21
|
+
export declare const splitListItemKeepMarks: (itemType: NodeType) => Command;
|
|
24
22
|
export {};
|
package/dist/npm/lists.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitListItemKeepMarks = exports.toggleOrderedList = exports.toggleUnorderedList = exports.toggleList = exports.listStyle = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var prosemirror_model_1 = require("prosemirror-model");
|
|
5
6
|
var prosemirror_state_1 = require("prosemirror-state");
|
|
@@ -219,12 +220,13 @@ var reListStyle = /list\-style\-type:\s?([\w-]+)/;
|
|
|
219
220
|
* @param attrs - The attributes of the list node
|
|
220
221
|
* @returns The extracted list-style-type.
|
|
221
222
|
*/
|
|
222
|
-
|
|
223
|
+
var listStyle = function (attrs) {
|
|
223
224
|
var styleAttr = attrs.style || '';
|
|
224
225
|
var execArray = reListStyle.exec(styleAttr);
|
|
225
226
|
return (execArray && execArray[1]) || '';
|
|
226
227
|
};
|
|
227
|
-
exports.
|
|
228
|
+
exports.listStyle = listStyle;
|
|
229
|
+
var toggleList = function (state, dispatch, view, options, command) {
|
|
228
230
|
var listType = options.listType, _a = options.listAttrs, listAttrs = _a === void 0 ? { style: null } : _a;
|
|
229
231
|
var selection = state.selection;
|
|
230
232
|
var fromNode = selection.$from.node(selection.$from.depth - 2);
|
|
@@ -248,6 +250,7 @@ exports.toggleList = function (state, dispatch, view, options, command) {
|
|
|
248
250
|
return true;
|
|
249
251
|
}
|
|
250
252
|
};
|
|
253
|
+
exports.toggleList = toggleList;
|
|
251
254
|
function toggleUnorderedList(state, dispatch, view) {
|
|
252
255
|
return exports.toggleList(state, dispatch, view, tslib_1.__assign({ listType: list_settings_1.bulletList.listType }, list_settings_1.bulletList.types));
|
|
253
256
|
}
|
|
@@ -256,7 +259,7 @@ function toggleOrderedList(state, dispatch, view) {
|
|
|
256
259
|
return exports.toggleList(state, dispatch, view, tslib_1.__assign({ listType: list_settings_1.orderedList.listType }, list_settings_1.orderedList.types));
|
|
257
260
|
}
|
|
258
261
|
exports.toggleOrderedList = toggleOrderedList;
|
|
259
|
-
|
|
262
|
+
var splitListItemKeepMarks = function (itemType) { return function (state, dispatch) {
|
|
260
263
|
// see https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L321-L327
|
|
261
264
|
return prosemirror_schema_list_1.splitListItem(itemType)(state, function (tr) {
|
|
262
265
|
var marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());
|
|
@@ -266,3 +269,4 @@ exports.splitListItemKeepMarks = function (itemType) { return function (state, d
|
|
|
266
269
|
dispatch(tr);
|
|
267
270
|
});
|
|
268
271
|
}; };
|
|
272
|
+
exports.splitListItemKeepMarks = splitListItemKeepMarks;
|
package/dist/npm/main.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export * from 'prosemirror-keymap';
|
|
|
36
36
|
export * from 'prosemirror-model';
|
|
37
37
|
export * from 'prosemirror-schema-list';
|
|
38
38
|
export * from 'prosemirror-state';
|
|
39
|
-
export { TableEditingOptions, TableMap, TableNodes, TableNodesOptions, TableRect, TableRoles, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, fixTables, fixTablesKey, isInTable, deleteTable, inSameTable, getFromDOM, setDOMAttr, CellAttributes, CellSelectionJSON, CellSelection, Rect, selectedRect, selectionCell, setCellAttr, goToNextCell, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, splitCell, splitCellWithType, GetCellTypeOptions, mergeCells, deleteColumn, deleteRow, rowIsHeader, addRow, addColSpan, addColumn, addColumnAfter, addColumnBefore, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, updateColumnsOnResize, cellAround, findCell, removeColSpan, moveCellForward, nextCell } from 'prosemirror-tables';
|
|
39
|
+
export { TableEditingOptions, TableMap, TableNodes, TableNodesOptions, TableRect, TableRoles, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, fixTables, fixTablesKey, isInTable, deleteTable, inSameTable, getFromDOM, setDOMAttr, CellAttributes, CellSelectionJSON, CellSelection, Rect, selectedRect, selectionCell, setCellAttr, goToNextCell, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, splitCell, splitCellWithType, GetCellTypeOptions, 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';
|