@syncfusion/ej2-richtexteditor 23.2.7 → 24.1.41-569421
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/.eslintrc.json +259 -259
- package/CHANGELOG.md +1953 -1749
- package/README.md +76 -76
- package/dist/ej2-richtexteditor.umd.min.js +1 -10
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +9971 -8025
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +8445 -6498
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/helpers/e2e/index.js +3 -3
- package/helpers/e2e/rte-helper.js +13 -13
- package/license +9 -9
- package/package.json +74 -74
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +12 -1
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/interface.d.ts +19 -7
- package/src/common/types.d.ts +6 -0
- package/src/common/util.d.ts +6 -0
- package/src/common/util.js +61 -20
- package/src/editor-manager/base/classes.d.ts +1 -1
- package/src/editor-manager/base/classes.js +1 -1
- package/src/editor-manager/base/constant.d.ts +6 -0
- package/src/editor-manager/base/constant.js +6 -0
- package/src/editor-manager/base/editor-manager.d.ts +8 -3
- package/src/editor-manager/base/editor-manager.js +62 -3
- package/src/editor-manager/base/enum.d.ts +2 -2
- package/src/editor-manager/base/interface.d.ts +17 -9
- package/src/editor-manager/base/types.d.ts +1 -1
- package/src/editor-manager/plugin/alignments.d.ts +2 -2
- package/src/editor-manager/plugin/alignments.js +2 -2
- package/src/editor-manager/plugin/audio.d.ts +3 -3
- package/src/editor-manager/plugin/audio.js +16 -6
- package/src/editor-manager/plugin/clearformat-exec.d.ts +2 -2
- package/src/editor-manager/plugin/clearformat-exec.js +2 -2
- package/src/editor-manager/plugin/clearformat.d.ts +1 -1
- package/src/editor-manager/plugin/clearformat.js +1 -1
- package/src/editor-manager/plugin/dom-node.d.ts +39 -35
- package/src/editor-manager/plugin/dom-node.js +203 -62
- package/src/editor-manager/plugin/format-painter-actions.d.ts +2 -1
- package/src/editor-manager/plugin/format-painter-actions.js +20 -2
- package/src/editor-manager/plugin/formats.d.ts +3 -2
- package/src/editor-manager/plugin/formats.js +40 -5
- package/src/editor-manager/plugin/image.d.ts +3 -3
- package/src/editor-manager/plugin/image.js +41 -18
- package/src/editor-manager/plugin/indents.d.ts +2 -2
- package/src/editor-manager/plugin/indents.js +3 -3
- package/src/editor-manager/plugin/insert-methods.d.ts +4 -4
- package/src/editor-manager/plugin/insert-methods.js +4 -4
- package/src/editor-manager/plugin/insert-text.d.ts +2 -2
- package/src/editor-manager/plugin/insert-text.js +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.d.ts +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.js +2 -2
- package/src/editor-manager/plugin/inserthtml.d.ts +3 -2
- package/src/editor-manager/plugin/inserthtml.js +85 -22
- package/src/editor-manager/plugin/isformatted.d.ts +8 -8
- package/src/editor-manager/plugin/isformatted.js +8 -8
- package/src/editor-manager/plugin/link.d.ts +2 -2
- package/src/editor-manager/plugin/link.js +10 -5
- package/src/editor-manager/plugin/lists.d.ts +2 -2
- package/src/editor-manager/plugin/lists.js +161 -72
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +216 -86
- package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
- package/src/editor-manager/plugin/nodecutter.js +11 -8
- package/src/editor-manager/plugin/selection-commands.d.ts +3 -1
- package/src/editor-manager/plugin/selection-commands.js +249 -5
- package/src/editor-manager/plugin/selection-exec.d.ts +2 -2
- package/src/editor-manager/plugin/selection-exec.js +2 -2
- package/src/editor-manager/plugin/table.d.ts +6 -3
- package/src/editor-manager/plugin/table.js +97 -51
- package/src/editor-manager/plugin/toolbar-status.d.ts +4 -4
- package/src/editor-manager/plugin/toolbar-status.js +22 -12
- package/src/editor-manager/plugin/undo.d.ts +7 -6
- package/src/editor-manager/plugin/undo.js +27 -7
- package/src/editor-manager/plugin/video.d.ts +3 -3
- package/src/editor-manager/plugin/video.js +3 -3
- package/src/global.d.ts +1 -0
- package/src/markdown-parser/base/interface.d.ts +10 -10
- package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
- package/src/markdown-parser/base/markdown-parser.js +3 -3
- package/src/markdown-parser/base/types.d.ts +1 -1
- package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
- package/src/markdown-parser/plugin/clearformat.js +2 -2
- package/src/markdown-parser/plugin/formats.d.ts +2 -2
- package/src/markdown-parser/plugin/formats.js +2 -2
- package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
- package/src/markdown-parser/plugin/insert-text.js +2 -2
- package/src/markdown-parser/plugin/link.d.ts +2 -2
- package/src/markdown-parser/plugin/link.js +2 -2
- package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
- package/src/markdown-parser/plugin/markdown-selection.js +14 -14
- package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
- package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
- package/src/markdown-parser/plugin/table.d.ts +3 -3
- package/src/markdown-parser/plugin/table.js +3 -3
- package/src/markdown-parser/plugin/undo.d.ts +6 -6
- package/src/markdown-parser/plugin/undo.js +6 -6
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +13 -12
- package/src/rich-text-editor/actions/base-quick-toolbar.js +70 -23
- package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-toolbar.js +36 -37
- package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
- package/src/rich-text-editor/actions/color-picker.js +15 -5
- package/src/rich-text-editor/actions/count.d.ts +3 -3
- package/src/rich-text-editor/actions/count.js +4 -4
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +3 -2
- package/src/rich-text-editor/actions/dropdown-buttons.js +13 -7
- package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
- package/src/rich-text-editor/actions/emoji-picker.js +17 -8
- package/src/rich-text-editor/actions/enter-key.js +10 -5
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +5 -2
- package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
- package/src/rich-text-editor/actions/full-screen.js +8 -7
- package/src/rich-text-editor/actions/html-editor.d.ts +5 -3
- package/src/rich-text-editor/actions/html-editor.js +134 -22
- package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
- package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
- package/src/rich-text-editor/actions/keyboard.js +23 -21
- package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
- package/src/rich-text-editor/actions/markdown-editor.js +5 -3
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +6 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +157 -29
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +17 -9
- package/src/rich-text-editor/actions/quick-toolbar.js +68 -21
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +16 -16
- package/src/rich-text-editor/actions/toolbar.js +48 -109
- package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
- package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
- package/src/rich-text-editor/base/classes.d.ts +125 -125
- package/src/rich-text-editor/base/classes.js +125 -125
- package/src/rich-text-editor/base/constant.d.ts +195 -150
- package/src/rich-text-editor/base/constant.js +364 -150
- package/src/rich-text-editor/base/enum.d.ts +1 -1
- package/src/rich-text-editor/base/enum.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +96 -52
- package/src/rich-text-editor/base/interface.js +1 -1
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
- package/src/rich-text-editor/base/rich-text-editor.d.ts +76 -64
- package/src/rich-text-editor/base/rich-text-editor.js +247 -160
- package/src/rich-text-editor/base/util.d.ts +1 -1
- package/src/rich-text-editor/base/util.js +23 -5
- package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
- package/src/rich-text-editor/formatter/formatter.js +24 -12
- package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/html-formatter.js +15 -15
- package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
- package/src/rich-text-editor/models/default-locale.js +31 -25
- package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
- package/src/rich-text-editor/models/iframe-settings.js +19 -19
- package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
- package/src/rich-text-editor/models/inline-mode.js +19 -19
- package/src/rich-text-editor/models/items.js +3 -3
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +20 -20
- package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
- package/src/rich-text-editor/renderer/audio-module.js +23 -5
- package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/content-renderer.js +6 -6
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +24 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
- package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
- package/src/rich-text-editor/renderer/image-module.js +265 -221
- package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/link-module.js +54 -25
- package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
- package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
- package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
- package/src/rich-text-editor/renderer/render.d.ts +2 -2
- package/src/rich-text-editor/renderer/render.js +2 -2
- package/src/rich-text-editor/renderer/table-module.d.ts +11 -2
- package/src/rich-text-editor/renderer/table-module.js +344 -169
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +12 -15
- package/src/rich-text-editor/renderer/toolbar-renderer.js +115 -110
- package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/video-module.js +83 -42
- package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
- package/src/rich-text-editor/renderer/view-source.js +21 -11
- package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
- package/src/rich-text-editor/services/renderer-factory.js +3 -3
- package/src/rich-text-editor/services/service-locator.d.ts +3 -3
- package/src/rich-text-editor/services/service-locator.js +3 -3
- package/src/selection/selection.d.ts +22 -22
- package/src/selection/selection.js +25 -22
- package/styles/_all.scss +1 -1
- package/styles/bootstrap-dark.css +353 -103
- package/styles/bootstrap.css +357 -112
- package/styles/bootstrap4.css +338 -96
- package/styles/bootstrap5-dark.css +344 -97
- package/styles/bootstrap5.css +344 -97
- package/styles/fabric-dark.css +332 -90
- package/styles/fabric.css +333 -91
- package/styles/fluent-dark.css +360 -98
- package/styles/fluent.css +360 -98
- package/styles/highcontrast-light.css +332 -90
- package/styles/highcontrast.css +336 -91
- package/styles/material-dark.css +339 -92
- package/styles/material.css +339 -92
- package/styles/material3-dark.css +348 -100
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +348 -100
- package/styles/material3.scss +1 -1
- package/styles/rich-text-editor/_all.scss +2 -2
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
- package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
- package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
- package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
- package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
- package/styles/rich-text-editor/_fabric-definition.scss +261 -257
- package/styles/rich-text-editor/_fluent-definition.scss +267 -263
- package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
- package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
- package/styles/rich-text-editor/_layout.scss +2249 -2072
- package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
- package/styles/rich-text-editor/_material-definition.scss +264 -260
- package/styles/rich-text-editor/_material3-definition.scss +266 -262
- package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
- package/styles/rich-text-editor/_theme.scss +926 -837
- package/styles/rich-text-editor/bootstrap-dark.css +353 -103
- package/styles/rich-text-editor/bootstrap.css +357 -112
- package/styles/rich-text-editor/bootstrap4.css +338 -96
- package/styles/rich-text-editor/bootstrap5-dark.css +344 -97
- package/styles/rich-text-editor/bootstrap5.css +344 -97
- package/styles/rich-text-editor/fabric-dark.css +332 -90
- package/styles/rich-text-editor/fabric.css +333 -91
- package/styles/rich-text-editor/fluent-dark.css +360 -98
- package/styles/rich-text-editor/fluent.css +360 -98
- package/styles/rich-text-editor/highcontrast-light.css +332 -90
- package/styles/rich-text-editor/highcontrast.css +336 -91
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
- package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_fabric.scss +349 -349
- package/styles/rich-text-editor/icons/_fluent.scss +348 -348
- package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
- package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
- package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_material.scss +349 -349
- package/styles/rich-text-editor/icons/_material3.scss +348 -348
- package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
- package/styles/rich-text-editor/material-dark.css +339 -92
- package/styles/rich-text-editor/material.css +339 -92
- package/styles/rich-text-editor/material3-dark.css +348 -100
- package/styles/rich-text-editor/material3-dark.scss +1 -1
- package/styles/rich-text-editor/material3.css +348 -100
- package/styles/rich-text-editor/material3.scss +1 -1
- package/styles/rich-text-editor/tailwind-dark.css +383 -113
- package/styles/rich-text-editor/tailwind.css +383 -113
- package/styles/tailwind-dark.css +383 -113
- package/styles/tailwind.css +383 -113
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
- package/dist/ej2-richtexteditor.min.js +0 -10
- package/dist/global/ej2-richtexteditor.min.js +0 -11
- package/dist/global/ej2-richtexteditor.min.js.map +0 -1
- package/dist/global/index.d.ts +0 -14
- package/tslint.json +0 -111
|
@@ -3,12 +3,12 @@ import { NodeCutter } from './nodecutter';
|
|
|
3
3
|
import * as CONSTANT from './../base/constant';
|
|
4
4
|
import { detach, Browser, isNullOrUndefined as isNOU, createElement, closest } from '@syncfusion/ej2-base';
|
|
5
5
|
import { InsertMethods } from './insert-methods';
|
|
6
|
-
import { updateTextNode } from './../../common/util';
|
|
6
|
+
import { updateTextNode, nestedListCleanUp } from './../../common/util';
|
|
7
7
|
/**
|
|
8
8
|
* Insert a HTML Node or Text
|
|
9
9
|
*
|
|
10
10
|
* @hidden
|
|
11
|
-
|
|
11
|
+
* @deprecated
|
|
12
12
|
*/
|
|
13
13
|
var InsertHtml = /** @class */ (function () {
|
|
14
14
|
function InsertHtml() {
|
|
@@ -59,6 +59,10 @@ var InsertHtml = /** @class */ (function () {
|
|
|
59
59
|
var isCollapsed = range.collapsed;
|
|
60
60
|
var nodes = this.getNodeCollection(range, nodeSelection, node);
|
|
61
61
|
var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
|
|
62
|
+
if (closestParentNode && closestParentNode.nodeName === 'LI' && node.nodeName.toLowerCase() === 'table') {
|
|
63
|
+
this.insertTableInList(range, node, closestParentNode, nodes[0], nodeCutter);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
62
66
|
if (isExternal || (!isNOU(node) && !isNOU(node.classList) &&
|
|
63
67
|
node.classList.contains('pasteContent'))) {
|
|
64
68
|
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
|
|
@@ -82,7 +86,12 @@ var InsertHtml = /** @class */ (function () {
|
|
|
82
86
|
lasNode.textContent.length : lasNode.childNodes.length);
|
|
83
87
|
range = nodeSelection.getRange(docElement);
|
|
84
88
|
}
|
|
85
|
-
range.
|
|
89
|
+
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
90
|
+
nestedListCleanUp(range);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
range.extractContents();
|
|
94
|
+
}
|
|
86
95
|
if (insertNode.tagName === 'TABLE') {
|
|
87
96
|
this.removeEmptyElements(editNode);
|
|
88
97
|
}
|
|
@@ -119,6 +128,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
119
128
|
InsertMethods.AppendBefore(node, parentNode.firstChild, false);
|
|
120
129
|
}
|
|
121
130
|
}
|
|
131
|
+
else if (isNOU(preNode.previousSibling) && insertNode.tagName === 'TABLE') {
|
|
132
|
+
parentNode.prepend(node);
|
|
133
|
+
}
|
|
122
134
|
else {
|
|
123
135
|
parentNode.appendChild(node);
|
|
124
136
|
}
|
|
@@ -204,19 +216,21 @@ var InsertHtml = /** @class */ (function () {
|
|
|
204
216
|
|| (node.nodeName.toLowerCase() === 'table' && closestParentNode &&
|
|
205
217
|
CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) === -1))) {
|
|
206
218
|
preNode = nodeCutter.GetSpliceNode(range, closestParentNode);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
if (!isNOU(preNode)) {
|
|
220
|
+
sibNode = isNOU(preNode.previousSibling) ? preNode.parentNode.previousSibling : preNode.previousSibling;
|
|
221
|
+
if (nodes.length === 1) {
|
|
222
|
+
nodeSelection.setSelectionContents(docElement, preNode);
|
|
223
|
+
range = nodeSelection.getRange(docElement);
|
|
224
|
+
isSingleNode = true;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
lasNode = nodeCutter.GetSpliceNode(range, nodes[nodes.length - 1].parentElement);
|
|
228
|
+
lasNode = isNOU(lasNode) ? preNode : lasNode;
|
|
229
|
+
nodeSelection.setSelectionText(docElement, preNode, lasNode, 0, (lasNode.nodeType === 3) ?
|
|
230
|
+
lasNode.textContent.length : lasNode.childNodes.length);
|
|
231
|
+
range = nodeSelection.getRange(docElement);
|
|
232
|
+
isSingleNode = false;
|
|
233
|
+
}
|
|
220
234
|
}
|
|
221
235
|
}
|
|
222
236
|
var containsBlockNode = false;
|
|
@@ -240,12 +254,17 @@ var InsertHtml = /** @class */ (function () {
|
|
|
240
254
|
preNode.parentNode.replaceChild(fragment, preNode);
|
|
241
255
|
}
|
|
242
256
|
else {
|
|
257
|
+
var startContainerParent = range.startContainer.parentNode;
|
|
258
|
+
// Get the index of the start container among its siblings
|
|
259
|
+
var startIndex = Array.prototype.indexOf.call(startContainerParent.childNodes, range.startContainer);
|
|
243
260
|
range.deleteContents();
|
|
261
|
+
range.setStart(startContainerParent, startIndex);
|
|
262
|
+
range.setEnd(startContainerParent, startIndex);
|
|
244
263
|
if (!isNOU(lasNode)) {
|
|
245
264
|
detach(lasNode);
|
|
246
265
|
}
|
|
247
266
|
// eslint-disable-next-line
|
|
248
|
-
!isNOU(sibNode) ? sibNode.parentNode.appendChild(fragment) :
|
|
267
|
+
!isNOU(sibNode) ? (sibNode.parentNode === editNode ? sibNode.appendChild(fragment) : sibNode.parentNode.appendChild(fragment)) : range.insertNode(fragment);
|
|
249
268
|
}
|
|
250
269
|
}
|
|
251
270
|
else {
|
|
@@ -285,6 +304,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
285
304
|
var paraElm = void 0;
|
|
286
305
|
var previousParent = void 0;
|
|
287
306
|
if (!this.contentsDeleted) {
|
|
307
|
+
if (!isCollapsed && range.startContainer.parentElement.textContent.length === 0 && range.startContainer.nodeName === 'BR' && range.startContainer.parentElement.nodeName === 'P') {
|
|
308
|
+
editNode.removeChild(range.startContainer.parentElement);
|
|
309
|
+
}
|
|
288
310
|
range.deleteContents();
|
|
289
311
|
}
|
|
290
312
|
while (node.firstChild) {
|
|
@@ -296,7 +318,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
296
318
|
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0 && isFirstTextNode)) {
|
|
297
319
|
lastSelectionNode = node.firstChild;
|
|
298
320
|
if (isNOU(node.previousElementSibling)) {
|
|
299
|
-
var firstParaElm = createElement('p');
|
|
321
|
+
var firstParaElm = enterAction === 'DIV' ? createElement('div') : createElement('p');
|
|
300
322
|
node.parentElement.insertBefore(firstParaElm, node);
|
|
301
323
|
}
|
|
302
324
|
if (node.previousElementSibling.nodeName === 'BR') {
|
|
@@ -311,7 +333,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
311
333
|
if (node.firstChild.nodeName === '#text' ||
|
|
312
334
|
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
313
335
|
if (!isPreviousInlineElem) {
|
|
314
|
-
paraElm = createElement('p');
|
|
336
|
+
paraElm = enterAction === 'DIV' ? createElement('div') : createElement('p');
|
|
315
337
|
paraElm.appendChild(node.firstChild);
|
|
316
338
|
fragment.appendChild(paraElm);
|
|
317
339
|
}
|
|
@@ -405,7 +427,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
405
427
|
if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
406
428
|
blockNode = range.startContainer;
|
|
407
429
|
}
|
|
408
|
-
if (blockNode.closest('LI') && node && node.firstElementChild &&
|
|
430
|
+
if (blockNode.closest('LI') && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
|
|
409
431
|
((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
|
|
410
432
|
var liNode = void 0;
|
|
411
433
|
while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
|
|
@@ -444,6 +466,12 @@ var InsertHtml = /** @class */ (function () {
|
|
|
444
466
|
}
|
|
445
467
|
if (!range.collapsed) {
|
|
446
468
|
range.deleteContents();
|
|
469
|
+
var value = range.startContainer;
|
|
470
|
+
if (!isNOU(value) && value.nodeName === 'LI' && !isNOU(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
|
|
471
|
+
value.parentElement.querySelectorAll('li').forEach(function (item) {
|
|
472
|
+
item.remove();
|
|
473
|
+
});
|
|
474
|
+
}
|
|
447
475
|
}
|
|
448
476
|
range.insertNode(node);
|
|
449
477
|
this.contentsDeleted = true;
|
|
@@ -470,7 +498,15 @@ var InsertHtml = /** @class */ (function () {
|
|
|
470
498
|
};
|
|
471
499
|
InsertHtml.imageFocus = function (node, nodeSelection, docElement) {
|
|
472
500
|
var focusNode = document.createTextNode(' ');
|
|
473
|
-
node.parentNode
|
|
501
|
+
if (node.parentNode && node.parentNode.nodeName === 'A') {
|
|
502
|
+
var anchorTag = node.parentNode;
|
|
503
|
+
var parentNode = anchorTag.parentNode;
|
|
504
|
+
parentNode.insertBefore(focusNode, anchorTag.nextSibling);
|
|
505
|
+
parentNode.insertBefore(node, focusNode);
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
node.parentNode.insertBefore(focusNode, node.nextSibling);
|
|
509
|
+
}
|
|
474
510
|
nodeSelection.setSelectionText(docElement, node.nextSibling, node.nextSibling, 0, 0);
|
|
475
511
|
};
|
|
476
512
|
// eslint-disable-next-line
|
|
@@ -525,6 +561,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
525
561
|
};
|
|
526
562
|
InsertHtml.closestEle = function (element, editNode) {
|
|
527
563
|
var el = element;
|
|
564
|
+
if (closest(el, 'li')) {
|
|
565
|
+
return closest(el, 'li');
|
|
566
|
+
}
|
|
528
567
|
while (el && el.nodeType === 1) {
|
|
529
568
|
if (el.parentNode === editNode ||
|
|
530
569
|
(!isNOU(el.parentNode.tagName) &&
|
|
@@ -535,11 +574,35 @@ var InsertHtml = /** @class */ (function () {
|
|
|
535
574
|
}
|
|
536
575
|
return null;
|
|
537
576
|
};
|
|
577
|
+
InsertHtml.insertTableInList = function (range, insertNode, parentNode, currentNode, nodeCutter) {
|
|
578
|
+
if (range.collapsed) {
|
|
579
|
+
var isStart = range.startOffset === 0;
|
|
580
|
+
var isEnd = range.startContainer.textContent.trimEnd().length === range.startOffset;
|
|
581
|
+
if (isStart || isEnd) {
|
|
582
|
+
if (isStart) {
|
|
583
|
+
InsertMethods.AppendBefore(insertNode, currentNode, false);
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
InsertMethods.AppendBefore(insertNode, currentNode, true);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
var preNode = nodeCutter.SplitNode(range, parentNode, true);
|
|
591
|
+
var sibNode = preNode.previousSibling;
|
|
592
|
+
sibNode.appendChild(insertNode);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
range.deleteContents();
|
|
597
|
+
parentNode.appendChild(insertNode);
|
|
598
|
+
}
|
|
599
|
+
insertNode.classList.add('ignore-table');
|
|
600
|
+
};
|
|
538
601
|
/**
|
|
539
602
|
* Insert method
|
|
540
603
|
*
|
|
541
604
|
* @hidden
|
|
542
|
-
|
|
605
|
+
* @deprecated
|
|
543
606
|
*/
|
|
544
607
|
InsertHtml.inlineNode = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
545
608
|
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Is formatted or not.
|
|
3
3
|
*
|
|
4
4
|
* @hidden
|
|
5
|
-
|
|
5
|
+
* @deprecated
|
|
6
6
|
*/
|
|
7
7
|
export declare class IsFormatted {
|
|
8
8
|
static inlineTags: string[];
|
|
@@ -14,7 +14,7 @@ export declare class IsFormatted {
|
|
|
14
14
|
* @param {Node} endNode - specifies the end node
|
|
15
15
|
* @returns {Node} - returns the node
|
|
16
16
|
* @hidden
|
|
17
|
-
|
|
17
|
+
* @deprecated
|
|
18
18
|
*/
|
|
19
19
|
getFormattedNode(node: Node, format: string, endNode: Node): Node;
|
|
20
20
|
private getFormatParent;
|
|
@@ -25,7 +25,7 @@ export declare class IsFormatted {
|
|
|
25
25
|
* @param {Node} node - specifies the node value
|
|
26
26
|
* @returns {boolean} - returns the boolean value
|
|
27
27
|
* @hidden
|
|
28
|
-
|
|
28
|
+
* @deprecated
|
|
29
29
|
*/
|
|
30
30
|
static isBold(node: Node): boolean;
|
|
31
31
|
/**
|
|
@@ -34,7 +34,7 @@ export declare class IsFormatted {
|
|
|
34
34
|
* @param {Node} node - specifies the node value
|
|
35
35
|
* @returns {boolean} - returns the boolean value
|
|
36
36
|
* @hidden
|
|
37
|
-
|
|
37
|
+
* @deprecated
|
|
38
38
|
*/
|
|
39
39
|
static isItalic(node: Node): boolean;
|
|
40
40
|
/**
|
|
@@ -43,7 +43,7 @@ export declare class IsFormatted {
|
|
|
43
43
|
* @param {Node} node - specifies the node value
|
|
44
44
|
* @returns {boolean} - returns the boolean value
|
|
45
45
|
* @hidden
|
|
46
|
-
|
|
46
|
+
* @deprecated
|
|
47
47
|
*/
|
|
48
48
|
static isUnderline(node: Node): boolean;
|
|
49
49
|
/**
|
|
@@ -52,7 +52,7 @@ export declare class IsFormatted {
|
|
|
52
52
|
* @param {Node} node - specifies the node value
|
|
53
53
|
* @returns {boolean} - returns the boolean value
|
|
54
54
|
* @hidden
|
|
55
|
-
|
|
55
|
+
* @deprecated
|
|
56
56
|
*/
|
|
57
57
|
static isStrikethrough(node: Node): boolean;
|
|
58
58
|
/**
|
|
@@ -61,7 +61,7 @@ export declare class IsFormatted {
|
|
|
61
61
|
* @param {Node} node - specifies the node value
|
|
62
62
|
* @returns {boolean} - returns the boolean value
|
|
63
63
|
* @hidden
|
|
64
|
-
|
|
64
|
+
* @deprecated
|
|
65
65
|
*/
|
|
66
66
|
static isSuperscript(node: Node): boolean;
|
|
67
67
|
/**
|
|
@@ -70,7 +70,7 @@ export declare class IsFormatted {
|
|
|
70
70
|
* @param {Node} node - specifies the node value
|
|
71
71
|
* @returns {boolean} - returns the boolean value
|
|
72
72
|
* @hidden
|
|
73
|
-
|
|
73
|
+
* @deprecated
|
|
74
74
|
*/
|
|
75
75
|
static isSubscript(node: Node): boolean;
|
|
76
76
|
private isFontColor;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Is formatted or not.
|
|
3
3
|
*
|
|
4
4
|
* @hidden
|
|
5
|
-
|
|
5
|
+
* @deprecated
|
|
6
6
|
*/
|
|
7
7
|
var IsFormatted = /** @class */ (function () {
|
|
8
8
|
function IsFormatted() {
|
|
@@ -15,7 +15,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
15
15
|
* @param {Node} endNode - specifies the end node
|
|
16
16
|
* @returns {Node} - returns the node
|
|
17
17
|
* @hidden
|
|
18
|
-
|
|
18
|
+
* @deprecated
|
|
19
19
|
*/
|
|
20
20
|
IsFormatted.prototype.getFormattedNode = function (node, format, endNode) {
|
|
21
21
|
var parentNode = this.getFormatParent(node, format, endNode);
|
|
@@ -62,7 +62,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
62
62
|
* @param {Node} node - specifies the node value
|
|
63
63
|
* @returns {boolean} - returns the boolean value
|
|
64
64
|
* @hidden
|
|
65
|
-
|
|
65
|
+
* @deprecated
|
|
66
66
|
*/
|
|
67
67
|
IsFormatted.isBold = function (node) {
|
|
68
68
|
var validTags = ['strong', 'b'];
|
|
@@ -83,7 +83,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
83
83
|
* @param {Node} node - specifies the node value
|
|
84
84
|
* @returns {boolean} - returns the boolean value
|
|
85
85
|
* @hidden
|
|
86
|
-
|
|
86
|
+
* @deprecated
|
|
87
87
|
*/
|
|
88
88
|
IsFormatted.isItalic = function (node) {
|
|
89
89
|
var validTags = ['em', 'i'];
|
|
@@ -104,7 +104,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
104
104
|
* @param {Node} node - specifies the node value
|
|
105
105
|
* @returns {boolean} - returns the boolean value
|
|
106
106
|
* @hidden
|
|
107
|
-
|
|
107
|
+
* @deprecated
|
|
108
108
|
*/
|
|
109
109
|
IsFormatted.isUnderline = function (node) {
|
|
110
110
|
var validTags = ['u'];
|
|
@@ -128,7 +128,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
128
128
|
* @param {Node} node - specifies the node value
|
|
129
129
|
* @returns {boolean} - returns the boolean value
|
|
130
130
|
* @hidden
|
|
131
|
-
|
|
131
|
+
* @deprecated
|
|
132
132
|
*/
|
|
133
133
|
IsFormatted.isStrikethrough = function (node) {
|
|
134
134
|
var validTags = ['del', 'strike'];
|
|
@@ -152,7 +152,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
152
152
|
* @param {Node} node - specifies the node value
|
|
153
153
|
* @returns {boolean} - returns the boolean value
|
|
154
154
|
* @hidden
|
|
155
|
-
|
|
155
|
+
* @deprecated
|
|
156
156
|
*/
|
|
157
157
|
IsFormatted.isSuperscript = function (node) {
|
|
158
158
|
var validTags = ['sup'];
|
|
@@ -169,7 +169,7 @@ var IsFormatted = /** @class */ (function () {
|
|
|
169
169
|
* @param {Node} node - specifies the node value
|
|
170
170
|
* @returns {boolean} - returns the boolean value
|
|
171
171
|
* @hidden
|
|
172
|
-
|
|
172
|
+
* @deprecated
|
|
173
173
|
*/
|
|
174
174
|
IsFormatted.isSubscript = function (node) {
|
|
175
175
|
var validTags = ['sub'];
|
|
@@ -3,7 +3,7 @@ import { EditorManager } from './../base/editor-manager';
|
|
|
3
3
|
* Link internal component
|
|
4
4
|
*
|
|
5
5
|
* @hidden
|
|
6
|
-
|
|
6
|
+
* @deprecated
|
|
7
7
|
*/
|
|
8
8
|
export declare class LinkCommand {
|
|
9
9
|
private parent;
|
|
@@ -12,7 +12,7 @@ export declare class LinkCommand {
|
|
|
12
12
|
*
|
|
13
13
|
* @param {EditorManager} parent - specifies the editor manager
|
|
14
14
|
* @hidden
|
|
15
|
-
|
|
15
|
+
* @deprecated
|
|
16
16
|
*/
|
|
17
17
|
constructor(parent: EditorManager);
|
|
18
18
|
private addEventListener;
|
|
@@ -7,7 +7,7 @@ import { createElement, isNullOrUndefined as isNOU, closest } from '@syncfusion/
|
|
|
7
7
|
* Link internal component
|
|
8
8
|
*
|
|
9
9
|
* @hidden
|
|
10
|
-
|
|
10
|
+
* @deprecated
|
|
11
11
|
*/
|
|
12
12
|
var LinkCommand = /** @class */ (function () {
|
|
13
13
|
/**
|
|
@@ -15,7 +15,7 @@ var LinkCommand = /** @class */ (function () {
|
|
|
15
15
|
*
|
|
16
16
|
* @param {EditorManager} parent - specifies the editor manager
|
|
17
17
|
* @hidden
|
|
18
|
-
|
|
18
|
+
* @deprecated
|
|
19
19
|
*/
|
|
20
20
|
function LinkCommand(parent) {
|
|
21
21
|
this.parent = parent;
|
|
@@ -54,7 +54,8 @@ var LinkCommand = /** @class */ (function () {
|
|
|
54
54
|
}
|
|
55
55
|
if (!isNOU(e.item.text) && e.item.text !== '') {
|
|
56
56
|
linkText = anchorEle.innerText;
|
|
57
|
-
anchorEle.innerText = e.item.text
|
|
57
|
+
anchorEle.firstChild.nodeName === '#text' ? anchorEle.innerText = e.item.text :
|
|
58
|
+
anchorEle.firstChild.innerText = e.item.text;
|
|
58
59
|
}
|
|
59
60
|
if (!isNOU(e.item.target)) {
|
|
60
61
|
anchorEle.setAttribute('target', e.item.target);
|
|
@@ -70,7 +71,8 @@ var LinkCommand = /** @class */ (function () {
|
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
var startIndex = e.item.action === 'Paste' ? anchorEle.childNodes[0].textContent.length : 0;
|
|
73
|
-
|
|
74
|
+
var endIndex = anchorEle.firstChild.nodeName === '#text' ? anchorEle.childNodes[0].textContent.length : anchorEle.childNodes.length;
|
|
75
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, anchorEle.childNodes[0], anchorEle.childNodes[0], startIndex, endIndex);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
@@ -194,7 +196,7 @@ var LinkCommand = /** @class */ (function () {
|
|
|
194
196
|
for (var i = 0, j_2 = 0, k = 0; i <= finalinlineNodes.length; i++) {
|
|
195
197
|
if (i === 0) {
|
|
196
198
|
finalinlineNodes[i].parentNode.insertBefore(anchorNodes[j_2], finalinlineNodes[i].nextSibling);
|
|
197
|
-
if (this.parent.domNode.blockNodes().length === 1) {
|
|
199
|
+
if (this.parent.domNode.blockNodes().length === 1 && anchorNodes.length === 1) {
|
|
198
200
|
this.parent.nodeSelection.setSelectionNode(this.parent.currentDocument, anchorNodes[j_2]);
|
|
199
201
|
}
|
|
200
202
|
removeNodes[k] = finalinlineNodes[i];
|
|
@@ -230,6 +232,9 @@ var LinkCommand = /** @class */ (function () {
|
|
|
230
232
|
if (!isNOU(e.item.target)) {
|
|
231
233
|
anchorEle.setAttribute('target', e.item.target);
|
|
232
234
|
}
|
|
235
|
+
if (!isNOU(e.item.ariaLabel)) {
|
|
236
|
+
anchorEle.setAttribute('aria-label', e.item.ariaLabel);
|
|
237
|
+
}
|
|
233
238
|
return anchorEle;
|
|
234
239
|
};
|
|
235
240
|
LinkCommand.prototype.getSelectionNodes = function (nodeCollection) {
|
|
@@ -3,7 +3,7 @@ import { EditorManager } from './../base/editor-manager';
|
|
|
3
3
|
* Lists internal component
|
|
4
4
|
*
|
|
5
5
|
* @hidden
|
|
6
|
-
|
|
6
|
+
* @deprecated
|
|
7
7
|
*/
|
|
8
8
|
export declare class Lists {
|
|
9
9
|
private parent;
|
|
@@ -18,7 +18,7 @@ export declare class Lists {
|
|
|
18
18
|
*
|
|
19
19
|
* @param {EditorManager} parent - specifies the parent element
|
|
20
20
|
* @hidden
|
|
21
|
-
|
|
21
|
+
* @deprecated
|
|
22
22
|
*/
|
|
23
23
|
constructor(parent: EditorManager);
|
|
24
24
|
private addEventListener;
|