@progress/kendo-editor-common 1.12.2-develop.4 → 1.12.2-develop.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-editor-common.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/DOMSerializer.js +6 -7
- package/dist/es/align.js +3 -6
- package/dist/es/blockNode.js +11 -14
- package/dist/es/blockquote.js +2 -5
- package/dist/es/cleanFormatting.js +3 -6
- package/dist/es/config/align-rules.js +5 -7
- package/dist/es/config/commands.js +13 -9
- package/dist/es/config/constants.js +7 -9
- package/dist/es/config/indent-rules.js +3 -6
- package/dist/es/config/keymap.js +7 -10
- package/dist/es/config/list-settings.js +3 -5
- package/dist/es/config/schema.js +4 -6
- package/dist/es/find-replace.js +8 -10
- package/dist/es/flatten-spans.js +2 -5
- package/dist/es/image.js +2 -5
- package/dist/es/indent.js +11 -14
- package/dist/es/inline-style.js +10 -12
- package/dist/es/link.js +5 -8
- package/dist/es/listConvert.js +8 -9
- package/dist/es/lists.js +12 -15
- package/dist/es/main.js +34 -33
- package/dist/es/mark.js +16 -17
- package/dist/es/paste.js +10 -13
- package/dist/es/plugins/caret-color.js +5 -8
- package/dist/es/plugins/csp-fix.js +2 -5
- package/dist/es/plugins/highlight.js +3 -6
- package/dist/es/plugins/image-resize.js +8 -11
- package/dist/es/plugins/list-markers-styles.js +2 -5
- package/dist/es/plugins/placeholder.js +2 -5
- package/dist/es/plugins/resize-utils.js +2 -4
- package/dist/es/plugins/spaces-fix.js +1 -4
- package/dist/es/plugins/table-resize/column-resize.js +21 -24
- package/dist/es/plugins/table-resize/index.js +6 -9
- package/dist/es/plugins/table-resize/row-resize.js +23 -24
- package/dist/es/plugins/table-resize/table-resize.js +17 -20
- package/dist/es/plugins/table-resize/table-view.js +6 -9
- package/dist/es/plugins/table-resize/utils.js +10 -13
- package/dist/es/source.js +15 -18
- package/dist/es/table.js +15 -18
- package/dist/es/text.js +1 -3
- 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/es/utils.js +18 -21
- package/dist/npm/DOMSerializer.d.ts +35 -0
- package/dist/npm/DOMSerializer.js +10 -9
- package/dist/npm/align.d.ts +4 -7
- package/dist/npm/align.js +9 -10
- package/dist/npm/blockNode.d.ts +15 -12
- package/dist/npm/blockNode.js +28 -29
- package/dist/npm/blockquote.d.ts +2 -5
- package/dist/npm/blockquote.js +6 -7
- package/dist/npm/cleanFormatting.d.ts +3 -6
- package/dist/npm/cleanFormatting.js +7 -8
- package/dist/npm/config/align-rules.d.ts +6 -8
- package/dist/npm/config/align-rules.js +8 -13
- package/dist/npm/config/commands.d.ts +19 -11
- package/dist/npm/config/commands.js +16 -17
- package/dist/npm/config/constants.d.ts +7 -0
- package/dist/npm/config/constants.js +10 -17
- package/dist/npm/config/indent-rules.d.ts +4 -6
- package/dist/npm/config/indent-rules.js +8 -11
- package/dist/npm/config/keymap.d.ts +2 -5
- package/dist/npm/config/keymap.js +21 -22
- package/dist/npm/config/list-settings.d.ts +30 -0
- package/dist/npm/config/list-settings.js +10 -13
- package/dist/npm/config/schema.d.ts +2 -3
- package/dist/npm/config/schema.js +19 -20
- package/dist/npm/find-replace.d.ts +7 -10
- package/dist/npm/find-replace.js +20 -20
- package/dist/npm/flatten-spans.d.ts +1 -3
- package/dist/npm/flatten-spans.js +6 -7
- package/dist/npm/image.d.ts +3 -6
- package/dist/npm/image.js +5 -6
- package/dist/npm/indent.d.ts +9 -12
- package/dist/npm/indent.js +37 -38
- package/dist/npm/inline-style.d.ts +4 -7
- package/dist/npm/inline-style.js +28 -28
- package/dist/npm/link.d.ts +2 -4
- package/dist/npm/link.js +21 -22
- package/dist/npm/listConvert.d.ts +1 -3
- package/dist/npm/listConvert.js +13 -12
- package/dist/npm/lists.d.ts +8 -8
- package/dist/npm/lists.js +26 -27
- package/dist/npm/main.d.ts +34 -35
- package/dist/npm/main.js +214 -391
- package/dist/npm/mark.d.ts +17 -12
- package/dist/npm/mark.js +30 -29
- package/dist/npm/paste.d.ts +8 -11
- package/dist/npm/paste.js +19 -20
- package/dist/npm/plugins/caret-color.d.ts +2 -5
- package/dist/npm/plugins/caret-color.js +15 -17
- package/dist/npm/plugins/csp-fix.d.ts +1 -4
- package/dist/npm/plugins/csp-fix.js +8 -9
- package/dist/npm/plugins/highlight.d.ts +4 -7
- package/dist/npm/plugins/highlight.js +11 -13
- package/dist/npm/plugins/image-resize.d.ts +5 -7
- package/dist/npm/plugins/image-resize.js +35 -37
- package/dist/npm/plugins/list-markers-styles.d.ts +2 -5
- package/dist/npm/plugins/list-markers-styles.js +14 -16
- package/dist/npm/plugins/placeholder.d.ts +1 -4
- package/dist/npm/plugins/placeholder.js +10 -12
- package/dist/npm/plugins/resize-utils.d.ts +35 -0
- package/dist/npm/plugins/resize-utils.js +5 -7
- package/dist/npm/plugins/spaces-fix.d.ts +1 -4
- package/dist/npm/plugins/spaces-fix.js +9 -10
- package/dist/npm/plugins/table-resize/column-resize.d.ts +2 -0
- package/dist/npm/plugins/table-resize/column-resize.js +44 -46
- package/dist/npm/plugins/table-resize/index.d.ts +2 -5
- package/dist/npm/plugins/table-resize/index.js +13 -14
- package/dist/npm/plugins/table-resize/row-resize.d.ts +2 -0
- package/dist/npm/plugins/table-resize/row-resize.js +40 -40
- package/dist/npm/plugins/table-resize/table-resize.d.ts +18 -0
- package/dist/npm/plugins/table-resize/table-resize.js +51 -52
- package/dist/npm/plugins/table-resize/table-view.d.ts +28 -0
- package/dist/npm/plugins/table-resize/table-view.js +23 -24
- package/dist/npm/plugins/table-resize/utils.d.ts +17 -7
- package/dist/npm/plugins/table-resize/utils.js +24 -28
- package/dist/npm/source.d.ts +13 -16
- package/dist/npm/source.js +35 -36
- package/dist/npm/table.d.ts +9 -10
- package/dist/npm/table.js +33 -49
- package/dist/npm/text.d.ts +3 -6
- package/dist/npm/text.js +3 -3
- package/dist/npm/types/active-marks.d.ts +1 -4
- package/dist/npm/types/active-marks.js +2 -0
- package/dist/npm/types/command.d.ts +2 -5
- package/dist/npm/types/command.js +2 -0
- package/dist/npm/types/dispatchFn.d.ts +1 -4
- package/dist/npm/types/dispatchFn.js +2 -0
- package/dist/npm/types/paste-cleanup-settings.d.ts +1 -3
- package/dist/npm/types/paste-cleanup-settings.js +2 -0
- package/dist/npm/types/predicate.d.ts +1 -0
- package/dist/npm/types/predicate.js +2 -0
- package/dist/npm/utils.d.ts +33 -14
- package/dist/npm/utils.js +38 -39
- package/package.json +3 -50
- package/dist/es2015/DOMSerializer.js +0 -184
- package/dist/es2015/align.js +0 -43
- package/dist/es2015/blockNode.js +0 -180
- package/dist/es2015/blockquote.js +0 -26
- package/dist/es2015/cleanFormatting.js +0 -20
- package/dist/es2015/config/align-rules.js +0 -30
- package/dist/es2015/config/commands.js +0 -50
- package/dist/es2015/config/constants.js +0 -9
- package/dist/es2015/config/indent-rules.js +0 -42
- package/dist/es2015/config/keymap.js +0 -51
- package/dist/es2015/config/list-settings.js +0 -21
- package/dist/es2015/config/schema.js +0 -314
- package/dist/es2015/find-replace.js +0 -122
- package/dist/es2015/flatten-spans.js +0 -112
- package/dist/es2015/image.js +0 -10
- package/dist/es2015/indent.js +0 -105
- package/dist/es2015/inline-style.js +0 -177
- package/dist/es2015/link.js +0 -105
- package/dist/es2015/listConvert.js +0 -184
- package/dist/es2015/lists.js +0 -266
- package/dist/es2015/main.js +0 -44
- package/dist/es2015/mark.js +0 -239
- package/dist/es2015/node_modules/tslib/tslib.es6.js +0 -35
- package/dist/es2015/paste.js +0 -162
- package/dist/es2015/plugins/caret-color.js +0 -34
- package/dist/es2015/plugins/csp-fix.js +0 -51
- package/dist/es2015/plugins/highlight.js +0 -23
- package/dist/es2015/plugins/image-resize.js +0 -225
- package/dist/es2015/plugins/list-markers-styles.js +0 -104
- package/dist/es2015/plugins/placeholder.js +0 -27
- package/dist/es2015/plugins/resize-utils.js +0 -13
- package/dist/es2015/plugins/spaces-fix.js +0 -46
- package/dist/es2015/plugins/table-resize/column-resize.js +0 -267
- package/dist/es2015/plugins/table-resize/index.js +0 -12
- package/dist/es2015/plugins/table-resize/row-resize.js +0 -234
- package/dist/es2015/plugins/table-resize/table-resize.js +0 -278
- package/dist/es2015/plugins/table-resize/table-view.js +0 -128
- package/dist/es2015/plugins/table-resize/utils.js +0 -93
- package/dist/es2015/source.js +0 -251
- package/dist/es2015/table.js +0 -132
- package/dist/es2015/text.js +0 -5
- package/dist/es2015/utils.js +0 -289
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { PluginKey } from 'prosemirror-state';
|
|
2
|
-
|
|
3
|
-
declare const tableResizeKey: PluginKey<any>;
|
|
4
|
-
declare const tableColumnResizeKey: PluginKey<any>;
|
|
5
|
-
declare const tableRowResizeKey: PluginKey<any>;
|
|
6
|
-
|
|
7
|
-
export
|
|
1
|
+
import { EditorState, PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
export declare const tableResizeKey: PluginKey<any>;
|
|
4
|
+
export declare const tableColumnResizeKey: PluginKey<any>;
|
|
5
|
+
export declare const tableRowResizeKey: PluginKey<any>;
|
|
6
|
+
export declare function otherResizing(current: PluginKey, state: EditorState): boolean;
|
|
7
|
+
export declare function otherResizeHandle(current: PluginKey, state: EditorState): boolean;
|
|
8
|
+
export declare function getTable(dom: HTMLElement): HTMLTableElement;
|
|
9
|
+
export declare function domCellAround(target: any): HTMLTableCellElement | null;
|
|
10
|
+
export declare function cellIndexes(dataCell: HTMLTableCellElement): {
|
|
11
|
+
cellIndex: number;
|
|
12
|
+
rowIndex: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function edgeCell(view: EditorView, event: MouseEvent, indexes: {
|
|
15
|
+
cellIndex: number;
|
|
16
|
+
rowIndex: number;
|
|
17
|
+
}): number;
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tableRowResizeKey = exports.tableColumnResizeKey = exports.tableResizeKey = void 0;
|
|
4
|
+
exports.otherResizing = otherResizing;
|
|
5
|
+
exports.otherResizeHandle = otherResizeHandle;
|
|
6
|
+
exports.getTable = getTable;
|
|
7
|
+
exports.domCellAround = domCellAround;
|
|
8
|
+
exports.cellIndexes = cellIndexes;
|
|
9
|
+
exports.edgeCell = edgeCell;
|
|
10
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
11
|
+
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
exports.tableResizeKey = new prosemirror_state_1.PluginKey('table-resize');
|
|
14
|
+
exports.tableColumnResizeKey = new prosemirror_state_1.PluginKey('table-column-resizing');
|
|
15
|
+
exports.tableRowResizeKey = new prosemirror_state_1.PluginKey('table-row-resizing');
|
|
10
16
|
function otherResizing(current, state) {
|
|
11
17
|
let activeResize = false;
|
|
12
18
|
activeResize = activeResize ||
|
|
13
|
-
(current !== tableResizeKey && Boolean(tableResizeKey.get(state)) && tableResizeKey.getState(state).dragging);
|
|
19
|
+
(current !== exports.tableResizeKey && Boolean(exports.tableResizeKey.get(state)) && exports.tableResizeKey.getState(state).dragging);
|
|
14
20
|
activeResize = activeResize ||
|
|
15
|
-
(current !== tableColumnResizeKey && Boolean(tableColumnResizeKey.get(state)) && tableColumnResizeKey.getState(state).dragging);
|
|
21
|
+
(current !== exports.tableColumnResizeKey && Boolean(exports.tableColumnResizeKey.get(state)) && exports.tableColumnResizeKey.getState(state).dragging);
|
|
16
22
|
activeResize = activeResize ||
|
|
17
|
-
(current !== tableRowResizeKey && Boolean(tableRowResizeKey.get(state)) && tableRowResizeKey.getState(state).dragging);
|
|
23
|
+
(current !== exports.tableRowResizeKey && Boolean(exports.tableRowResizeKey.get(state)) && exports.tableRowResizeKey.getState(state).dragging);
|
|
18
24
|
return activeResize;
|
|
19
25
|
}
|
|
20
26
|
function otherResizeHandle(current, state) {
|
|
21
27
|
let activeResize = false;
|
|
22
28
|
activeResize = activeResize ||
|
|
23
|
-
(current !== tableColumnResizeKey &&
|
|
24
|
-
Boolean(tableColumnResizeKey.get(state)) &&
|
|
25
|
-
tableColumnResizeKey.getState(state).activeHandle > -1);
|
|
29
|
+
(current !== exports.tableColumnResizeKey &&
|
|
30
|
+
Boolean(exports.tableColumnResizeKey.get(state)) &&
|
|
31
|
+
exports.tableColumnResizeKey.getState(state).activeHandle > -1);
|
|
26
32
|
activeResize = activeResize ||
|
|
27
|
-
(current !== tableRowResizeKey && Boolean(tableRowResizeKey.get(state)) && tableRowResizeKey.getState(state).activeHandle > -1);
|
|
33
|
+
(current !== exports.tableRowResizeKey && Boolean(exports.tableRowResizeKey.get(state)) && exports.tableRowResizeKey.getState(state).activeHandle > -1);
|
|
28
34
|
return activeResize;
|
|
29
35
|
}
|
|
30
36
|
function getTable(dom) {
|
|
@@ -81,23 +87,13 @@ function edgeCell(view, event, indexes) {
|
|
|
81
87
|
return -1;
|
|
82
88
|
}
|
|
83
89
|
const $pos = view.state.doc.resolve(found.pos);
|
|
84
|
-
const parentTable =
|
|
90
|
+
const parentTable = (0, utils_1.parentNode)($pos, n => n.type.spec.tableRole === 'table');
|
|
85
91
|
if (parentTable === null) {
|
|
86
92
|
return -1;
|
|
87
93
|
}
|
|
88
94
|
const tablePos = $pos.start(parentTable.depth);
|
|
89
95
|
const tableNode = parentTable.node;
|
|
90
|
-
const map =
|
|
96
|
+
const map = prosemirror_tables_1.TableMap.get(tableNode);
|
|
91
97
|
const cell = tablePos + map.map[(map.width * indexes.rowIndex) + indexes.cellIndex];
|
|
92
98
|
return cell;
|
|
93
99
|
}
|
|
94
|
-
|
|
95
|
-
exports.cellIndexes = cellIndexes;
|
|
96
|
-
exports.domCellAround = domCellAround;
|
|
97
|
-
exports.edgeCell = edgeCell;
|
|
98
|
-
exports.getTable = getTable;
|
|
99
|
-
exports.otherResizeHandle = otherResizeHandle;
|
|
100
|
-
exports.otherResizing = otherResizing;
|
|
101
|
-
exports.tableColumnResizeKey = tableColumnResizeKey;
|
|
102
|
-
exports.tableResizeKey = tableResizeKey;
|
|
103
|
-
exports.tableRowResizeKey = tableRowResizeKey;
|
package/dist/npm/source.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Node as
|
|
1
|
+
import { ParseOptions, Node as ProseMirrorNode, Schema } from 'prosemirror-model';
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
|
-
import { Command } from './types/command
|
|
4
|
-
|
|
3
|
+
import { Command } from './types/command';
|
|
5
4
|
/**
|
|
6
5
|
* Trims the whitespace around the provided block nodes.
|
|
7
6
|
*
|
|
@@ -14,25 +13,25 @@ import { Command } from './types/command.js';
|
|
|
14
13
|
*
|
|
15
14
|
* @returns The trimmed HTML content
|
|
16
15
|
*/
|
|
17
|
-
declare const trimWhitespace: (html: string, trimAroundTags?: string[]) => string;
|
|
16
|
+
export declare const trimWhitespace: (html: string, trimAroundTags?: string[]) => string;
|
|
18
17
|
/**
|
|
19
18
|
* Creates a DocumentFragment from the given HTML content.
|
|
20
19
|
*
|
|
21
20
|
* @param html
|
|
22
21
|
* @returns DocumentFragment
|
|
23
22
|
*/
|
|
24
|
-
declare const htmlToFragment: (html: string) => DocumentFragment;
|
|
23
|
+
export declare const htmlToFragment: (html: string) => DocumentFragment;
|
|
25
24
|
/**
|
|
26
25
|
* @hidden
|
|
27
26
|
*/
|
|
28
|
-
declare const fragmentToHtml: (fragment: DocumentFragment) => string;
|
|
27
|
+
export declare const fragmentToHtml: (fragment: DocumentFragment) => string;
|
|
29
28
|
/**
|
|
30
29
|
* Creates a DocumentFragment from the given ProseMirrorNode.
|
|
31
30
|
*
|
|
32
31
|
* @param doc ProseMirrorNode
|
|
33
32
|
* @returns DocumentFragment
|
|
34
33
|
*/
|
|
35
|
-
declare const pmDocToFragment: (doc:
|
|
34
|
+
export declare const pmDocToFragment: (doc: ProseMirrorNode) => DocumentFragment;
|
|
36
35
|
/**
|
|
37
36
|
* Creates a ProseMirrorNode from the given DOM element.
|
|
38
37
|
*
|
|
@@ -41,7 +40,7 @@ declare const pmDocToFragment: (doc: Node$1) => DocumentFragment;
|
|
|
41
40
|
* @param parseOptions
|
|
42
41
|
* @returns ProseMirrorNode
|
|
43
42
|
*/
|
|
44
|
-
declare const domToPmDoc: (dom: Node, schema: Schema, parseOptions: ParseOptions) =>
|
|
43
|
+
export declare const domToPmDoc: (dom: Node, schema: Schema, parseOptions: ParseOptions) => ProseMirrorNode;
|
|
45
44
|
/**
|
|
46
45
|
* Creates a ProseMirrorNode from the given HTML content.
|
|
47
46
|
*
|
|
@@ -50,15 +49,15 @@ declare const domToPmDoc: (dom: Node, schema: Schema, parseOptions: ParseOptions
|
|
|
50
49
|
* @param parseOptions - ProseMirror parse options recognized by the `parse` and `parseSlice` methods.
|
|
51
50
|
* @returns - New ProseMirrorNode instance.
|
|
52
51
|
*/
|
|
53
|
-
declare const parseContent: (content: string, schema: Schema, parseOptions?: ParseOptions) =>
|
|
52
|
+
export declare const parseContent: (content: string, schema: Schema, parseOptions?: ParseOptions) => ProseMirrorNode;
|
|
54
53
|
/**
|
|
55
54
|
* A function that serializes the Editor State content as HTML string.
|
|
56
55
|
*
|
|
57
56
|
* @param state - The Editor State
|
|
58
57
|
* @returns - The serialized content
|
|
59
58
|
*/
|
|
60
|
-
declare const getHtml: (state: EditorState | {
|
|
61
|
-
doc:
|
|
59
|
+
export declare const getHtml: (state: EditorState | {
|
|
60
|
+
doc: ProseMirrorNode;
|
|
62
61
|
}) => string;
|
|
63
62
|
/**
|
|
64
63
|
* Replaces the content of the editor with a new one.
|
|
@@ -68,14 +67,12 @@ declare const getHtml: (state: EditorState | {
|
|
|
68
67
|
* @param parseOptions - ProseMirror parse options recognized by the `parse` and `parseSlice` methods.
|
|
69
68
|
* @returns - Command function that takes an editor `state` and `dispatch` function.
|
|
70
69
|
*/
|
|
71
|
-
declare const setHtml: (content: string, command?: string, parseOptions?: ParseOptions) => Command;
|
|
70
|
+
export declare const setHtml: (content: string, command?: string, parseOptions?: ParseOptions) => Command;
|
|
72
71
|
/**
|
|
73
72
|
* @hidden
|
|
74
73
|
*/
|
|
75
|
-
declare const hasSameMarkup: (dom1: string, dom2: string, schema: Schema, parseOptions?: ParseOptions) => boolean;
|
|
74
|
+
export declare const hasSameMarkup: (dom1: string, dom2: string, schema: Schema, parseOptions?: ParseOptions) => boolean;
|
|
76
75
|
/**
|
|
77
76
|
* Removes comments in HTML.
|
|
78
77
|
*/
|
|
79
|
-
declare const removeComments: (html: string) => string;
|
|
80
|
-
|
|
81
|
-
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace };
|
|
78
|
+
export declare const removeComments: (html: string) => string;
|
package/dist/npm/source.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeComments = exports.hasSameMarkup = exports.setHtml = exports.getHtml = exports.parseContent = exports.domToPmDoc = exports.pmDocToFragment = exports.fragmentToHtml = exports.htmlToFragment = exports.trimWhitespace = void 0;
|
|
4
|
+
const prosemirror_model_1 = require("prosemirror-model");
|
|
5
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
6
|
+
const constants_1 = require("./config/constants");
|
|
7
|
+
const DOMSerializer_1 = require("./DOMSerializer");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
9
|
const blockWrappers = [
|
|
10
10
|
'div', 'ol', 'ul', 'li', 'table', 'tbody', 'thead', 'tfoot', 'caption', 'td', 'th', 'p',
|
|
11
11
|
'tr', 'col', 'colgroup', 'article', 'main', 'nav', 'header', 'footer', 'aside', 'section'
|
|
12
12
|
];
|
|
13
13
|
const removeRowType = (table, nodeName) => {
|
|
14
14
|
const wrapper = (table.ownerDocument || document).createElement(nodeName);
|
|
15
|
-
Array.from(table.rows).filter(r => r.getAttribute(
|
|
16
|
-
row.removeAttribute(
|
|
15
|
+
Array.from(table.rows).filter(r => r.getAttribute(constants_1.rowTypeAttr) === nodeName).forEach(row => {
|
|
16
|
+
row.removeAttribute(constants_1.rowTypeAttr);
|
|
17
17
|
wrapper.appendChild(row);
|
|
18
18
|
});
|
|
19
19
|
if (wrapper.children.length) {
|
|
@@ -61,7 +61,7 @@ const setRowType = (children, nodeName) => {
|
|
|
61
61
|
const tag = nodeName.toUpperCase();
|
|
62
62
|
children.filter(c => c.nodeName === tag).forEach(rowsWrapper => {
|
|
63
63
|
Array.from(rowsWrapper.children).forEach(row => {
|
|
64
|
-
row.setAttribute(
|
|
64
|
+
row.setAttribute(constants_1.rowTypeAttr, nodeName);
|
|
65
65
|
if (rowsWrapper.parentNode) {
|
|
66
66
|
rowsWrapper.parentNode.insertBefore(row, rowsWrapper);
|
|
67
67
|
}
|
|
@@ -79,7 +79,7 @@ const validateTablesToPmSchema = (fragment) => {
|
|
|
79
79
|
}
|
|
80
80
|
const colgroup = children.find(c => c.nodeName === 'COLGROUP');
|
|
81
81
|
if (colgroup) {
|
|
82
|
-
table.setAttribute(
|
|
82
|
+
table.setAttribute(constants_1.colgroupAttr, colgroup.outerHTML);
|
|
83
83
|
colgroup.remove();
|
|
84
84
|
}
|
|
85
85
|
if (table.caption || table.style.marginLeft || table.style.marginRight) {
|
|
@@ -132,6 +132,7 @@ const trimWhitespace = (html, trimAroundTags = blockWrappers) => {
|
|
|
132
132
|
return html.replace(new RegExp('\\s*(<(?:' + tags + ')(?:\\s[^>]*?)?>)', 'g'), '$1')
|
|
133
133
|
.replace(new RegExp('(<\\/(?:' + tags + ')(?:\\s[^>]*?)?>)\\s*', 'g'), '$1');
|
|
134
134
|
};
|
|
135
|
+
exports.trimWhitespace = trimWhitespace;
|
|
135
136
|
const styleAttr = 'data-style';
|
|
136
137
|
const styleReplace = ' ' + styleAttr + '=';
|
|
137
138
|
const reTag = /<[^>]+>/gm;
|
|
@@ -146,7 +147,7 @@ const restoreStyleAttr = (container) => {
|
|
|
146
147
|
Array.from(container.querySelectorAll('[' + styleAttr + ']')).forEach((element) => {
|
|
147
148
|
const styleString = element.getAttribute(styleAttr);
|
|
148
149
|
element.removeAttribute(styleAttr);
|
|
149
|
-
|
|
150
|
+
(0, utils_1.setStyleAttr)(element, styleString);
|
|
150
151
|
});
|
|
151
152
|
};
|
|
152
153
|
/**
|
|
@@ -161,12 +162,14 @@ const htmlToFragment = (html) => {
|
|
|
161
162
|
restoreStyleAttr(template.content);
|
|
162
163
|
return template.content.cloneNode(true);
|
|
163
164
|
};
|
|
165
|
+
exports.htmlToFragment = htmlToFragment;
|
|
164
166
|
/**
|
|
165
167
|
* @hidden
|
|
166
168
|
*/
|
|
167
169
|
const fragmentToHtml = (fragment) => {
|
|
168
170
|
return Array.from(fragment.childNodes).reduce((acc, cur) => acc + (cur.outerHTML || cur.textContent || ''), '');
|
|
169
171
|
};
|
|
172
|
+
exports.fragmentToHtml = fragmentToHtml;
|
|
170
173
|
/**
|
|
171
174
|
* Creates a DocumentFragment from the given ProseMirrorNode.
|
|
172
175
|
*
|
|
@@ -174,10 +177,11 @@ const fragmentToHtml = (fragment) => {
|
|
|
174
177
|
* @returns DocumentFragment
|
|
175
178
|
*/
|
|
176
179
|
const pmDocToFragment = (doc) => {
|
|
177
|
-
const fragment =
|
|
180
|
+
const fragment = DOMSerializer_1.DOMSerializer.fromSchema(doc.type.schema).serializeFragment(doc.content);
|
|
178
181
|
restoreTables(fragment);
|
|
179
182
|
return fragment;
|
|
180
183
|
};
|
|
184
|
+
exports.pmDocToFragment = pmDocToFragment;
|
|
181
185
|
/**
|
|
182
186
|
* Creates a ProseMirrorNode from the given DOM element.
|
|
183
187
|
*
|
|
@@ -187,8 +191,9 @@ const pmDocToFragment = (doc) => {
|
|
|
187
191
|
* @returns ProseMirrorNode
|
|
188
192
|
*/
|
|
189
193
|
const domToPmDoc = (dom, schema, parseOptions) => {
|
|
190
|
-
return
|
|
194
|
+
return prosemirror_model_1.DOMParser.fromSchema(schema).parse(dom, parseOptions);
|
|
191
195
|
};
|
|
196
|
+
exports.domToPmDoc = domToPmDoc;
|
|
192
197
|
/**
|
|
193
198
|
* Creates a ProseMirrorNode from the given HTML content.
|
|
194
199
|
*
|
|
@@ -198,10 +203,11 @@ const domToPmDoc = (dom, schema, parseOptions) => {
|
|
|
198
203
|
* @returns - New ProseMirrorNode instance.
|
|
199
204
|
*/
|
|
200
205
|
const parseContent = (content, schema, parseOptions) => {
|
|
201
|
-
const dom = htmlToFragment(content);
|
|
206
|
+
const dom = (0, exports.htmlToFragment)(content);
|
|
202
207
|
validateTablesToPmSchema(dom);
|
|
203
|
-
return domToPmDoc(dom, schema, parseOptions);
|
|
208
|
+
return (0, exports.domToPmDoc)(dom, schema, parseOptions);
|
|
204
209
|
};
|
|
210
|
+
exports.parseContent = parseContent;
|
|
205
211
|
/**
|
|
206
212
|
* A function that serializes the Editor State content as HTML string.
|
|
207
213
|
*
|
|
@@ -209,9 +215,10 @@ const parseContent = (content, schema, parseOptions) => {
|
|
|
209
215
|
* @returns - The serialized content
|
|
210
216
|
*/
|
|
211
217
|
const getHtml = (state) => {
|
|
212
|
-
const fragment = pmDocToFragment(state.doc);
|
|
213
|
-
return fragmentToHtml(fragment);
|
|
218
|
+
const fragment = (0, exports.pmDocToFragment)(state.doc);
|
|
219
|
+
return (0, exports.fragmentToHtml)(fragment);
|
|
214
220
|
};
|
|
221
|
+
exports.getHtml = getHtml;
|
|
215
222
|
/**
|
|
216
223
|
* Replaces the content of the editor with a new one.
|
|
217
224
|
*
|
|
@@ -221,25 +228,28 @@ const getHtml = (state) => {
|
|
|
221
228
|
* @returns - Command function that takes an editor `state` and `dispatch` function.
|
|
222
229
|
*/
|
|
223
230
|
const setHtml = (content, command = 'setHTML', parseOptions = { preserveWhitespace: 'full' }) => (state, dispatch) => dispatch(state.tr
|
|
224
|
-
.setSelection(new
|
|
225
|
-
.replaceSelectionWith(parseContent(content, state.schema, parseOptions))
|
|
231
|
+
.setSelection(new prosemirror_state_1.AllSelection(state.doc))
|
|
232
|
+
.replaceSelectionWith((0, exports.parseContent)(content, state.schema, parseOptions))
|
|
226
233
|
.setMeta('commandName', command));
|
|
234
|
+
exports.setHtml = setHtml;
|
|
227
235
|
/**
|
|
228
236
|
* @hidden
|
|
229
237
|
*/
|
|
230
238
|
const hasSameMarkup = (dom1, dom2, schema, parseOptions) => {
|
|
231
|
-
const fragment1 =
|
|
232
|
-
const fragment2 =
|
|
239
|
+
const fragment1 = prosemirror_model_1.Fragment.from((0, exports.parseContent)(dom1, schema, parseOptions));
|
|
240
|
+
const fragment2 = prosemirror_model_1.Fragment.from((0, exports.parseContent)(dom2, schema, parseOptions));
|
|
233
241
|
return fragment1.eq(fragment2);
|
|
234
242
|
};
|
|
243
|
+
exports.hasSameMarkup = hasSameMarkup;
|
|
235
244
|
/**
|
|
236
245
|
* Removes comments in HTML.
|
|
237
246
|
*/
|
|
238
247
|
const removeComments = (html) => {
|
|
239
|
-
const fragment = htmlToFragment(html);
|
|
248
|
+
const fragment = (0, exports.htmlToFragment)(html);
|
|
240
249
|
removeCommentsFromDom(fragment);
|
|
241
|
-
return fragmentToHtml(fragment);
|
|
250
|
+
return (0, exports.fragmentToHtml)(fragment);
|
|
242
251
|
};
|
|
252
|
+
exports.removeComments = removeComments;
|
|
243
253
|
const removeCommentsFromDom = (dom) => {
|
|
244
254
|
var _a;
|
|
245
255
|
const iterator = dom.ownerDocument.createNodeIterator(dom, NodeFilter.SHOW_COMMENT);
|
|
@@ -249,14 +259,3 @@ const removeCommentsFromDom = (dom) => {
|
|
|
249
259
|
commentNode = iterator.nextNode();
|
|
250
260
|
}
|
|
251
261
|
};
|
|
252
|
-
|
|
253
|
-
exports.domToPmDoc = domToPmDoc;
|
|
254
|
-
exports.fragmentToHtml = fragmentToHtml;
|
|
255
|
-
exports.getHtml = getHtml;
|
|
256
|
-
exports.hasSameMarkup = hasSameMarkup;
|
|
257
|
-
exports.htmlToFragment = htmlToFragment;
|
|
258
|
-
exports.parseContent = parseContent;
|
|
259
|
-
exports.pmDocToFragment = pmDocToFragment;
|
|
260
|
-
exports.removeComments = removeComments;
|
|
261
|
-
exports.setHtml = setHtml;
|
|
262
|
-
exports.trimWhitespace = trimWhitespace;
|
package/dist/npm/table.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, NodeType } from 'prosemirror-model';
|
|
2
2
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
-
|
|
3
|
+
import { addRowAfter as pmAddRowAfter, addRowBefore as pmAddRowBefore, addColumnBefore as pmAddColumnBefore, addColumnAfter as pmAddColumnAfter, deleteColumn as pmDeleteColumn } from 'prosemirror-tables';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a table.
|
|
6
6
|
*
|
|
7
7
|
* @returns Node
|
|
8
8
|
*/
|
|
9
|
-
declare const createTable: (nodes: {
|
|
9
|
+
export declare const createTable: (nodes: {
|
|
10
10
|
table: NodeType;
|
|
11
11
|
table_row: NodeType;
|
|
12
12
|
table_cell: NodeType;
|
|
13
13
|
}, rows: number, columns: number) => Node;
|
|
14
|
-
declare const addRowBefore: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
15
|
-
declare const addRowAfter: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
16
|
-
declare const addColumnBefore: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
17
|
-
declare const addColumnAfter: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
18
|
-
declare const deleteColumn: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
19
|
-
|
|
20
|
-
export { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, createTable, deleteColumn };
|
|
14
|
+
export declare const addRowBefore: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
15
|
+
export declare const addRowAfter: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
16
|
+
export declare const addColumnBefore: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
17
|
+
export declare const addColumnAfter: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
18
|
+
export declare const deleteColumn: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
19
|
+
export { pmAddRowBefore, pmAddRowAfter, pmAddColumnBefore, pmAddColumnAfter, pmDeleteColumn };
|
package/dist/npm/table.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pmDeleteColumn = exports.pmAddColumnAfter = exports.pmAddColumnBefore = exports.pmAddRowAfter = exports.pmAddRowBefore = exports.deleteColumn = exports.addColumnAfter = exports.addColumnBefore = exports.addRowAfter = exports.addRowBefore = exports.createTable = void 0;
|
|
4
|
+
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
5
|
+
Object.defineProperty(exports, "pmAddRowAfter", { enumerable: true, get: function () { return prosemirror_tables_1.addRowAfter; } });
|
|
6
|
+
Object.defineProperty(exports, "pmAddRowBefore", { enumerable: true, get: function () { return prosemirror_tables_1.addRowBefore; } });
|
|
7
|
+
Object.defineProperty(exports, "pmAddColumnBefore", { enumerable: true, get: function () { return prosemirror_tables_1.addColumnBefore; } });
|
|
8
|
+
Object.defineProperty(exports, "pmAddColumnAfter", { enumerable: true, get: function () { return prosemirror_tables_1.addColumnAfter; } });
|
|
9
|
+
Object.defineProperty(exports, "pmDeleteColumn", { enumerable: true, get: function () { return prosemirror_tables_1.deleteColumn; } });
|
|
10
|
+
const constants_1 = require("./config/constants");
|
|
11
|
+
const schema_1 = require("./config/schema");
|
|
7
12
|
/**
|
|
8
13
|
* Creates a table.
|
|
9
14
|
*
|
|
@@ -22,6 +27,7 @@ const createTable = (nodes, rows, columns) => {
|
|
|
22
27
|
}
|
|
23
28
|
return table.createAndFill(undefined, tableRows);
|
|
24
29
|
};
|
|
30
|
+
exports.createTable = createTable;
|
|
25
31
|
const reTable = /^table$/;
|
|
26
32
|
const reRow = /^table_row$/;
|
|
27
33
|
const reCell = /^table_cell|table_header$/;
|
|
@@ -42,7 +48,7 @@ const addRowBefore = (state, dispatch) => {
|
|
|
42
48
|
const cmdDispatch = dispatch && (tr => {
|
|
43
49
|
const row = closest(tr.selection, reRow);
|
|
44
50
|
const table = closest(tr.selection, reTable);
|
|
45
|
-
if (row && table && row.node.attrs[
|
|
51
|
+
if (row && table && row.node.attrs[constants_1.rowTypeAttr]) {
|
|
46
52
|
let index = 0;
|
|
47
53
|
for (let i = 0; i < table.node.nodeSize; i++) {
|
|
48
54
|
if (table.node.child(i).eq(row.node)) {
|
|
@@ -52,28 +58,30 @@ const addRowBefore = (state, dispatch) => {
|
|
|
52
58
|
}
|
|
53
59
|
const next = table.node.child(index - 1);
|
|
54
60
|
const from = row.pos - next.nodeSize;
|
|
55
|
-
tr.setNodeMarkup(from, undefined, { [
|
|
61
|
+
tr.setNodeMarkup(from, undefined, { [constants_1.rowTypeAttr]: row.node.attrs[constants_1.rowTypeAttr] });
|
|
56
62
|
}
|
|
57
63
|
return dispatch(tr);
|
|
58
64
|
});
|
|
59
|
-
return
|
|
65
|
+
return (0, prosemirror_tables_1.addRowBefore)(state, cmdDispatch);
|
|
60
66
|
};
|
|
67
|
+
exports.addRowBefore = addRowBefore;
|
|
61
68
|
const addRowAfter = (state, dispatch) => {
|
|
62
69
|
const cmdDispatch = dispatch && (tr => {
|
|
63
70
|
const row = closest(tr.selection, reRow);
|
|
64
|
-
if (row && row.node.attrs[
|
|
71
|
+
if (row && row.node.attrs[constants_1.rowTypeAttr]) {
|
|
65
72
|
const from = row.pos + row.node.nodeSize;
|
|
66
|
-
tr.setNodeMarkup(from, undefined, { [
|
|
73
|
+
tr.setNodeMarkup(from, undefined, { [constants_1.rowTypeAttr]: row.node.attrs[constants_1.rowTypeAttr] });
|
|
67
74
|
}
|
|
68
75
|
return dispatch(tr);
|
|
69
76
|
});
|
|
70
|
-
return
|
|
77
|
+
return (0, prosemirror_tables_1.addRowAfter)(state, cmdDispatch);
|
|
71
78
|
};
|
|
79
|
+
exports.addRowAfter = addRowAfter;
|
|
72
80
|
const columnIndex = (table, selection) => {
|
|
73
81
|
if (!table) {
|
|
74
82
|
return -1;
|
|
75
83
|
}
|
|
76
|
-
const map =
|
|
84
|
+
const map = prosemirror_tables_1.TableMap.get(table.node);
|
|
77
85
|
const tableCell = closest(selection, reCell);
|
|
78
86
|
const idx = map.map.indexOf(tableCell.pos - table.pos - 1);
|
|
79
87
|
let colIndex = -1;
|
|
@@ -84,40 +92,42 @@ const columnIndex = (table, selection) => {
|
|
|
84
92
|
};
|
|
85
93
|
const addCol = (tr, table, to) => {
|
|
86
94
|
const colIndex = columnIndex(table, tr.selection);
|
|
87
|
-
const colgroup =
|
|
95
|
+
const colgroup = (0, schema_1.parseStrColgroup)(table.node.attrs[constants_1.colgroupAttr]);
|
|
88
96
|
colgroup.insertBefore(colgroup.ownerDocument.createElement('col'), colgroup.children[colIndex + to]);
|
|
89
|
-
tr.setNodeMarkup(table.pos, null, { ...table.node.attrs, [
|
|
97
|
+
tr.setNodeMarkup(table.pos, null, { ...table.node.attrs, [constants_1.colgroupAttr]: colgroup.outerHTML });
|
|
90
98
|
};
|
|
91
99
|
const deleteCol = (tr, table, colIndex) => {
|
|
92
|
-
const colgroup =
|
|
100
|
+
const colgroup = (0, schema_1.parseStrColgroup)(table.node.attrs[constants_1.colgroupAttr]);
|
|
93
101
|
colgroup.removeChild(colgroup.children[colIndex]);
|
|
94
|
-
tr.setNodeMarkup(table.pos, null, { ...table.node.attrs, [
|
|
102
|
+
tr.setNodeMarkup(table.pos, null, { ...table.node.attrs, [constants_1.colgroupAttr]: colgroup.outerHTML });
|
|
95
103
|
};
|
|
96
104
|
const addColumnBefore = (state, dispatch) => {
|
|
97
105
|
const cmdDispatch = dispatch && (tr => {
|
|
98
106
|
const table = closest(tr.selection, reTable);
|
|
99
|
-
if (!table.node.attrs[
|
|
107
|
+
if (!table.node.attrs[constants_1.colgroupAttr]) {
|
|
100
108
|
return dispatch(tr);
|
|
101
109
|
}
|
|
102
110
|
addCol(tr, table, -1);
|
|
103
111
|
return dispatch(tr);
|
|
104
112
|
});
|
|
105
|
-
return
|
|
113
|
+
return (0, prosemirror_tables_1.addColumnBefore)(state, cmdDispatch);
|
|
106
114
|
};
|
|
115
|
+
exports.addColumnBefore = addColumnBefore;
|
|
107
116
|
const addColumnAfter = (state, dispatch) => {
|
|
108
117
|
const cmdDispatch = dispatch && (tr => {
|
|
109
118
|
const table = closest(tr.selection, reTable);
|
|
110
|
-
if (!table.node.attrs[
|
|
119
|
+
if (!table.node.attrs[constants_1.colgroupAttr]) {
|
|
111
120
|
return dispatch(tr);
|
|
112
121
|
}
|
|
113
122
|
addCol(tr, table, 1);
|
|
114
123
|
return dispatch(tr);
|
|
115
124
|
});
|
|
116
|
-
return
|
|
125
|
+
return (0, prosemirror_tables_1.addColumnAfter)(state, cmdDispatch);
|
|
117
126
|
};
|
|
127
|
+
exports.addColumnAfter = addColumnAfter;
|
|
118
128
|
const deleteColumn = (state, dispatch) => {
|
|
119
129
|
const parentTable = closest(state.selection, reTable);
|
|
120
|
-
const colgroup = parentTable && parentTable.node.attrs[
|
|
130
|
+
const colgroup = parentTable && parentTable.node.attrs[constants_1.colgroupAttr];
|
|
121
131
|
const colIndex = columnIndex(parentTable, state.selection);
|
|
122
132
|
const cmdDispatch = dispatch && ((tr) => {
|
|
123
133
|
if (!colgroup) {
|
|
@@ -127,32 +137,6 @@ const deleteColumn = (state, dispatch) => {
|
|
|
127
137
|
deleteCol(tr, { node: table, pos: parentTable.pos }, colIndex);
|
|
128
138
|
return dispatch(tr);
|
|
129
139
|
});
|
|
130
|
-
return
|
|
140
|
+
return (0, prosemirror_tables_1.deleteColumn)(state, cmdDispatch);
|
|
131
141
|
};
|
|
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;
|
|
158
142
|
exports.deleteColumn = deleteColumn;
|
package/dist/npm/text.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { Command } from './types/command
|
|
2
|
-
|
|
3
|
-
interface TextData {
|
|
1
|
+
import { Command } from './types/command';
|
|
2
|
+
export interface TextData {
|
|
4
3
|
text: string;
|
|
5
4
|
from?: number;
|
|
6
5
|
to?: number;
|
|
7
6
|
}
|
|
8
|
-
declare const insertText: (attrs: TextData) => Command;
|
|
9
|
-
|
|
10
|
-
export { type TextData, insertText };
|
|
7
|
+
export declare const insertText: (attrs: TextData) => Command;
|
package/dist/npm/text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insertText = void 0;
|
|
3
4
|
const insertText = (attrs) => (state, dispatch) => {
|
|
4
5
|
dispatch(state.tr.insertText(attrs.text, attrs.from, attrs.to));
|
|
5
6
|
};
|
|
6
|
-
|
|
7
7
|
exports.insertText = insertText;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
|
-
import { DispatchFn } from './dispatchFn
|
|
4
|
-
|
|
5
|
-
type Command = (state: EditorState, dispatch: DispatchFn, view?: EditorView) => boolean | void;
|
|
6
|
-
|
|
7
|
-
export type { Command };
|
|
3
|
+
import { DispatchFn } from './dispatchFn';
|
|
4
|
+
export type Command = (state: EditorState, dispatch: DispatchFn, view?: EditorView) => boolean | void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The settings passed to the `pasteCleanup` function.
|
|
3
3
|
*/
|
|
4
|
-
interface PasteCleanupSettings {
|
|
4
|
+
export interface PasteCleanupSettings {
|
|
5
5
|
/**
|
|
6
6
|
* If set to `true`, converts the MS Word lists into HTML lists.
|
|
7
7
|
*/
|
|
@@ -18,5 +18,3 @@ interface PasteCleanupSettings {
|
|
|
18
18
|
[attributeName: string]: (attr: Attr) => void;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
export type { PasteCleanupSettings };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Predicate<T = any> = (condition: T) => boolean;
|