@progress/kendo-react-editor 4.10.0-dev.202109290558 → 4.10.0-dev.202110050931
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-react-editor.js +1 -1
- package/dist/es/Editor.d.ts +4 -131
- package/dist/es/Editor.js +37 -23
- package/dist/es/EditorProps.d.ts +182 -0
- package/dist/es/EditorProps.js +0 -0
- package/dist/es/main.d.ts +3 -3
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/index.js +1 -1
- package/dist/npm/Editor.d.ts +4 -131
- package/dist/npm/Editor.js +36 -22
- package/dist/npm/EditorProps.d.ts +182 -0
- package/dist/npm/EditorProps.js +2 -0
- package/dist/npm/main.d.ts +3 -3
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/index.js +1 -1
- package/dist/systemjs/kendo-react-editor.js +1 -1
- package/package.json +11 -11
package/dist/npm/Editor.d.ts
CHANGED
|
@@ -1,137 +1,8 @@
|
|
|
1
1
|
/// <reference types="prosemirror-model" />
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import * as PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
/**
|
|
7
|
-
* Represents the object of the `onChange` Editor event.
|
|
8
|
-
*/
|
|
9
|
-
export interface EditorChangeEvent {
|
|
10
|
-
/**
|
|
11
|
-
* An event target.
|
|
12
|
-
*/
|
|
13
|
-
target: Editor;
|
|
14
|
-
/**
|
|
15
|
-
* Represents the [Editor document](https://prosemirror.net/docs/guide/#doc).
|
|
16
|
-
*/
|
|
17
|
-
value: Node;
|
|
18
|
-
/**
|
|
19
|
-
* A getter of the Editor HTML content.
|
|
20
|
-
* Once called, it will convert the Editor document into HTML string.
|
|
21
|
-
* Note that, since onChange event is triggered on every key while typing,
|
|
22
|
-
* this conversion may not be suitable if the Editor is dealing with large amount of content.
|
|
23
|
-
*/
|
|
24
|
-
html: string;
|
|
25
|
-
/**
|
|
26
|
-
* The Editor Schema object.
|
|
27
|
-
*/
|
|
28
|
-
schema: Schema;
|
|
29
|
-
/**
|
|
30
|
-
* The Transaction which causes the change.
|
|
31
|
-
*/
|
|
32
|
-
transaction: Transaction;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Represents the props of the [KendoReact Editor component]({% slug overview_editor %}).
|
|
36
|
-
*/
|
|
37
|
-
export interface EditorProps {
|
|
38
|
-
/**
|
|
39
|
-
* Sets the default HTML content of the Editor.
|
|
40
|
-
*/
|
|
41
|
-
defaultContent?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Sets the initial edit mode of the Editor. Defaults to `iframe`.
|
|
44
|
-
*/
|
|
45
|
-
defaultEditMode?: 'iframe' | 'div';
|
|
46
|
-
/**
|
|
47
|
-
* Sets styles to the content element wrapper of the Editor.
|
|
48
|
-
*/
|
|
49
|
-
contentStyle?: React.CSSProperties;
|
|
50
|
-
/**
|
|
51
|
-
* Represents the `dir` HTML attribute.
|
|
52
|
-
*/
|
|
53
|
-
dir?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Sets additional classes to the Editor.
|
|
56
|
-
*/
|
|
57
|
-
className?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Sets styles to the Editor.
|
|
60
|
-
*/
|
|
61
|
-
style?: React.CSSProperties;
|
|
62
|
-
/**
|
|
63
|
-
* Sets the tools of the Editor. By default, the Editor renders no tools.
|
|
64
|
-
*/
|
|
65
|
-
tools?: Array<any>;
|
|
66
|
-
/**
|
|
67
|
-
* Fires each time the Editor is about to mount.
|
|
68
|
-
* Useful for configuring the `EditorView` object.
|
|
69
|
-
* To initialize `EditorView`, use the properties of the `event` object.
|
|
70
|
-
*/
|
|
71
|
-
onMount?: (event: {
|
|
72
|
-
target: Editor;
|
|
73
|
-
dom: HTMLDivElement;
|
|
74
|
-
plugins: Array<Plugin>;
|
|
75
|
-
shortcuts: EditorUtils.Shortcuts;
|
|
76
|
-
viewProps: {
|
|
77
|
-
state: EditorState;
|
|
78
|
-
[key: string]: any;
|
|
79
|
-
};
|
|
80
|
-
}) => EditorView | void;
|
|
81
|
-
/**
|
|
82
|
-
* Fires each time the Editor is about to insert pasted content.
|
|
83
|
-
* Useful for modifying pasted content.
|
|
84
|
-
*/
|
|
85
|
-
onPasteHtml?: (event: {
|
|
86
|
-
target: Editor;
|
|
87
|
-
pastedHtml: string;
|
|
88
|
-
nativeEvent: ClipboardEvent;
|
|
89
|
-
}) => string | void;
|
|
90
|
-
/**
|
|
91
|
-
* Fires each time the Editor is about to apply a transaction.
|
|
92
|
-
* To prevent the transaction, return `false`.
|
|
93
|
-
*/
|
|
94
|
-
onExecute?: (event: {
|
|
95
|
-
target: Editor;
|
|
96
|
-
transaction: Transaction;
|
|
97
|
-
state: EditorState;
|
|
98
|
-
}) => boolean | void;
|
|
99
|
-
/**
|
|
100
|
-
* Fires when the Editor's content element has received focus.
|
|
101
|
-
*/
|
|
102
|
-
onFocus?: (event: {
|
|
103
|
-
target: Editor;
|
|
104
|
-
nativeEvent: any;
|
|
105
|
-
}) => void;
|
|
106
|
-
/**
|
|
107
|
-
* Fires when the Editor's content element has lost focus.
|
|
108
|
-
*/
|
|
109
|
-
onBlur?: (event: {
|
|
110
|
-
target: Editor;
|
|
111
|
-
nativeEvent: any;
|
|
112
|
-
}) => void;
|
|
113
|
-
/**
|
|
114
|
-
* Fires each time the value of the Editor is about to change.
|
|
115
|
-
*/
|
|
116
|
-
onChange?: (event: EditorChangeEvent) => void;
|
|
117
|
-
/**
|
|
118
|
-
* The value of the Editor.
|
|
119
|
-
*/
|
|
120
|
-
value?: Node | string;
|
|
121
|
-
/**
|
|
122
|
-
* If set to `false`, it will turn off the built-in keyboard navigation of the Editor's Toolbar.
|
|
123
|
-
*/
|
|
124
|
-
keyboardNavigation?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Defines the options that will be used for parsing the HTML.
|
|
127
|
-
* If `false` is set, the whitespace is collapsed as per HTML's rules.
|
|
128
|
-
* Pass `true` to preserve whitespace, but normalize newlines to spaces.
|
|
129
|
-
* `full` will preserve whitespace entirely.
|
|
130
|
-
*
|
|
131
|
-
* Defaults to `full`.
|
|
132
|
-
*/
|
|
133
|
-
preserveWhitespace?: boolean | 'full';
|
|
134
|
-
}
|
|
4
|
+
import { EditorView, Node } from '@progress/kendo-editor-common';
|
|
5
|
+
import { EditorProps } from './EditorProps';
|
|
135
6
|
/**
|
|
136
7
|
* @hidden
|
|
137
8
|
*/
|
|
@@ -202,6 +73,7 @@ export default class Editor extends React.Component<EditorProps, EditorStateInte
|
|
|
202
73
|
*/
|
|
203
74
|
readonly view: EditorView<any>;
|
|
204
75
|
private _element;
|
|
76
|
+
private _view?;
|
|
205
77
|
private _contentElement;
|
|
206
78
|
private iframe;
|
|
207
79
|
private trOnChange;
|
|
@@ -232,6 +104,7 @@ export default class Editor extends React.Component<EditorProps, EditorStateInte
|
|
|
232
104
|
private renderTool;
|
|
233
105
|
private updateTools;
|
|
234
106
|
private initialize;
|
|
107
|
+
private filterTransaction;
|
|
235
108
|
private onPasteHtml;
|
|
236
109
|
private dispatchTransaction;
|
|
237
110
|
private onFocus;
|
package/dist/npm/Editor.js
CHANGED
|
@@ -76,30 +76,36 @@ var Editor = /** @class */ (function (_super) {
|
|
|
76
76
|
* @hidden
|
|
77
77
|
*/
|
|
78
78
|
_this.focus = function () {
|
|
79
|
-
if (_this.
|
|
80
|
-
_this.
|
|
79
|
+
if (_this.view) {
|
|
80
|
+
_this.view.focus();
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
_this.renderDialog = function (Component, settings, stateFlag) {
|
|
84
|
-
return _this.state[stateFlag] && (React.createElement(Component, { view: _this.
|
|
84
|
+
return _this.state[stateFlag] && (React.createElement(Component, { view: _this.view, settings: settings, dir: _this.props.dir, onClose: function () {
|
|
85
85
|
var _a;
|
|
86
86
|
return _this.setState((_a = {}, _a[stateFlag] = false, _a));
|
|
87
87
|
} }));
|
|
88
88
|
};
|
|
89
89
|
_this.renderTool = function (Tool, index) {
|
|
90
|
-
var tool = (React.createElement(Tool, { view: _this.
|
|
90
|
+
var tool = (React.createElement(Tool, { view: _this.view, dir: _this.props.dir, key: index }));
|
|
91
91
|
return tool.type === kendo_react_buttons_1.ToolbarSeparator ? React.createElement(Tool, { key: index }) : tool;
|
|
92
92
|
};
|
|
93
93
|
_this.updateTools = function (view, _prevViewState) {
|
|
94
94
|
_this.setState({ view: view });
|
|
95
95
|
};
|
|
96
|
+
_this.filterTransaction = function (transaction, state) {
|
|
97
|
+
var event = { target: _this, transaction: transaction, state: state };
|
|
98
|
+
return (_this.props.onExecute &&
|
|
99
|
+
_this.props.onExecute.call(undefined, event)) !== false;
|
|
100
|
+
};
|
|
96
101
|
_this.onPasteHtml = function (html) {
|
|
97
|
-
if (_this.props.onPasteHtml) {
|
|
98
|
-
var
|
|
102
|
+
if (_this.props.onPasteHtml && _this.pasteEvent) {
|
|
103
|
+
var event_1 = {
|
|
99
104
|
target: _this,
|
|
100
105
|
pastedHtml: html,
|
|
101
106
|
nativeEvent: _this.pasteEvent
|
|
102
|
-
}
|
|
107
|
+
};
|
|
108
|
+
var newHtml = _this.props.onPasteHtml.call(undefined, event_1);
|
|
103
109
|
_this.pasteEvent = undefined;
|
|
104
110
|
if (typeof newHtml === 'string') {
|
|
105
111
|
return newHtml;
|
|
@@ -113,7 +119,7 @@ var Editor = /** @class */ (function (_super) {
|
|
|
113
119
|
_this.trOnChange = transaction;
|
|
114
120
|
var doc_1 = transaction.doc, schema_2 = transaction.doc.type.schema;
|
|
115
121
|
var target_1 = _this;
|
|
116
|
-
|
|
122
|
+
var event_2 = {
|
|
117
123
|
target: target_1,
|
|
118
124
|
value: doc_1,
|
|
119
125
|
get html() {
|
|
@@ -122,7 +128,8 @@ var Editor = /** @class */ (function (_super) {
|
|
|
122
128
|
},
|
|
123
129
|
transaction: transaction,
|
|
124
130
|
schema: schema_2
|
|
125
|
-
}
|
|
131
|
+
};
|
|
132
|
+
_this.props.onChange.call(undefined, event_2);
|
|
126
133
|
}
|
|
127
134
|
if (_this.view && (_this.props.value === undefined || !docChanged)) {
|
|
128
135
|
_this.view.updateState(_this.view.state.apply(transaction));
|
|
@@ -130,13 +137,21 @@ var Editor = /** @class */ (function (_super) {
|
|
|
130
137
|
};
|
|
131
138
|
_this.onFocus = function (_view, nativeEvent) {
|
|
132
139
|
if (_this.props.onFocus) {
|
|
133
|
-
|
|
140
|
+
var event_3 = {
|
|
141
|
+
target: _this,
|
|
142
|
+
nativeEvent: nativeEvent
|
|
143
|
+
};
|
|
144
|
+
_this.props.onFocus.call(undefined, event_3);
|
|
134
145
|
}
|
|
135
146
|
return false;
|
|
136
147
|
};
|
|
137
148
|
_this.onBlur = function (_view, nativeEvent) {
|
|
138
149
|
if (_this.props.onBlur) {
|
|
139
|
-
|
|
150
|
+
var event_4 = {
|
|
151
|
+
target: _this,
|
|
152
|
+
nativeEvent: nativeEvent
|
|
153
|
+
};
|
|
154
|
+
_this.props.onBlur.call(undefined, event_4);
|
|
140
155
|
}
|
|
141
156
|
return false;
|
|
142
157
|
};
|
|
@@ -201,7 +216,7 @@ var Editor = /** @class */ (function (_super) {
|
|
|
201
216
|
* Returns the `view` object of the Editor.
|
|
202
217
|
*/
|
|
203
218
|
get: function () {
|
|
204
|
-
return this.
|
|
219
|
+
return this._view;
|
|
205
220
|
},
|
|
206
221
|
enumerable: true,
|
|
207
222
|
configurable: true
|
|
@@ -231,9 +246,10 @@ var Editor = /** @class */ (function (_super) {
|
|
|
231
246
|
* @hidden
|
|
232
247
|
*/
|
|
233
248
|
Editor.prototype.componentWillUnmount = function () {
|
|
234
|
-
if (this.
|
|
235
|
-
this.
|
|
249
|
+
if (this.view) {
|
|
250
|
+
this.view.destroy();
|
|
236
251
|
}
|
|
252
|
+
this._view = undefined;
|
|
237
253
|
};
|
|
238
254
|
/**
|
|
239
255
|
* @hidden
|
|
@@ -298,10 +314,7 @@ var Editor = /** @class */ (function (_super) {
|
|
|
298
314
|
key: new kendo_editor_common_1.PluginKey('toolbar-tools-update-plugin')
|
|
299
315
|
}),
|
|
300
316
|
new kendo_editor_common_1.Plugin({
|
|
301
|
-
filterTransaction:
|
|
302
|
-
return (_this.props.onExecute &&
|
|
303
|
-
_this.props.onExecute.call(undefined, { target: target, transaction: transaction, state: state })) !== false;
|
|
304
|
-
},
|
|
317
|
+
filterTransaction: this.filterTransaction,
|
|
305
318
|
key: new kendo_editor_common_1.PluginKey('onExecute-event-plugin')
|
|
306
319
|
}),
|
|
307
320
|
new kendo_editor_common_1.Plugin({
|
|
@@ -321,7 +334,8 @@ var Editor = /** @class */ (function (_super) {
|
|
|
321
334
|
types: { listItem: 'list_item', hardBreak: 'hard_break' },
|
|
322
335
|
toolsSettings: { bold: bold, italic: italic, underline: underline }
|
|
323
336
|
}), { 'Mod-k': function () {
|
|
324
|
-
var
|
|
337
|
+
var linkDialog = _this.state.linkDialog;
|
|
338
|
+
var editorView = _this.view;
|
|
325
339
|
if (editorView) {
|
|
326
340
|
var editorState = editorView.state;
|
|
327
341
|
var collapsed = editorState.selection.empty;
|
|
@@ -335,7 +349,7 @@ var Editor = /** @class */ (function (_super) {
|
|
|
335
349
|
} });
|
|
336
350
|
var _b = this.props, _c = _b.defaultContent, defaultContent = _c === void 0 ? '' : _c, value = _b.value, onMount = _b.onMount;
|
|
337
351
|
var doc = (value && typeof value !== 'string') ? value :
|
|
338
|
-
utils_1.EditorUtils.createDocument(new kendo_editor_common_1.Schema({ nodes: schema_1.nodes, marks: schema_1.marks }),
|
|
352
|
+
utils_1.EditorUtils.createDocument(new kendo_editor_common_1.Schema({ nodes: schema_1.nodes, marks: schema_1.marks }), value || defaultContent, { preserveWhitespace: preserveWhitespace });
|
|
339
353
|
var viewProps = {
|
|
340
354
|
state: kendo_editor_common_1.EditorState.create({
|
|
341
355
|
plugins: plugins.concat([kendo_editor_common_1.keymap(shortcuts), kendo_editor_common_1.keymap(kendo_editor_common_1.baseKeymap)]),
|
|
@@ -349,8 +363,8 @@ var Editor = /** @class */ (function (_super) {
|
|
|
349
363
|
paste: this.onPaste
|
|
350
364
|
}
|
|
351
365
|
};
|
|
352
|
-
var
|
|
353
|
-
|
|
366
|
+
var mountEvent = { plugins: plugins, shortcuts: shortcuts, target: target, viewProps: viewProps, dom: dom };
|
|
367
|
+
var view = this._view = (onMount && onMount.call(undefined, mountEvent)) || new kendo_editor_common_1.EditorView({ mount: dom }, viewProps);
|
|
354
368
|
this.setState({
|
|
355
369
|
view: view
|
|
356
370
|
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/// <reference types="prosemirror-model" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { EditorState, Plugin, Transaction, EditorView, Schema, Node } from '@progress/kendo-editor-common';
|
|
4
|
+
import { EditorUtils } from './utils';
|
|
5
|
+
import Editor from './Editor';
|
|
6
|
+
interface EditorEvent {
|
|
7
|
+
/**
|
|
8
|
+
* An event target.
|
|
9
|
+
*/
|
|
10
|
+
target: Editor;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents the object of the `onChange` Editor event.
|
|
14
|
+
*/
|
|
15
|
+
export interface EditorChangeEvent extends EditorEvent {
|
|
16
|
+
/**
|
|
17
|
+
* Represents the [Editor document](https://prosemirror.net/docs/guide/#doc).
|
|
18
|
+
*/
|
|
19
|
+
value: Node;
|
|
20
|
+
/**
|
|
21
|
+
* A getter of the Editor HTML content.
|
|
22
|
+
* Once called, it will convert the Editor document into HTML string.
|
|
23
|
+
* Note that, since onChange event is triggered on every key while typing,
|
|
24
|
+
* this conversion may not be suitable if the Editor is dealing with large amount of content.
|
|
25
|
+
*/
|
|
26
|
+
html: string;
|
|
27
|
+
/**
|
|
28
|
+
* The Editor Schema object.
|
|
29
|
+
*/
|
|
30
|
+
schema: Schema;
|
|
31
|
+
/**
|
|
32
|
+
* The Transaction which causes the change.
|
|
33
|
+
*/
|
|
34
|
+
transaction: Transaction;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Represents the object of the `onMount` Editor event.
|
|
38
|
+
*/
|
|
39
|
+
export interface EditorMountEvent extends EditorEvent {
|
|
40
|
+
/**
|
|
41
|
+
* The content-editable DOM element of the Editor.
|
|
42
|
+
*/
|
|
43
|
+
dom: HTMLDivElement;
|
|
44
|
+
/**
|
|
45
|
+
* The default plugins collection of the Editor.
|
|
46
|
+
*/
|
|
47
|
+
plugins: Array<Plugin>;
|
|
48
|
+
/**
|
|
49
|
+
* The default key bindings of the Editor.
|
|
50
|
+
*/
|
|
51
|
+
shortcuts: EditorUtils.Shortcuts;
|
|
52
|
+
/**
|
|
53
|
+
* The default [viewProps](https://prosemirror.net/docs/ref/#view.DirectEditorProps) object of the Editor.
|
|
54
|
+
*/
|
|
55
|
+
viewProps: {
|
|
56
|
+
state: EditorState;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Represents the object of the `onPaste` Editor event.
|
|
62
|
+
*/
|
|
63
|
+
export interface EditorPasteEvent extends EditorEvent {
|
|
64
|
+
/**
|
|
65
|
+
* The HTML that will be pasted in the Editor.
|
|
66
|
+
*/
|
|
67
|
+
pastedHtml: string;
|
|
68
|
+
/**
|
|
69
|
+
* The native paste event.
|
|
70
|
+
*/
|
|
71
|
+
nativeEvent: ClipboardEvent;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Represents the object of the `onExecute` Editor event.
|
|
75
|
+
*/
|
|
76
|
+
export interface EditorExecuteEvent extends EditorEvent {
|
|
77
|
+
/**
|
|
78
|
+
* The transaction that will be executed.
|
|
79
|
+
*/
|
|
80
|
+
transaction: Transaction;
|
|
81
|
+
/**
|
|
82
|
+
* The state of the Editor.
|
|
83
|
+
*/
|
|
84
|
+
state: EditorState;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Represents the object of the `onFocus` Editor event.
|
|
88
|
+
*/
|
|
89
|
+
export interface EditorFocusEvent extends EditorEvent {
|
|
90
|
+
/**
|
|
91
|
+
* The native focus event.
|
|
92
|
+
*/
|
|
93
|
+
nativeEvent: FocusEvent;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Represents the object of the `onBlur` Editor event.
|
|
97
|
+
*/
|
|
98
|
+
export interface EditorBlurEvent extends EditorEvent {
|
|
99
|
+
/**
|
|
100
|
+
* The native blur event.
|
|
101
|
+
*/
|
|
102
|
+
nativeEvent: FocusEvent;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Represents the props of the [KendoReact Editor component]({% slug overview_editor %}).
|
|
106
|
+
*/
|
|
107
|
+
export interface EditorProps {
|
|
108
|
+
/**
|
|
109
|
+
* Sets the default HTML content of the Editor.
|
|
110
|
+
*/
|
|
111
|
+
defaultContent?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Sets the initial edit mode of the Editor. Defaults to `iframe`.
|
|
114
|
+
*/
|
|
115
|
+
defaultEditMode?: 'iframe' | 'div';
|
|
116
|
+
/**
|
|
117
|
+
* Sets styles to the content element wrapper of the Editor.
|
|
118
|
+
*/
|
|
119
|
+
contentStyle?: React.CSSProperties;
|
|
120
|
+
/**
|
|
121
|
+
* Represents the `dir` HTML attribute.
|
|
122
|
+
*/
|
|
123
|
+
dir?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Sets additional classes to the Editor.
|
|
126
|
+
*/
|
|
127
|
+
className?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Sets styles to the Editor.
|
|
130
|
+
*/
|
|
131
|
+
style?: React.CSSProperties;
|
|
132
|
+
/**
|
|
133
|
+
* Sets the tools of the Editor. By default, the Editor renders no tools.
|
|
134
|
+
*/
|
|
135
|
+
tools?: Array<any>;
|
|
136
|
+
/**
|
|
137
|
+
* Fires each time the Editor is about to mount.
|
|
138
|
+
* Useful for configuring the `EditorView` object.
|
|
139
|
+
* To initialize `EditorView`, use the properties of the `event` object.
|
|
140
|
+
*/
|
|
141
|
+
onMount?: (event: EditorMountEvent) => EditorView | void;
|
|
142
|
+
/**
|
|
143
|
+
* Fires each time the Editor is about to insert pasted content.
|
|
144
|
+
* Useful for modifying pasted content.
|
|
145
|
+
*/
|
|
146
|
+
onPasteHtml?: (event: EditorPasteEvent) => string | void;
|
|
147
|
+
/**
|
|
148
|
+
* Fires each time the Editor is about to apply a transaction.
|
|
149
|
+
* To prevent the transaction, return `false`.
|
|
150
|
+
*/
|
|
151
|
+
onExecute?: (event: EditorExecuteEvent) => boolean | void;
|
|
152
|
+
/**
|
|
153
|
+
* Fires when the Editor's content element has received focus.
|
|
154
|
+
*/
|
|
155
|
+
onFocus?: (event: EditorFocusEvent) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Fires when the Editor's content element has lost focus.
|
|
158
|
+
*/
|
|
159
|
+
onBlur?: (event: EditorBlurEvent) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Fires each time the value of the Editor is about to change.
|
|
162
|
+
*/
|
|
163
|
+
onChange?: (event: EditorChangeEvent) => void;
|
|
164
|
+
/**
|
|
165
|
+
* The value of the Editor.
|
|
166
|
+
*/
|
|
167
|
+
value?: Node | string;
|
|
168
|
+
/**
|
|
169
|
+
* If set to `false`, it will turn off the built-in keyboard navigation of the Editor's Toolbar.
|
|
170
|
+
*/
|
|
171
|
+
keyboardNavigation?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Defines the options that will be used for parsing the HTML.
|
|
174
|
+
* If `false` is set, the whitespace is collapsed as per HTML's rules.
|
|
175
|
+
* Pass `true` to preserve whitespace, but normalize newlines to spaces.
|
|
176
|
+
* `full` will preserve whitespace entirely.
|
|
177
|
+
*
|
|
178
|
+
* Defaults to `full`.
|
|
179
|
+
*/
|
|
180
|
+
preserveWhitespace?: boolean | 'full';
|
|
181
|
+
}
|
|
182
|
+
export {};
|
package/dist/npm/main.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="prosemirror-model" />
|
|
2
|
-
import Editor
|
|
2
|
+
import Editor from './Editor';
|
|
3
|
+
import { EditorProps, EditorMountEvent, EditorPasteEvent, EditorChangeEvent, EditorExecuteEvent, EditorFocusEvent, EditorBlurEvent } from './EditorProps';
|
|
3
4
|
import { EditorTools } from './tools/main';
|
|
4
5
|
import { EditorToolsSettings } from './config/toolsSettings';
|
|
5
6
|
import { EditorUtils } from './utils';
|
|
6
7
|
import { EditorDialogs } from './dialogs/main';
|
|
7
8
|
import { Selection, SelectionRange, TextSelection, NodeSelection, AllSelection, EditorState, Plugin, PluginKey, Transaction, Decoration, DecorationSet, EditorView, Node, ResolvedPos, NodeRange, Fragment, Slice, ReplaceError, Mark, Schema, NodeType, MarkType, ContentMatch, DOMParser, DOMSerializer, Transform, Step, StepResult, joinPoint, canJoin, canSplit, insertPoint, dropPoint, liftTarget, findWrapping, StepMap, MapResult, Mapping, AddMarkStep, RemoveMarkStep, ReplaceStep, ReplaceAroundStep, replaceStep, deleteSelection, joinBackward, selectNodeBackward, joinForward, selectNodeForward, joinUp, joinDown, lift, newlineInCode, exitCode, createParagraphNear, liftEmptyBlock, splitBlock, splitBlockKeepMarks, selectParentNode, selectAll, wrapIn, setBlockType, toggleMark, autoJoin, chainCommands, history, undo, redo, undoDepth, redoDepth, InputRule, inputRules, undoInputRule, wrappingInputRule, textblockTypeInputRule, keymap, keydownHandler, addListNodes, wrapInList, splitListItem, liftListItem, sinkListItem, dropCursor, gapCursor, tableEditing, fixTables, cellAround, isInTable, selectionCell, moveCellForward, inSameTable, findCell, colCount, nextCell, removeColSpan, addColSpan, columnIsHeader, tableNodes, tableNodeTypes, CellSelection, TableMap, columnResizing, updateColumnsOnResize, selectedRect, addColumn, addColumnBefore, addColumnAfter, deleteColumn, rowIsHeader, addRow, addRowBefore, addRowAfter, deleteRow, mergeCells, splitCell, splitCellWithType, setCellAttr, toggleHeader, toggleHeaderRow, toggleHeaderColumn, toggleHeaderCell, goToNextCell, deleteTable } from '@progress/kendo-editor-common';
|
|
8
9
|
export { PasteCleanupSettings } from './config/pasteSettings';
|
|
9
|
-
export { EditorChangeEvent } from './Editor';
|
|
10
10
|
/**
|
|
11
11
|
* An object containing the content of ProseMirror packages used at the Editor component.
|
|
12
12
|
*
|
|
@@ -163,4 +163,4 @@ export declare const ProseMirror: {
|
|
|
163
163
|
goToNextCell: typeof goToNextCell;
|
|
164
164
|
deleteTable: typeof deleteTable;
|
|
165
165
|
};
|
|
166
|
-
export { Editor, EditorProps, EditorTools, EditorToolsSettings, EditorUtils, EditorDialogs };
|
|
166
|
+
export { Editor, EditorProps, EditorMountEvent, EditorPasteEvent, EditorChangeEvent, EditorExecuteEvent, EditorFocusEvent, EditorBlurEvent, EditorTools, EditorToolsSettings, EditorUtils, EditorDialogs };
|
|
@@ -7,7 +7,7 @@ exports.packageMetadata = {
|
|
|
7
7
|
name: '@progress/kendo-react-editor',
|
|
8
8
|
productName: 'KendoReact',
|
|
9
9
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
10
|
-
publishDate:
|
|
10
|
+
publishDate: 1633425702,
|
|
11
11
|
version: '',
|
|
12
12
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
13
13
|
};
|
package/dist/npm/utils/index.js
CHANGED
|
@@ -95,7 +95,7 @@ var EditorUtils;
|
|
|
95
95
|
* @returns {Node} - The `document` object of the Editor.
|
|
96
96
|
*/
|
|
97
97
|
function createDocument(schema, html, parseOptions) {
|
|
98
|
-
return kendo_editor_common_1.parseContent(html, schema, parseOptions !== undefined ? parseOptions : { preserveWhitespace: 'full' });
|
|
98
|
+
return kendo_editor_common_1.parseContent(kendo_editor_common_1.trimWhitespace(html), schema, parseOptions !== undefined ? parseOptions : { preserveWhitespace: 'full' });
|
|
99
99
|
}
|
|
100
100
|
EditorUtils.createDocument = createDocument;
|
|
101
101
|
/**
|