@progress/kendo-react-editor 5.5.0-dev.202206271315 → 5.5.0

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="prosemirror-model" />
2
1
  import * as React from 'react';
3
2
  import * as PropTypes from 'prop-types';
4
3
  import { EditorView, Node } from '@progress/kendo-editor-common';
@@ -72,7 +71,7 @@ export declare class Editor extends React.Component<EditorProps, EditorStateInte
72
71
  /**
73
72
  * Returns the `view` object of the Editor.
74
73
  */
75
- get view(): EditorView<any> | undefined;
74
+ get view(): EditorView | undefined;
76
75
  private _element;
77
76
  private _view?;
78
77
  private _contentElement;
@@ -1,4 +1,3 @@
1
- /// <reference types="prosemirror-model" />
2
1
  /// <reference types="react" />
3
2
  import { EditorState, Plugin, Transaction, EditorView, Schema, Node } from '@progress/kendo-editor-common';
4
3
  import { EditorUtils } from './utils';
@@ -3,8 +3,8 @@ import { EditorToolsSettings } from './../config/toolsSettings';
3
3
  import { TextSelection, EditorView } from '@progress/kendo-editor-common';
4
4
  interface FindAndReplaceDialogState {
5
5
  selectedTab: number;
6
- matches?: TextSelection<any>[];
7
- nextMatch?: TextSelection<any>;
6
+ matches?: TextSelection[];
7
+ nextMatch?: TextSelection;
8
8
  searchText: string;
9
9
  replaceText: string;
10
10
  matchCase: boolean;
@@ -102,7 +102,10 @@ var FindAndReplaceDialog = /** @class */ (function (_super) {
102
102
  var view = _this.props.view;
103
103
  var _a = _this.state, searchText = _a.searchText, replaceText = _a.replaceText, matchCase = _a.matchCase, matchWord = _a.matchWord, useRegExp = _a.useRegExp;
104
104
  var searchOptions = { text: searchText, matchWord: matchWord, matchCase: matchCase, useRegExp: useRegExp };
105
- view.dispatch(replaceAll(view.state, replaceText, searchOptions));
105
+ var tr = replaceAll(view.state, replaceText, searchOptions);
106
+ if (tr) {
107
+ view.dispatch(tr);
108
+ }
106
109
  _this.setNextState({});
107
110
  };
108
111
  _this.onKeyDown = function (event) {
@@ -62,8 +62,10 @@ var InsertImageDialog = /** @class */ (function (_super) {
62
62
  return Object.assign(acc, (_a = {}, _a[curr] = data[curr], _a));
63
63
  }, {});
64
64
  var newImage = nodeType.createAndFill(attrs);
65
- var insertImageCmd = insertNode(newImage, true);
66
- insertImageCmd(view.state, function (tr) { return view.dispatch(tr.setMeta('commandName', settings.commandName).setMeta('args', attrs)); });
65
+ if (newImage) {
66
+ var insertImageCmd = insertNode(newImage, true);
67
+ insertImageCmd(view.state, function (tr) { return view.dispatch(tr.setMeta('commandName', settings.commandName).setMeta('args', attrs)); });
68
+ }
67
69
  _this.onClose();
68
70
  };
69
71
  return _this;
package/dist/es/main.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- /// <reference types="prosemirror-model" />
2
1
  import { Editor } from './Editor';
3
2
  import { EditorProps, EditorMountEvent, EditorPasteEvent, EditorChangeEvent, EditorExecuteEvent, EditorFocusEvent, EditorBlurEvent } from './EditorProps';
4
3
  import { EditorTools } from './tools/main';
5
4
  import { EditorToolsSettings } from './config/toolsSettings';
6
5
  import { EditorUtils } from './utils';
7
6
  import { EditorDialogs } from './dialogs/main';
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, deleteRow, mergeCells, splitCell, splitCellWithType, setCellAttr, toggleHeader, toggleHeaderRow, toggleHeaderColumn, toggleHeaderCell, goToNextCell, deleteTable } from '@progress/kendo-editor-common';
7
+ import { Selection, SelectionRange, TextSelection, NodeSelection, AllSelection, EditorState, Plugin, PluginKey, Transaction, Decoration, DecorationSet, EditorView, Node, ResolvedPos, NodeRange, Fragment, Slice, ReplaceError, Mark, MarkSpec, Schema, NodeType, NodeSpec, MarkType, ContentMatch, DOMParser, DOMSerializer, Transform, Step, StepResult, joinPoint, canJoin, canSplit, insertPoint, dropPoint, liftTarget, findWrapping, StepMap, MapResult, Mapping, AddMarkStep, RemoveMarkStep, ReplaceStep, ReplaceAroundStep, replaceStep, wrapIn, setBlockType, toggleMark, autoJoin, chainCommands, history, undoDepth, redoDepth, InputRule, inputRules, 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, deleteRow, mergeCells, splitCell, splitCellWithType, setCellAttr, toggleHeader, toggleHeaderRow, toggleHeaderColumn, toggleHeaderCell, goToNextCell, deleteTable } from '@progress/kendo-editor-common';
9
8
  export { Shortcuts } from './config/shortcuts';
10
9
  export { PasteCleanupSettings } from './config/pasteSettings';
11
10
  /**
@@ -68,52 +67,58 @@ export declare const ProseMirror: {
68
67
  ReplaceStep: typeof ReplaceStep;
69
68
  ReplaceAroundStep: typeof ReplaceAroundStep;
70
69
  replaceStep: typeof replaceStep;
71
- deleteSelection: typeof deleteSelection;
72
- joinBackward: typeof joinBackward;
73
- selectNodeBackward: typeof selectNodeBackward;
74
- joinForward: typeof joinForward;
75
- selectNodeForward: typeof selectNodeForward;
76
- joinUp: typeof joinUp;
77
- joinDown: typeof joinDown;
78
- lift: typeof lift;
79
- newlineInCode: typeof newlineInCode;
80
- exitCode: typeof exitCode;
81
- createParagraphNear: typeof createParagraphNear;
82
- liftEmptyBlock: typeof liftEmptyBlock;
83
- splitBlock: typeof splitBlock;
84
- splitBlockKeepMarks: typeof splitBlockKeepMarks;
85
- selectParentNode: typeof selectParentNode;
86
- selectAll: typeof selectAll;
70
+ deleteSelection: import("prosemirror-state").Command;
71
+ joinBackward: import("prosemirror-state").Command;
72
+ selectNodeBackward: import("prosemirror-state").Command;
73
+ joinForward: import("prosemirror-state").Command;
74
+ selectNodeForward: import("prosemirror-state").Command;
75
+ joinUp: import("prosemirror-state").Command;
76
+ joinDown: import("prosemirror-state").Command;
77
+ lift: import("prosemirror-state").Command;
78
+ newlineInCode: import("prosemirror-state").Command;
79
+ exitCode: import("prosemirror-state").Command;
80
+ createParagraphNear: import("prosemirror-state").Command;
81
+ liftEmptyBlock: import("prosemirror-state").Command;
82
+ splitBlock: import("prosemirror-state").Command;
83
+ splitBlockKeepMarks: import("prosemirror-state").Command;
84
+ selectParentNode: import("prosemirror-state").Command;
85
+ selectAll: import("prosemirror-state").Command;
87
86
  wrapIn: typeof wrapIn;
88
87
  setBlockType: typeof setBlockType;
89
88
  toggleMark: typeof toggleMark;
90
89
  autoJoin: typeof autoJoin;
91
90
  chainCommands: typeof chainCommands;
92
- pcBaseKeymap: import("prosemirror-commands").Keymap<any>;
93
- macBaseKeymap: import("prosemirror-commands").Keymap<any>;
94
- baseKeymap: import("prosemirror-commands").Keymap<any>;
91
+ pcBaseKeymap: {
92
+ [key: string]: import("prosemirror-state").Command;
93
+ };
94
+ macBaseKeymap: {
95
+ [key: string]: import("prosemirror-state").Command;
96
+ };
97
+ baseKeymap: {
98
+ [key: string]: import("prosemirror-state").Command;
99
+ };
95
100
  history: typeof history;
96
- undo: typeof undo;
97
- redo: typeof redo;
101
+ undo: import("prosemirror-state").Command;
102
+ redo: import("prosemirror-state").Command;
98
103
  undoDepth: typeof undoDepth;
99
104
  redoDepth: typeof redoDepth;
100
105
  InputRule: typeof InputRule;
101
106
  inputRules: typeof inputRules;
102
- undoInputRule: typeof undoInputRule;
103
- emDash: InputRule<any>;
104
- ellipsis: InputRule<any>;
105
- openDoubleQuote: InputRule<any>;
106
- closeDoubleQuote: InputRule<any>;
107
- openSingleQuote: InputRule<any>;
108
- closeSingleQuote: InputRule<any>;
109
- smartQuotes: InputRule<any>[];
107
+ undoInputRule: import("prosemirror-state").Command;
108
+ emDash: InputRule;
109
+ ellipsis: InputRule;
110
+ openDoubleQuote: InputRule;
111
+ closeDoubleQuote: InputRule;
112
+ openSingleQuote: InputRule;
113
+ closeSingleQuote: InputRule;
114
+ smartQuotes: readonly InputRule[];
110
115
  wrappingInputRule: typeof wrappingInputRule;
111
116
  textblockTypeInputRule: typeof textblockTypeInputRule;
112
117
  keymap: typeof keymap;
113
118
  keydownHandler: typeof keydownHandler;
114
- orderedList: import("prosemirror-model").NodeSpec;
115
- bulletList: import("prosemirror-model").NodeSpec;
116
- listItem: import("prosemirror-model").NodeSpec;
119
+ orderedList: NodeSpec;
120
+ bulletList: NodeSpec;
121
+ listItem: NodeSpec;
117
122
  addListNodes: typeof addListNodes;
118
123
  wrapInList: typeof wrapInList;
119
124
  splitListItem: typeof splitListItem;
@@ -123,7 +128,7 @@ export declare const ProseMirror: {
123
128
  gapCursor: typeof gapCursor;
124
129
  tableEditing: typeof tableEditing;
125
130
  fixTables: typeof fixTables;
126
- fixTablesKey: PluginKey<any, any>;
131
+ fixTablesKey: PluginKey<any>;
127
132
  cellAround: typeof cellAround;
128
133
  isInTable: typeof isInTable;
129
134
  selectionCell: typeof selectionCell;
@@ -139,9 +144,9 @@ export declare const ProseMirror: {
139
144
  tableNodeTypes: typeof tableNodeTypes;
140
145
  CellSelection: typeof CellSelection;
141
146
  TableMap: typeof TableMap;
142
- tableEditingKey: PluginKey<any, any>;
147
+ tableEditingKey: PluginKey<any>;
143
148
  columnResizing: typeof columnResizing;
144
- columnResizingPluginKey: PluginKey<any, any>;
149
+ columnResizingPluginKey: PluginKey<any>;
145
150
  updateColumnsOnResize: typeof updateColumnsOnResize;
146
151
  selectedRect: typeof selectedRect;
147
152
  addColumn: typeof addColumn;
@@ -150,8 +155,8 @@ export declare const ProseMirror: {
150
155
  deleteColumn: typeof deleteColumn;
151
156
  rowIsHeader: typeof rowIsHeader;
152
157
  addRow: typeof addRow;
153
- addRowBefore: (state: EditorState<any>, dispatch?: ((tr: Transaction<any>) => void) | undefined) => boolean;
154
- addRowAfter: (state: EditorState<any>, dispatch?: ((tr: Transaction<any>) => void) | undefined) => boolean;
158
+ addRowBefore: (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
159
+ addRowAfter: (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
155
160
  deleteRow: typeof deleteRow;
156
161
  mergeCells: typeof mergeCells;
157
162
  splitCell: typeof splitCell;
@@ -164,4 +169,4 @@ export declare const ProseMirror: {
164
169
  goToNextCell: typeof goToNextCell;
165
170
  deleteTable: typeof deleteTable;
166
171
  };
167
- export { Editor, EditorProps, EditorMountEvent, EditorPasteEvent, EditorChangeEvent, EditorExecuteEvent, EditorFocusEvent, EditorBlurEvent, EditorTools, EditorToolsSettings, EditorUtils, EditorDialogs };
172
+ export { Editor, EditorProps, EditorMountEvent, EditorPasteEvent, EditorChangeEvent, EditorExecuteEvent, EditorFocusEvent, EditorBlurEvent, EditorTools, EditorToolsSettings, EditorUtils, EditorDialogs, NodeSpec, MarkSpec };
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-editor',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1656334834,
8
+ publishDate: 1656667756,
9
9
  version: '',
10
10
  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'
11
11
  };
@@ -57,24 +57,25 @@ export var IndentToolNS;
57
57
  }
58
58
  IndentTool.prototype.render = function () {
59
59
  var _a = this.props, view = _a.view, render = _a.render, buttonProps = __rest(_a, ["view", "render"]);
60
+ var dir = buttonProps.dir;
60
61
  var state = view && view.state;
61
62
  var nodes = state && state.schema.nodes;
62
63
  var listItem = nodes && nodes[settings.listsTypes.listItem];
63
64
  var actions = settings.actions;
64
- var canIndented = !!state &&
65
- (isIndented(state, actions, buttonProps.dir) ||
66
- actions.some(function (a) { return nodes[a.node] && hasNode(state, nodes[a.node]); })) &&
65
+ var canIndented = !!state && !!listItem &&
66
+ (isIndented(state, actions, dir) ||
67
+ actions.some(function (a) { return nodes && nodes[a.node] && hasNode(state, nodes[a.node]); })) &&
67
68
  !hasNode(state, listItem);
68
69
  var canListIndent = !!state && canIndentAsListItem(state, listItem);
69
70
  var canIndent = canIndented || canListIndent;
70
71
  var localization = provideLocalizationService(this);
71
72
  var titleKey = settings.messages.title;
72
73
  var button = (React.createElement(Button, __assign({ onClick: function () {
73
- if (view && canListIndent) {
74
+ if (view && canListIndent && listItem) {
74
75
  sinkListItem(listItem)(view.state, view.dispatch);
75
76
  }
76
77
  else if (view && canIndented) {
77
- indentBlocks(actions, settings.commandName, buttonProps.dir)(view.state, view.dispatch);
78
+ indentBlocks(actions, settings.commandName, dir)(view.state, view.dispatch);
78
79
  }
79
80
  }, title: localization.toLanguageString(titleKey, messages[titleKey]), disabled: !canIndent }, onDownPreventDefault, settings.props, buttonProps)));
80
81
  return render ? render.call(undefined, button, { view: view }) : button;
@@ -74,7 +74,8 @@ export var InsertTableToolNS;
74
74
  if (!view) {
75
75
  return;
76
76
  }
77
- var newTable = createTable(view.state.schema.nodes, row, col);
77
+ var _a = view.state.schema.nodes, table = _a.table, table_row = _a.table_row, table_cell = _a.table_cell;
78
+ var newTable = createTable({ table: table, table_row: table_row, table_cell: table_cell }, row, col);
78
79
  if (newTable) {
79
80
  insertNode(newTable, true)(view.state, view.dispatch);
80
81
  }
@@ -58,18 +58,19 @@ export var OutdentToolNS;
58
58
  OutdentTool.prototype.render = function () {
59
59
  var _a = this.props, view = _a.view, render = _a.render, buttonProps = __rest(_a, ["view", "render"]);
60
60
  var state = view && view.state;
61
- var indented = !!state && isIndented(state, settings.actions, buttonProps.dir);
61
+ var dir = buttonProps.dir;
62
+ var indented = !!state && isIndented(state, settings.actions, dir);
62
63
  var listItem = state && state.schema.nodes[settings.listsTypes.listItem];
63
64
  var canListOutdent = !!state && canOutdentAsListItem(state, { nodes: settings.actions, listsTypes: settings.listsTypes });
64
65
  var canOutdent = indented || canListOutdent;
65
66
  var localization = provideLocalizationService(this);
66
67
  var titleKey = settings.messages.title;
67
68
  var button = (React.createElement(Button, __assign({ onClick: function () {
68
- if (view && canListOutdent) {
69
+ if (view && canListOutdent && listItem) {
69
70
  liftListItem(listItem)(view.state, view.dispatch);
70
71
  }
71
72
  else if (view && indented) {
72
- indentBlocks(settings.actions, settings.commandName, buttonProps.dir)(view.state, view.dispatch);
73
+ indentBlocks(settings.actions, settings.commandName, dir)(view.state, view.dispatch);
73
74
  }
74
75
  }, title: localization.toLanguageString(titleKey, messages[titleKey]), disabled: !canOutdent }, onDownPreventDefault, settings.props, buttonProps)));
75
76
  return render ? render.call(undefined, button, { view: view }) : button;
@@ -1,4 +1,3 @@
1
- /// <reference types="prosemirror-model" />
2
1
  import * as shortcuts from './../config/shortcuts';
3
2
  import { ImageResizeOptions as ImageResizeOptionsCommon, Schema, NodeSpec, MarkSpec, Node, NodeType, Mark, MarkType, ParseOptions, EditorView, EditorState, Transaction, Plugin, PluginKey } from '@progress/kendo-editor-common';
4
3
  import { EditorToolsSettings } from './../config/toolsSettings';
@@ -12,13 +11,13 @@ export declare namespace EditorUtils {
12
11
  *
13
12
  * @returns {boolean}&mdash;If alignment is applied to any of the elements, returns `true`.
14
13
  */
15
- function alignBlocks(view: EditorView<any>, actions: EditorToolsSettings.AlignAction[], command?: EditorToolsSettings.Command): boolean;
14
+ function alignBlocks(view: EditorView, actions: EditorToolsSettings.AlignAction[], command?: EditorToolsSettings.Command): boolean;
16
15
  /**
17
16
  * Wraps the selection in a `span` element with inline styles.
18
17
  *
19
18
  * @returns {boolean}&mdash;If a style is applied to any of the elements, returns `true`.
20
19
  */
21
- function applyInlineStyle(view: EditorView<any>, options: {
20
+ function applyInlineStyle(view: EditorView, options: {
22
21
  style: string;
23
22
  value: string;
24
23
  }, command?: EditorToolsSettings.Command): boolean;
@@ -36,7 +35,7 @@ export declare namespace EditorUtils {
36
35
  *
37
36
  * @returns {boolean}
38
37
  */
39
- function canIndentList(state: EditorState<any>, nodeType: NodeType<any>): boolean;
38
+ function canIndentList(state: EditorState, nodeType: NodeType): boolean;
40
39
  /**
41
40
  * Checks if a node can be inserted in the current selection.
42
41
  *
@@ -44,13 +43,13 @@ export declare namespace EditorUtils {
44
43
  * @param {NodeType} nodeType&mdash;The type of the node that will be inserted.
45
44
  * @returns {boolean}&mdash;The node of this type can be inserted in the current selection.
46
45
  */
47
- function canInsert(state: EditorState<any>, nodeType: NodeType<any>): boolean;
46
+ function canInsert(state: EditorState, nodeType: NodeType): boolean;
48
47
  /**
49
48
  * Checks if any of the `list` elements in the selection can be outdented.
50
49
  *
51
50
  * @returns {boolean}
52
51
  */
53
- function canOutdentList(state: EditorState<any>, listsTypes: {
52
+ function canOutdentList(state: EditorState, listsTypes: {
54
53
  listItem: string;
55
54
  orderedList: string;
56
55
  bulletList: string;
@@ -70,14 +69,14 @@ export declare namespace EditorUtils {
70
69
  * @param {ParseOptions} parseOptions&mdash;The HTML parsing options. Defaults to `{ preserveWhitespace: 'full' }`.
71
70
  * @returns {Node}&mdash;The `document` object of the Editor.
72
71
  */
73
- function createDocument(schema: Schema<any, any>, html: string, parseOptions?: ParseOptions<any>): Node<any>;
72
+ function createDocument(schema: Schema<any, any>, html: string, parseOptions?: ParseOptions): Node;
74
73
  /**
75
74
  * Creates a table.
76
75
  *
77
76
  * @param {object} tableTypes&mdash;An object which contains `table`, `table_row`, and `table_cell` node types.
78
77
  * @param {number} rows&mdash;The number of rows.
79
78
  * @param {number} columns&mdash;The number of columns.
80
- * @returns {Node<any>}&mdash;The generated table.
79
+ * @returns {Node}&mdash;The generated table.
81
80
  *
82
81
  * @example
83
82
  * ```jsx-no-run
@@ -91,22 +90,22 @@ export declare namespace EditorUtils {
91
90
  * ```
92
91
  */
93
92
  function createTable(tableTypes: {
94
- table: NodeType<any>;
95
- table_row: NodeType<any>;
96
- table_cell: NodeType<any>;
97
- }, rows: number, columns: number): Node<any>;
93
+ table: NodeType;
94
+ table_row: NodeType;
95
+ table_cell: NodeType;
96
+ }, rows: number, columns: number): Node;
98
97
  /**
99
98
  * Formats the paragraph and heading nodes in the selection.
100
99
  *
101
100
  * @returns {boolean}&mdash;If an element is formatted, returns `true`.
102
101
  */
103
- function formatBlockElements(view: EditorView<any>, value: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', commandName?: EditorToolsSettings.Command): boolean;
102
+ function formatBlockElements(view: EditorView, value: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', commandName?: EditorToolsSettings.Command): boolean;
104
103
  /**
105
104
  * Returns the paragraph and heading nodes in the selection.
106
105
  *
107
106
  * @returns {string[]}
108
107
  */
109
- function getBlockFormats(state: EditorState<any>): string[];
108
+ function getBlockFormats(state: EditorState): string[];
110
109
  /**
111
110
  * Gets the HTML from the `EditorState` object.
112
111
  *
@@ -114,41 +113,41 @@ export declare namespace EditorUtils {
114
113
  *&mdash;{ doc: value, schema: value.types.schema } where the `value` variable is the editor's value prop.
115
114
  * @returns {string}&mdash;The HTML content.
116
115
  */
117
- function getHtml(state: EditorState<any> | {
116
+ function getHtml(state: EditorState | {
118
117
  doc: Node;
119
118
  schema: Schema;
120
119
  }): string;
121
120
  /**
122
121
  * @returns {string[]}&mdash;An array of matched styles that are found in the selection.
123
122
  */
124
- function getInlineStyles(state: EditorState<any>, style: {
123
+ function getInlineStyles(state: EditorState, style: {
125
124
  name: string;
126
125
  value: RegExp;
127
126
  }): string[];
128
127
  /**
129
128
  * Returns a mark of the specified type from the nodes in selection.
130
129
  *
131
- * @returns {Mark<any>}
130
+ * @returns {Mark}
132
131
  */
133
- function getMark(state: EditorState<any>, markType: MarkType<any>): Mark<any>;
132
+ function getMark(state: EditorState, markType: MarkType): Mark | undefined;
134
133
  /**
135
134
  * Checks if according to the specified `InlineFormatOptions` a node in the selection is present.
136
135
  *
137
136
  * @returns {boolean}
138
137
  */
139
- function hasMark(state: EditorState<any>, options: EditorToolsSettings.InlineFormatOptions): boolean;
138
+ function hasMark(state: EditorState, options: EditorToolsSettings.InlineFormatOptions): boolean;
140
139
  /**
141
140
  * Checks if the selection contains a specific type of node.
142
141
  *
143
142
  * @returns {boolean}
144
143
  */
145
- function hasNode(state: EditorState<any>, nodeType: NodeType<any>): boolean;
144
+ function hasNode(state: EditorState, nodeType: NodeType): boolean;
146
145
  /**
147
146
  * Indents the block elements in the selection.
148
147
  *
149
148
  * @returns {boolean}&mdash;If indentation is applied to any of the elements, returns `true`.
150
149
  */
151
- function indentBlocks(view: EditorView<any>, actions: EditorToolsSettings.IndentAction[], command?: EditorToolsSettings.Command, dir?: string): boolean;
150
+ function indentBlocks(view: EditorView, actions: EditorToolsSettings.IndentAction[], command?: EditorToolsSettings.Command, dir?: string): boolean;
152
151
  /**
153
152
  * Adds new lines after block elements and hard breaks.
154
153
  *
@@ -164,16 +163,16 @@ export declare namespace EditorUtils {
164
163
  * @param {boolean} scrollIntoView&mdash;An optional parameter.
165
164
  * Defines if the content element will be scrolled to the current selection.
166
165
  */
167
- function insertNode(view: EditorView<any> | {
168
- state: EditorState<any>;
169
- dispatch: (tr: Transaction<any>) => void;
170
- }, node: Node<any>, scrollIntoView?: boolean | undefined): void;
166
+ function insertNode(view: EditorView | {
167
+ state: EditorState;
168
+ dispatch: (tr: Transaction) => void;
169
+ }, node: Node, scrollIntoView?: boolean | undefined): void;
171
170
  /**
172
171
  * Checks if any of the block elements in the selection is aligned.
173
172
  *
174
173
  * @returns {boolean}
175
174
  */
176
- function isAligned(state: EditorState<any>, actions: EditorToolsSettings.AlignAction[]): boolean;
175
+ function isAligned(state: EditorState, actions: EditorToolsSettings.AlignAction[]): boolean;
177
176
  /**
178
177
  * Checks if any of the block elements in the selection is indented.
179
178
  *
@@ -297,22 +296,22 @@ export declare namespace EditorUtils {
297
296
  * @param {ParseOptions} parseOptions&mdash;An optional parameter.
298
297
  * Defines the options that will be used for parsing the HTML. Defaults to `{ preserveWhitespace: 'full' }`.
299
298
  */
300
- function setHtml(view: EditorView<any>, html: string, command?: EditorToolsSettings.Command, parseOptions?: ParseOptions<any>): void;
299
+ function setHtml(view: EditorView, html: string, command?: EditorToolsSettings.Command, parseOptions?: ParseOptions): void;
301
300
  /**
302
301
  * Toggles the inline element formatting according to the `InlineFormatOptions` and `markAttrs` settings.
303
302
  *
304
303
  * @returns {boolean}
305
304
  */
306
305
  function toggleInlineFormat(view: {
307
- state: EditorState<any>;
308
- dispatch: (tr: Transaction<any>) => void;
309
- }, options: EditorToolsSettings.InlineFormatOptions, transaction?: Transaction<any>, markAttrs?: any): boolean;
306
+ state: EditorState;
307
+ dispatch: (tr: Transaction) => void;
308
+ }, options: EditorToolsSettings.InlineFormatOptions, transaction?: Transaction, markAttrs?: any): boolean;
310
309
  /**
311
310
  * Toggles a list of the specified type.
312
311
  *
313
312
  * @returns {boolean}
314
313
  */
315
- function toggleList(view: EditorView<any>, types: {
314
+ function toggleList(view: EditorView, types: {
316
315
  listType: string;
317
316
  orderedList: string;
318
317
  bulletList: string;
@@ -102,7 +102,7 @@ export var EditorUtils;
102
102
  * @param {object} tableTypes&mdash;An object which contains `table`, `table_row`, and `table_cell` node types.
103
103
  * @param {number} rows&mdash;The number of rows.
104
104
  * @param {number} columns&mdash;The number of columns.
105
- * @returns {Node<any>}&mdash;The generated table.
105
+ * @returns {Node}&mdash;The generated table.
106
106
  *
107
107
  * @example
108
108
  * ```jsx-no-run
@@ -158,7 +158,7 @@ export var EditorUtils;
158
158
  /**
159
159
  * Returns a mark of the specified type from the nodes in selection.
160
160
  *
161
- * @returns {Mark<any>}
161
+ * @returns {Mark}
162
162
  */
163
163
  function getMark(state, markType) {
164
164
  return getMarkCommon(state, markType);
@@ -2,4 +2,4 @@ import { PluginKey } from '@progress/kendo-editor-common';
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- export declare const editorPropsKey: PluginKey<any, any>;
5
+ export declare const editorPropsKey: PluginKey<any>;
@@ -1,4 +1,3 @@
1
- /// <reference types="prosemirror-model" />
2
1
  import * as React from 'react';
3
2
  import * as PropTypes from 'prop-types';
4
3
  import { EditorView, Node } from '@progress/kendo-editor-common';
@@ -72,7 +71,7 @@ export declare class Editor extends React.Component<EditorProps, EditorStateInte
72
71
  /**
73
72
  * Returns the `view` object of the Editor.
74
73
  */
75
- get view(): EditorView<any> | undefined;
74
+ get view(): EditorView | undefined;
76
75
  private _element;
77
76
  private _view?;
78
77
  private _contentElement;
@@ -1,4 +1,3 @@
1
- /// <reference types="prosemirror-model" />
2
1
  /// <reference types="react" />
3
2
  import { EditorState, Plugin, Transaction, EditorView, Schema, Node } from '@progress/kendo-editor-common';
4
3
  import { EditorUtils } from './utils';
@@ -3,8 +3,8 @@ import { EditorToolsSettings } from './../config/toolsSettings';
3
3
  import { TextSelection, EditorView } from '@progress/kendo-editor-common';
4
4
  interface FindAndReplaceDialogState {
5
5
  selectedTab: number;
6
- matches?: TextSelection<any>[];
7
- nextMatch?: TextSelection<any>;
6
+ matches?: TextSelection[];
7
+ nextMatch?: TextSelection;
8
8
  searchText: string;
9
9
  replaceText: string;
10
10
  matchCase: boolean;
@@ -105,7 +105,10 @@ var FindAndReplaceDialog = /** @class */ (function (_super) {
105
105
  var view = _this.props.view;
106
106
  var _a = _this.state, searchText = _a.searchText, replaceText = _a.replaceText, matchCase = _a.matchCase, matchWord = _a.matchWord, useRegExp = _a.useRegExp;
107
107
  var searchOptions = { text: searchText, matchWord: matchWord, matchCase: matchCase, useRegExp: useRegExp };
108
- view.dispatch((0, kendo_editor_common_1.replaceAll)(view.state, replaceText, searchOptions));
108
+ var tr = (0, kendo_editor_common_1.replaceAll)(view.state, replaceText, searchOptions);
109
+ if (tr) {
110
+ view.dispatch(tr);
111
+ }
109
112
  _this.setNextState({});
110
113
  };
111
114
  _this.onKeyDown = function (event) {
@@ -65,8 +65,10 @@ var InsertImageDialog = /** @class */ (function (_super) {
65
65
  return Object.assign(acc, (_a = {}, _a[curr] = data[curr], _a));
66
66
  }, {});
67
67
  var newImage = nodeType.createAndFill(attrs);
68
- var insertImageCmd = (0, kendo_editor_common_1.insertNode)(newImage, true);
69
- insertImageCmd(view.state, function (tr) { return view.dispatch(tr.setMeta('commandName', settings.commandName).setMeta('args', attrs)); });
68
+ if (newImage) {
69
+ var insertImageCmd = (0, kendo_editor_common_1.insertNode)(newImage, true);
70
+ insertImageCmd(view.state, function (tr) { return view.dispatch(tr.setMeta('commandName', settings.commandName).setMeta('args', attrs)); });
71
+ }
70
72
  _this.onClose();
71
73
  };
72
74
  return _this;