@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
|
@@ -9,7 +9,7 @@ import { isNullOrUndefined, isNullOrUndefined as isNOU, closest } from '@syncfus
|
|
|
9
9
|
* Lists internal component
|
|
10
10
|
*
|
|
11
11
|
* @hidden
|
|
12
|
-
|
|
12
|
+
* @deprecated
|
|
13
13
|
*/
|
|
14
14
|
var Lists = /** @class */ (function () {
|
|
15
15
|
/**
|
|
@@ -17,7 +17,7 @@ var Lists = /** @class */ (function () {
|
|
|
17
17
|
*
|
|
18
18
|
* @param {EditorManager} parent - specifies the parent element
|
|
19
19
|
* @hidden
|
|
20
|
-
|
|
20
|
+
* @deprecated
|
|
21
21
|
*/
|
|
22
22
|
function Lists(parent) {
|
|
23
23
|
this.parent = parent;
|
|
@@ -72,14 +72,21 @@ var Lists = /** @class */ (function () {
|
|
|
72
72
|
var preElementOLTest = this.testList(preElement);
|
|
73
73
|
var nextElementOLTest = this.testList(nextElement);
|
|
74
74
|
if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*') {
|
|
75
|
+
var brElement = createElement('br');
|
|
75
76
|
if (startElementOLTest) {
|
|
76
77
|
range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
|
|
78
|
+
if (range.startContainer.nodeName === '#text' && range.startContainer.textContent.length === 0) {
|
|
79
|
+
this.parent.domNode.insertAfter(brElement, range.startContainer);
|
|
80
|
+
}
|
|
77
81
|
this.applyListsHandler({ subCommand: 'OL', callBack: e.callBack });
|
|
78
82
|
e.event.preventDefault();
|
|
79
83
|
}
|
|
80
84
|
else if (range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim() === '*' ||
|
|
81
85
|
range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim() === '-') {
|
|
82
86
|
range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
|
|
87
|
+
if (range.startContainer.nodeName === '#text' && range.startContainer.textContent.length === 0) {
|
|
88
|
+
this.parent.domNode.insertAfter(brElement, range.startContainer);
|
|
89
|
+
}
|
|
83
90
|
this.applyListsHandler({ subCommand: 'UL', callBack: e.callBack });
|
|
84
91
|
e.event.preventDefault();
|
|
85
92
|
}
|
|
@@ -107,7 +114,8 @@ var Lists = /** @class */ (function () {
|
|
|
107
114
|
startNode.textContent = '';
|
|
108
115
|
}
|
|
109
116
|
var startNodeParent = startNode.parentElement;
|
|
110
|
-
|
|
117
|
+
var parentOfCurrentOLUL = startNodeParent.parentElement;
|
|
118
|
+
if (isNOU(parentOfCurrentOLUL.closest('UL')) && isNOU(parentOfCurrentOLUL.closest('OL'))) {
|
|
111
119
|
if (!isNOU(startNode.nextElementSibling)) {
|
|
112
120
|
var nearBlockNode = this.parent.domNode.blockParentNode(startNode);
|
|
113
121
|
this.parent.nodeCutter.GetSpliceNode(range, nearBlockNode);
|
|
@@ -134,6 +142,15 @@ var Lists = /** @class */ (function () {
|
|
|
134
142
|
detach(startNode);
|
|
135
143
|
}
|
|
136
144
|
}
|
|
145
|
+
// To handle the nested enter key press in the list for the first LI element
|
|
146
|
+
if (!isNOU(parentOfCurrentOLUL) && (!isNOU(parentOfCurrentOLUL.closest('UL')) || !isNOU(parentOfCurrentOLUL.closest('OL'))) &&
|
|
147
|
+
parentOfCurrentOLUL.nodeName === 'LI' && parentOfCurrentOLUL.style.listStyleType === 'none' &&
|
|
148
|
+
parentOfCurrentOLUL.textContent === '' && startNode.textContent === '' && startNode === startNodeParent.firstElementChild &&
|
|
149
|
+
isNOU(startNode.nextSibling)) {
|
|
150
|
+
detach(startNodeParent);
|
|
151
|
+
parentOfCurrentOLUL.style.removeProperty('list-style-type');
|
|
152
|
+
e.event.preventDefault();
|
|
153
|
+
}
|
|
137
154
|
}
|
|
138
155
|
};
|
|
139
156
|
Lists.prototype.backspaceList = function (e) {
|
|
@@ -190,11 +207,19 @@ var Lists = /** @class */ (function () {
|
|
|
190
207
|
};
|
|
191
208
|
Lists.prototype.removeList = function (range, e) {
|
|
192
209
|
var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
|
|
193
|
-
var endNode = this.parent.domNode.getSelectedNode(range.endContainer, range.endOffset);
|
|
210
|
+
var endNode = (!isNOU(range.endContainer.parentElement.closest('li')) && range.endContainer.parentElement.closest('li').childElementCount > 1 && range.endContainer.nodeName === '#text') ? range.endContainer : this.parent.domNode.getSelectedNode(range.endContainer, range.endOffset);
|
|
211
|
+
var parentList = (range.startContainer.nodeName === "#text") ? range.startContainer.parentElement.closest('li') : range.startContainer.closest('li');
|
|
212
|
+
var fullContent = "";
|
|
213
|
+
if (!isNOU(parentList) && !isNOU(parentList.firstChild)) {
|
|
214
|
+
parentList.childNodes.forEach(function (e) {
|
|
215
|
+
fullContent = fullContent + e.textContent;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
;
|
|
194
219
|
startNode = startNode.nodeName === 'BR' ? startNode.parentElement : startNode;
|
|
195
220
|
endNode = endNode.nodeName === 'BR' ? endNode.parentElement : endNode;
|
|
196
221
|
startNode = startNode.nodeName !== 'LI' && !isNOU(startNode.closest('LI')) ? startNode.closest('LI') : startNode;
|
|
197
|
-
endNode = endNode.nodeName !== 'LI' && !isNOU(endNode.closest('LI')) ? endNode.closest('LI') : endNode;
|
|
222
|
+
endNode = endNode.nodeName !== 'LI' && endNode.nodeName !== '#text' && !isNOU(endNode.closest('LI')) ? endNode.closest('LI') : endNode;
|
|
198
223
|
if (((range.commonAncestorContainer.nodeName === 'OL' || range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'LI') &&
|
|
199
224
|
isNOU(endNode.nextElementSibling) && endNode.textContent.length === range.endOffset &&
|
|
200
225
|
isNOU(startNode.previousElementSibling) && range.startOffset === 0) ||
|
|
@@ -211,6 +236,25 @@ var Lists = /** @class */ (function () {
|
|
|
211
236
|
}
|
|
212
237
|
e.event.preventDefault();
|
|
213
238
|
}
|
|
239
|
+
else if (!isNOU(parentList) && !range.collapsed && parentList.textContent === fullContent) {
|
|
240
|
+
range.deleteContents();
|
|
241
|
+
this.parent.editableElement.querySelectorAll('li').forEach(function (li) {
|
|
242
|
+
if (!li.firstChild || li.textContent.trim() === '') {
|
|
243
|
+
li.parentNode.removeChild(li);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
this.parent.editableElement.querySelectorAll('ol').forEach(function (ol) {
|
|
247
|
+
if (!ol.firstChild || ol.textContent.trim() === '') {
|
|
248
|
+
ol.parentNode.removeChild(ol);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
this.parent.editableElement.querySelectorAll('ul').forEach(function (ul) {
|
|
252
|
+
if (!ul.firstChild || ul.textContent.trim() === '') {
|
|
253
|
+
ul.parentNode.removeChild(ul);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
e.event.preventDefault();
|
|
257
|
+
}
|
|
214
258
|
};
|
|
215
259
|
Lists.prototype.onKeyUp = function () {
|
|
216
260
|
if (!isNOU(this.commonLIParent) && !isNOU(this.commonLIParent.querySelector('.removeList'))) {
|
|
@@ -250,7 +294,7 @@ var Lists = /** @class */ (function () {
|
|
|
250
294
|
if (e.event.which === 8) {
|
|
251
295
|
this.backspaceList(e);
|
|
252
296
|
}
|
|
253
|
-
if (e.event.which === 46 && e.event.action === 'delete') {
|
|
297
|
+
if ((e.event.which === 46 && e.event.action === 'delete') || (e.event.which === 88 && e.event.action === 'cut')) {
|
|
254
298
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
255
299
|
var commonAncestor = range.commonAncestorContainer;
|
|
256
300
|
var startEle = range.startContainer;
|
|
@@ -507,7 +551,7 @@ var Lists = /** @class */ (function () {
|
|
|
507
551
|
this.currentAction = e.subCommand;
|
|
508
552
|
this.currentAction = e.subCommand = this.currentAction === 'NumberFormatList' ? 'OL' : this.currentAction === 'BulletFormatList' ? 'UL' : this.currentAction;
|
|
509
553
|
this.domNode.setMarker(this.saveSelection);
|
|
510
|
-
var listsNodes = this.domNode.blockNodes();
|
|
554
|
+
var listsNodes = this.domNode.blockNodes(true);
|
|
511
555
|
if (e.enterAction === 'BR') {
|
|
512
556
|
this.setSelectionBRConfig();
|
|
513
557
|
var allSelectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument);
|
|
@@ -600,12 +644,16 @@ var Lists = /** @class */ (function () {
|
|
|
600
644
|
};
|
|
601
645
|
Lists.prototype.applyLists = function (elements, type, selector, item, e) {
|
|
602
646
|
var isReverse = true;
|
|
603
|
-
if (this.isRevert(elements, type, item) && isNOU(item)) {
|
|
647
|
+
if (this.isRevert(elements, type, item) && isNOU(item) || (!isNOU(item) && item.listStyle === 'none')) {
|
|
604
648
|
this.revertList(elements, e);
|
|
605
649
|
this.removeEmptyListElements();
|
|
606
650
|
}
|
|
607
651
|
else {
|
|
608
652
|
this.checkLists(elements, type, item);
|
|
653
|
+
var marginLeftAttribute = '';
|
|
654
|
+
if (elements[0].style.marginLeft !== '') {
|
|
655
|
+
marginLeftAttribute = ' style = "margin-left: ' + elements[0].style.marginLeft + ';"';
|
|
656
|
+
}
|
|
609
657
|
for (var i = 0; i < elements.length; i++) {
|
|
610
658
|
if (!isNOU(item) && !isNOU(item.listStyle)) {
|
|
611
659
|
if (item.listStyle === 'listImage') {
|
|
@@ -616,16 +664,29 @@ var Lists = /** @class */ (function () {
|
|
|
616
664
|
setStyleAttribute(elements[i], { 'list-style-type': item.listStyle.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() });
|
|
617
665
|
}
|
|
618
666
|
}
|
|
667
|
+
var elemAtt = void 0;
|
|
668
|
+
elements[i].style.removeProperty('margin-left');
|
|
669
|
+
elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|
|
619
670
|
if (elements[i].getAttribute('contenteditable') === 'true'
|
|
620
671
|
&& elements[i].childNodes.length === 1 && elements[i].childNodes[0].nodeName === 'TABLE') {
|
|
621
672
|
var listEle = document.createElement(type);
|
|
622
673
|
listEle.innerHTML = '<li><br/></li>';
|
|
623
674
|
elements[i].appendChild(listEle);
|
|
624
675
|
}
|
|
676
|
+
else if ('LI' !== elements[i].tagName && isNOU(item) &&
|
|
677
|
+
elements[i].nodeName === 'BLOCKQUOTE') {
|
|
678
|
+
isReverse = false;
|
|
679
|
+
var openTag = '<' + type + marginLeftAttribute + '>';
|
|
680
|
+
var closeTag = '</' + type + '>';
|
|
681
|
+
var newTag = 'li' + elemAtt;
|
|
682
|
+
var replaceHTML = elements[i].innerHTML;
|
|
683
|
+
var innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
|
|
684
|
+
var collectionString = openTag + innerHTML + closeTag;
|
|
685
|
+
elements[i].innerHTML = collectionString;
|
|
686
|
+
}
|
|
625
687
|
else if ('LI' !== elements[i].tagName && isNOU(item)) {
|
|
626
688
|
isReverse = false;
|
|
627
|
-
var
|
|
628
|
-
var openTag = '<' + type + '>';
|
|
689
|
+
var openTag = '<' + type + marginLeftAttribute + '>';
|
|
629
690
|
var closeTag = '</' + type + '>';
|
|
630
691
|
var newTag = 'li' + elemAtt;
|
|
631
692
|
var replaceHTML = (elements[i].tagName.toLowerCase() === CONSTANT.DEFAULT_TAG ?
|
|
@@ -637,8 +698,8 @@ var Lists = /** @class */ (function () {
|
|
|
637
698
|
else if (!isNOU(item) && 'LI' !== elements[i].tagName) {
|
|
638
699
|
// eslint-disable-next-line
|
|
639
700
|
isReverse = false;
|
|
640
|
-
var
|
|
641
|
-
var openTag = '<' + type +
|
|
701
|
+
var currentElemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|
|
702
|
+
var openTag = '<' + type + currentElemAtt + '>';
|
|
642
703
|
var closeTag = '</' + type + '>';
|
|
643
704
|
var newTag = 'li';
|
|
644
705
|
var replaceHTML = (elements[i].tagName.toLowerCase() === CONSTANT.DEFAULT_TAG ?
|
|
@@ -675,6 +736,9 @@ var Lists = /** @class */ (function () {
|
|
|
675
736
|
isNOU(item) && nodes[i].parentNode.style.listStyleType !== '') {
|
|
676
737
|
isRevert = false;
|
|
677
738
|
}
|
|
739
|
+
if (nodes[i].parentNode.tagName === tagName && nodes[i].parentNode.style.listStyleType !== '') {
|
|
740
|
+
isRevert = true;
|
|
741
|
+
}
|
|
678
742
|
}
|
|
679
743
|
return isRevert;
|
|
680
744
|
};
|
|
@@ -711,8 +775,17 @@ var Lists = /** @class */ (function () {
|
|
|
711
775
|
};
|
|
712
776
|
Lists.prototype.cleanNode = function () {
|
|
713
777
|
var liParents = this.parent.editableElement.querySelectorAll('ol + ol, ul + ul');
|
|
778
|
+
var listStyleType;
|
|
779
|
+
var firstNodeOL;
|
|
714
780
|
for (var c = 0; c < liParents.length; c++) {
|
|
715
781
|
var node = liParents[c];
|
|
782
|
+
var toFindtopOlUl = true;
|
|
783
|
+
if (toFindtopOlUl && (liParents[c].parentElement.parentElement.nodeName === 'OL' || liParents[c].parentElement.parentElement.nodeName === 'UL')) {
|
|
784
|
+
toFindtopOlUl = false;
|
|
785
|
+
var preElement = liParents[c].parentElement.parentElement;
|
|
786
|
+
listStyleType = preElement.style.listStyleType;
|
|
787
|
+
firstNodeOL = node.previousElementSibling;
|
|
788
|
+
}
|
|
716
789
|
if (this.domNode.isList(node.previousElementSibling) &&
|
|
717
790
|
this.domNode.openTagString(node) === this.domNode.openTagString(node.previousElementSibling)) {
|
|
718
791
|
var contentNodes = this.domNode.contents(node);
|
|
@@ -727,6 +800,9 @@ var Lists = /** @class */ (function () {
|
|
|
727
800
|
}
|
|
728
801
|
}
|
|
729
802
|
}
|
|
803
|
+
if (firstNodeOL) {
|
|
804
|
+
firstNodeOL.style.listStyleType = listStyleType;
|
|
805
|
+
}
|
|
730
806
|
};
|
|
731
807
|
Lists.prototype.findUnSelected = function (temp, elements) {
|
|
732
808
|
temp = temp.slice().reverse();
|
|
@@ -787,72 +863,85 @@ var Lists = /** @class */ (function () {
|
|
|
787
863
|
var viewNode = [];
|
|
788
864
|
for (var i = 0; i < elements.length; i++) {
|
|
789
865
|
var element = elements[i];
|
|
790
|
-
if (
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
if (element.parentNode.insertBefore(this.closeTag(parentNode.tagName), element),
|
|
811
|
-
'LI' === parentNode.parentNode.tagName || 'OL' === parentNode.parentNode.tagName ||
|
|
812
|
-
'UL' === parentNode.parentNode.tagName) {
|
|
813
|
-
element.parentNode.insertBefore(this.closeTag('LI'), element);
|
|
814
|
-
}
|
|
815
|
-
else {
|
|
816
|
-
var classAttr = '';
|
|
817
|
-
if (className) {
|
|
818
|
-
// eslint-disable-next-line
|
|
819
|
-
classAttr += ' class="' + className + '"';
|
|
820
|
-
}
|
|
821
|
-
if (CONSTANT.DEFAULT_TAG && 0 === element.querySelectorAll(CONSTANT.BLOCK_TAGS.join(', ')).length) {
|
|
822
|
-
var wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
|
|
823
|
-
' class="' + className + ' e-rte-wrap-inner"';
|
|
824
|
-
var wrapper = '<' + CONSTANT.DEFAULT_TAG + wrapperclass +
|
|
825
|
-
this.domNode.attributes(parentNode) + '></' + CONSTANT.DEFAULT_TAG + '>';
|
|
826
|
-
if (e.enterAction !== 'BR') {
|
|
827
|
-
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
|
|
866
|
+
if ((isNullOrUndefined(e.item)) || ((element.nodeName === 'LI' && e.item.listStyle === 'none'))) {
|
|
867
|
+
if (this.domNode.contents(element)[0].nodeType === 3 && this.domNode.contents(element)[0].textContent.trim().length === 0) {
|
|
868
|
+
detach(this.domNode.contents(element)[0]);
|
|
869
|
+
}
|
|
870
|
+
var parentNode = elements[i].parentNode;
|
|
871
|
+
var className = element.getAttribute('class');
|
|
872
|
+
if (temp.length === 0) {
|
|
873
|
+
var siblingList = elements[i].querySelectorAll('ul, ol');
|
|
874
|
+
var firstNode = siblingList[0];
|
|
875
|
+
if (firstNode) {
|
|
876
|
+
var child = firstNode
|
|
877
|
+
.querySelectorAll('li');
|
|
878
|
+
if (child) {
|
|
879
|
+
var nestedElement = createElement(firstNode.tagName);
|
|
880
|
+
append([nestedElement], firstNode.parentNode);
|
|
881
|
+
var nestedElementLI = createElement('li', { styles: 'list-style-type: none;' });
|
|
882
|
+
append([nestedElementLI], nestedElement);
|
|
883
|
+
append([firstNode], nestedElementLI);
|
|
884
|
+
}
|
|
828
885
|
}
|
|
829
886
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
else if (this.domNode.contents(element)[0].classList.contains(markerClassName.startSelection) ||
|
|
835
|
-
this.domNode.contents(element)[0].classList.contains(markerClassName.endSelection)) {
|
|
836
|
-
var replace = this.domNode.createTagString(CONSTANT.DEFAULT_TAG, parentNode, this.domNode.contents(element)[0].outerHTML);
|
|
837
|
-
this.domNode.replaceWith(this.domNode.contents(element)[0], replace);
|
|
887
|
+
if (element.parentNode.insertBefore(this.closeTag(parentNode.tagName), element),
|
|
888
|
+
'LI' === parentNode.parentNode.tagName || 'OL' === parentNode.parentNode.tagName ||
|
|
889
|
+
'UL' === parentNode.parentNode.tagName) {
|
|
890
|
+
element.parentNode.insertBefore(this.closeTag('LI'), element);
|
|
838
891
|
}
|
|
839
892
|
else {
|
|
840
|
-
var
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
attributes(childNode, { 'class': className + ' ' + childNode.getAttribute('class') });
|
|
893
|
+
var classAttr = '';
|
|
894
|
+
if (className) {
|
|
895
|
+
// eslint-disable-next-line
|
|
896
|
+
classAttr += ' class="' + className + '"';
|
|
845
897
|
}
|
|
898
|
+
if (CONSTANT.DEFAULT_TAG && 0 === element.querySelectorAll(CONSTANT.BLOCK_TAGS.join(', ')).length) {
|
|
899
|
+
var wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
|
|
900
|
+
' class="' + className + ' e-rte-wrap-inner"';
|
|
901
|
+
var parentElement = parentNode;
|
|
902
|
+
if (elements.length === parentElement.querySelectorAll('li').length) {
|
|
903
|
+
if (!isNOU(parentElement.style.listStyleType)) {
|
|
904
|
+
parentNode.style.removeProperty("list-style-type");
|
|
905
|
+
}
|
|
906
|
+
if (!isNOU(parentElement.style.listStyleImage)) {
|
|
907
|
+
parentNode.style.removeProperty("list-style-image");
|
|
908
|
+
}
|
|
909
|
+
if (parentElement.style.length === 0) {
|
|
910
|
+
parentNode.removeAttribute("style");
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
var wrapper = '<' + CONSTANT.DEFAULT_TAG + wrapperclass + this.domNode.attributes(element) + '></' + CONSTANT.DEFAULT_TAG + '>';
|
|
914
|
+
if (e.enterAction !== 'BR') {
|
|
915
|
+
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
else if (this.domNode.contents(element)[0].nodeType === 3) {
|
|
919
|
+
var replace = this.domNode.createTagString(CONSTANT.DEFAULT_TAG, parentNode, this.parent.domNode.encode(this.domNode.contents(element)[0].textContent));
|
|
920
|
+
this.domNode.replaceWith(this.domNode.contents(element)[0], replace);
|
|
921
|
+
}
|
|
922
|
+
else if (this.domNode.contents(element)[0].classList.contains(markerClassName.startSelection) ||
|
|
923
|
+
this.domNode.contents(element)[0].classList.contains(markerClassName.endSelection)) {
|
|
924
|
+
var replace = this.domNode.createTagString(CONSTANT.DEFAULT_TAG, parentNode, this.domNode.contents(element)[0].outerHTML);
|
|
925
|
+
this.domNode.replaceWith(this.domNode.contents(element)[0], replace);
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
var childNode = element.firstChild;
|
|
929
|
+
className = childNode.getAttribute('class');
|
|
930
|
+
attributes(childNode, this.domNode.rawAttributes(parentNode));
|
|
931
|
+
if (className && childNode.getAttribute('class')) {
|
|
932
|
+
attributes(childNode, { 'class': className + ' ' + childNode.getAttribute('class') });
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
append([this.openTag('LI')], element);
|
|
936
|
+
prepend([this.closeTag('LI')], element);
|
|
937
|
+
}
|
|
938
|
+
this.domNode.insertAfter(this.openTag(parentNode.tagName), element);
|
|
939
|
+
if (parentNode.parentNode.tagName === 'LI') {
|
|
940
|
+
parentNode = parentNode.parentNode.parentNode;
|
|
941
|
+
}
|
|
942
|
+
if (viewNode.indexOf(parentNode) < 0) {
|
|
943
|
+
viewNode.push(parentNode);
|
|
846
944
|
}
|
|
847
|
-
append([this.openTag('LI')], element);
|
|
848
|
-
prepend([this.closeTag('LI')], element);
|
|
849
|
-
}
|
|
850
|
-
this.domNode.insertAfter(this.openTag(parentNode.tagName), element);
|
|
851
|
-
if (parentNode.parentNode.tagName === 'LI') {
|
|
852
|
-
parentNode = parentNode.parentNode.parentNode;
|
|
853
|
-
}
|
|
854
|
-
if (viewNode.indexOf(parentNode) < 0) {
|
|
855
|
-
viewNode.push(parentNode);
|
|
856
945
|
}
|
|
857
946
|
}
|
|
858
947
|
for (var i = 0; i < viewNode.length; i++) {
|
|
@@ -3,7 +3,7 @@ import { EditorManager } from '../base/editor-manager';
|
|
|
3
3
|
* PasteCleanup for MsWord content
|
|
4
4
|
*
|
|
5
5
|
* @hidden
|
|
6
|
-
|
|
6
|
+
* @deprecated
|
|
7
7
|
*/
|
|
8
8
|
export declare class MsWordPaste {
|
|
9
9
|
private parent;
|
|
@@ -21,6 +21,7 @@ export declare class MsWordPaste {
|
|
|
21
21
|
private addEventListener;
|
|
22
22
|
private cropImageDimensions;
|
|
23
23
|
private wordCleanup;
|
|
24
|
+
private addDoubleBr;
|
|
24
25
|
private cleanList;
|
|
25
26
|
private insertAfter;
|
|
26
27
|
private findClosestListElem;
|
|
@@ -50,5 +51,7 @@ export declare class MsWordPaste {
|
|
|
50
51
|
private getlistStyleType;
|
|
51
52
|
private makeConversion;
|
|
52
53
|
private getListContent;
|
|
54
|
+
private processMargin;
|
|
53
55
|
private removeEmptyAnchorTag;
|
|
56
|
+
private findSource;
|
|
54
57
|
}
|