@syncfusion/ej2-richtexteditor 24.2.9 → 25.1.35
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/CHANGELOG.md +18 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +908 -485
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +892 -474
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +11 -0
- package/src/common/interface.d.ts +12 -0
- package/src/common/types.d.ts +6 -0
- package/src/editor-manager/plugin/dom-node.d.ts +5 -1
- package/src/editor-manager/plugin/dom-node.js +161 -12
- package/src/editor-manager/plugin/formats.js +1 -1
- package/src/editor-manager/plugin/image.js +12 -16
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +31 -0
- package/src/editor-manager/plugin/link.js +1 -1
- package/src/editor-manager/plugin/lists.js +24 -2
- package/src/editor-manager/plugin/ms-word-clean-up.js +65 -57
- package/src/editor-manager/plugin/selection-commands.js +52 -3
- package/src/editor-manager/plugin/table.js +18 -3
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +17 -9
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-quick-toolbar.js +41 -10
- package/src/rich-text-editor/actions/base-toolbar.js +24 -30
- package/src/rich-text-editor/actions/dropdown-buttons.js +4 -4
- package/src/rich-text-editor/actions/emoji-picker.js +1 -1
- package/src/rich-text-editor/actions/enter-key.js +2 -1
- package/src/rich-text-editor/actions/full-screen.js +2 -2
- package/src/rich-text-editor/actions/html-editor.d.ts +0 -2
- package/src/rich-text-editor/actions/html-editor.js +8 -26
- package/src/rich-text-editor/actions/markdown-editor.js +3 -1
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +23 -0
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +7 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +23 -8
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +0 -2
- package/src/rich-text-editor/actions/toolbar.js +13 -85
- package/src/rich-text-editor/base/classes.d.ts +0 -5
- package/src/rich-text-editor/base/classes.js +0 -5
- package/src/rich-text-editor/base/constant.d.ts +5 -0
- package/src/rich-text-editor/base/constant.js +5 -0
- package/src/rich-text-editor/base/interface.d.ts +36 -2
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +2 -2
- package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -3
- package/src/rich-text-editor/base/rich-text-editor.js +81 -58
- package/src/rich-text-editor/base/util.js +8 -2
- package/src/rich-text-editor/models/default-locale.js +15 -12
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +1 -1
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
- package/src/rich-text-editor/renderer/image-module.d.ts +8 -1
- package/src/rich-text-editor/renderer/image-module.js +148 -155
- package/src/rich-text-editor/renderer/table-module.d.ts +2 -0
- package/src/rich-text-editor/renderer/table-module.js +71 -8
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +3 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +61 -2
- package/src/rich-text-editor/renderer/video-module.js +7 -4
- package/src/rich-text-editor/renderer/view-source.js +7 -4
- package/styles/bootstrap-dark.css +57 -17
- package/styles/bootstrap.css +58 -18
- package/styles/bootstrap4.css +58 -18
- package/styles/bootstrap5-dark.css +64 -17
- package/styles/bootstrap5.css +64 -17
- package/styles/fabric-dark.css +57 -17
- package/styles/fabric.css +58 -18
- package/styles/fluent-dark.css +57 -17
- package/styles/fluent.css +57 -17
- package/styles/highcontrast-light.css +57 -17
- package/styles/highcontrast.css +58 -18
- package/styles/material-dark.css +57 -17
- package/styles/material.css +57 -17
- package/styles/material3-dark.css +59 -19
- package/styles/material3.css +59 -19
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
- package/styles/rich-text-editor/_bootstrap4-definition.scss +3 -2
- package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_fabric-definition.scss +2 -1
- package/styles/rich-text-editor/_fluent-definition.scss +1 -0
- package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
- package/styles/rich-text-editor/_highcontrast-definition.scss +2 -1
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
- package/styles/rich-text-editor/_layout.scss +47 -13
- package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_material-definition.scss +1 -0
- package/styles/rich-text-editor/_material3-definition.scss +1 -0
- package/styles/rich-text-editor/_tailwind-definition.scss +4 -3
- package/styles/rich-text-editor/_theme.scss +18 -5
- package/styles/rich-text-editor/bootstrap-dark.css +57 -17
- package/styles/rich-text-editor/bootstrap.css +58 -18
- package/styles/rich-text-editor/bootstrap4.css +58 -18
- package/styles/rich-text-editor/bootstrap5-dark.css +64 -17
- package/styles/rich-text-editor/bootstrap5.css +64 -17
- package/styles/rich-text-editor/fabric-dark.css +57 -17
- package/styles/rich-text-editor/fabric.css +58 -18
- package/styles/rich-text-editor/fluent-dark.css +57 -17
- package/styles/rich-text-editor/fluent.css +57 -17
- package/styles/rich-text-editor/highcontrast-light.css +57 -17
- package/styles/rich-text-editor/highcontrast.css +58 -18
- package/styles/rich-text-editor/icons/_bds.scss +351 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +7 -4
- package/styles/rich-text-editor/icons/_bootstrap.scss +7 -4
- package/styles/rich-text-editor/icons/_bootstrap4.scss +7 -4
- package/styles/rich-text-editor/icons/_bootstrap5.scss +7 -4
- package/styles/rich-text-editor/icons/_fabric-dark.scss +7 -4
- package/styles/rich-text-editor/icons/_fabric.scss +7 -4
- package/styles/rich-text-editor/icons/_fluent.scss +7 -4
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +7 -4
- package/styles/rich-text-editor/icons/_highcontrast.scss +7 -4
- package/styles/rich-text-editor/icons/_material-dark.scss +7 -4
- package/styles/rich-text-editor/icons/_material.scss +7 -4
- package/styles/rich-text-editor/icons/_material3.scss +7 -4
- package/styles/rich-text-editor/icons/_tailwind.scss +7 -4
- package/styles/rich-text-editor/material-dark.css +57 -17
- package/styles/rich-text-editor/material.css +57 -17
- package/styles/rich-text-editor/material3-dark.css +59 -19
- package/styles/rich-text-editor/material3.css +59 -19
- package/styles/rich-text-editor/tailwind-dark.css +61 -21
- package/styles/rich-text-editor/tailwind.css +61 -21
- package/styles/tailwind-dark.css +61 -21
- package/styles/tailwind.css +61 -21
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version :
|
|
3
|
+
* version : 25.1.35
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-richtexteditor@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-richtexteditor@
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@23.1.54",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-PsphjMpa/0wW711Fuq+Qd4CDUY2UbDH56WhYjnk/8Tuv01Gj42/krKh44yI6yJYJRZq+Q47NErl/5FJUNT0Ozg==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
26
26
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
27
27
|
],
|
|
28
|
-
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-23.1.54.tgz",
|
|
29
|
+
"_shasum": "40d45ccccd6bc1a49e83e34d5f9d850b12fefc33",
|
|
30
30
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
31
|
-
"_where": "/jenkins/workspace/elease-
|
|
31
|
+
"_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
|
|
32
32
|
"author": {
|
|
33
33
|
"name": "Syncfusion Inc."
|
|
34
34
|
},
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"bundleDependencies": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@syncfusion/ej2-base": "~
|
|
41
|
-
"@syncfusion/ej2-buttons": "~
|
|
42
|
-
"@syncfusion/ej2-filemanager": "~
|
|
43
|
-
"@syncfusion/ej2-inputs": "~
|
|
44
|
-
"@syncfusion/ej2-navigations": "~
|
|
45
|
-
"@syncfusion/ej2-popups": "~
|
|
46
|
-
"@syncfusion/ej2-splitbuttons": "~
|
|
40
|
+
"@syncfusion/ej2-base": "~25.1.35",
|
|
41
|
+
"@syncfusion/ej2-buttons": "~25.1.35",
|
|
42
|
+
"@syncfusion/ej2-filemanager": "~25.1.35",
|
|
43
|
+
"@syncfusion/ej2-inputs": "~25.1.35",
|
|
44
|
+
"@syncfusion/ej2-navigations": "~25.1.35",
|
|
45
|
+
"@syncfusion/ej2-popups": "~25.1.35",
|
|
46
|
+
"@syncfusion/ej2-splitbuttons": "~25.1.35"
|
|
47
47
|
},
|
|
48
48
|
"deprecated": false,
|
|
49
49
|
"description": "Essential JS 2 RichTextEditor component",
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
70
70
|
},
|
|
71
71
|
"typings": "index.d.ts",
|
|
72
|
-
"version": "
|
|
72
|
+
"version": "25.1.35",
|
|
73
73
|
"sideEffects": false
|
|
74
74
|
}
|
package/src/common/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IImageResizeFactor } from "./interface";
|
|
1
2
|
/**
|
|
2
3
|
* Default Markdown formats config for adapter
|
|
3
4
|
*/
|
|
@@ -46,3 +47,9 @@ export declare const listConversionFilters: {
|
|
|
46
47
|
* @hidden
|
|
47
48
|
*/
|
|
48
49
|
export declare const selfClosingTags: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Resize factor for image.
|
|
52
|
+
* @hidden
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export declare const imageResizeFactor: IImageResizeFactor;
|
package/src/common/config.js
CHANGED
|
@@ -128,3 +128,14 @@ export var selfClosingTags = [
|
|
|
128
128
|
'BR',
|
|
129
129
|
'IMG'
|
|
130
130
|
];
|
|
131
|
+
/**
|
|
132
|
+
* Resize factor for image.
|
|
133
|
+
* @hidden
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
export var imageResizeFactor = {
|
|
137
|
+
topLeft: [-1, -1],
|
|
138
|
+
topRight: [1, -1],
|
|
139
|
+
botRight: [1, 1],
|
|
140
|
+
botLeft: [-1, 1]
|
|
141
|
+
};
|
|
@@ -77,3 +77,15 @@ export interface IToolbarStatus {
|
|
|
77
77
|
numberFormatList?: string | boolean;
|
|
78
78
|
bulletFormatList?: string | boolean;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
|
|
82
|
+
* @private
|
|
83
|
+
*
|
|
84
|
+
*
|
|
85
|
+
* */
|
|
86
|
+
export interface IImageResizeFactor {
|
|
87
|
+
topLeft: [number, number];
|
|
88
|
+
topRight: [number, number];
|
|
89
|
+
botLeft: [number, number];
|
|
90
|
+
botRight: [number, number];
|
|
91
|
+
}
|
package/src/common/types.d.ts
CHANGED
|
@@ -18,3 +18,9 @@ export declare type EnterKey = 'P' | 'DIV' | 'BR';
|
|
|
18
18
|
* Defines tag to be used when shift + enter key is pressed.
|
|
19
19
|
*/
|
|
20
20
|
export declare type ShiftEnterKey = 'P' | 'DIV' | 'BR';
|
|
21
|
+
/**
|
|
22
|
+
* Defines the types of action to be used in the Rich Text Editor.
|
|
23
|
+
* @hidden
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export declare type ContentHeightSource = 'SourceCode' | 'Init' | 'Preview' | 'Maximize' | 'Minimize' | 'WindowResize' | 'Toolbar' | 'Resize' | 'Refresh';
|
|
@@ -317,10 +317,14 @@ export declare class DOMNode {
|
|
|
317
317
|
/**
|
|
318
318
|
* blockNodes method
|
|
319
319
|
*
|
|
320
|
+
* @param {boolean} action - Optional Boolean that specifies the action is whether performed.
|
|
320
321
|
* @returns {Node[]} - returns the node array values
|
|
321
322
|
* @hidden
|
|
322
323
|
|
|
323
324
|
*/
|
|
324
|
-
blockNodes(): Node[];
|
|
325
|
+
blockNodes(action?: boolean): Node[];
|
|
325
326
|
private ignoreTableTag;
|
|
327
|
+
private getPreBlockNodeCollection;
|
|
328
|
+
private getClosestInlineParent;
|
|
329
|
+
private wrapWithBlockNode;
|
|
326
330
|
}
|
|
@@ -670,11 +670,12 @@ var DOMNode = /** @class */ (function () {
|
|
|
670
670
|
/**
|
|
671
671
|
* blockNodes method
|
|
672
672
|
*
|
|
673
|
+
* @param {boolean} action - Optional Boolean that specifies the action is whether performed.
|
|
673
674
|
* @returns {Node[]} - returns the node array values
|
|
674
675
|
* @hidden
|
|
675
676
|
|
|
676
677
|
*/
|
|
677
|
-
DOMNode.prototype.blockNodes = function () {
|
|
678
|
+
DOMNode.prototype.blockNodes = function (action) {
|
|
678
679
|
var collectionNodes = [];
|
|
679
680
|
var selection = this.getSelection();
|
|
680
681
|
if (this.isEditorArea() && selection.rangeCount) {
|
|
@@ -688,23 +689,46 @@ var DOMNode = /** @class */ (function () {
|
|
|
688
689
|
collectionNodes.push(startNode);
|
|
689
690
|
}
|
|
690
691
|
parentNode = this.blockParentNode(startNode);
|
|
692
|
+
var endParentNode = this.blockParentNode(endNode);
|
|
691
693
|
if (parentNode && collectionNodes.indexOf(parentNode) < 0) {
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
694
|
+
if (!isNOU(action) && action) {
|
|
695
|
+
if (range.commonAncestorContainer.nodeName === 'TD' || parentNode.nodeName === 'TD' || endParentNode.nodeName === 'TD') {
|
|
696
|
+
var processedNodes = this.getPreBlockNodeCollection(range);
|
|
697
|
+
if (processedNodes.length > 1) {
|
|
698
|
+
this.wrapWithBlockNode(processedNodes, collectionNodes);
|
|
699
|
+
}
|
|
700
|
+
else if (processedNodes.length > 0) {
|
|
701
|
+
if (startNode !== endNode && startNode.nodeName !== 'BR') {
|
|
702
|
+
collectionNodes.push(this.createTempNode(startNode));
|
|
703
|
+
}
|
|
704
|
+
else if (startNode === endNode && startNode.nodeName === 'SPAN' && (startNode.classList.contains(markerClassName.startSelection)
|
|
705
|
+
|| startNode.classList.contains(markerClassName.endSelection))) {
|
|
706
|
+
collectionNodes.push(this.createTempNode(startNode));
|
|
707
|
+
}
|
|
708
|
+
}
|
|
701
709
|
}
|
|
702
710
|
else {
|
|
703
|
-
collectionNodes.push(
|
|
711
|
+
collectionNodes.push(parentNode);
|
|
704
712
|
}
|
|
705
713
|
}
|
|
706
714
|
else {
|
|
707
|
-
|
|
715
|
+
if (CONSTANT.IGNORE_BLOCK_TAGS.indexOf(parentNode.tagName.toLocaleLowerCase()) >= 0 && (startNode.tagName === 'BR' ||
|
|
716
|
+
startNode.nodeType === Node.TEXT_NODE ||
|
|
717
|
+
startNode.classList.contains(markerClassName.startSelection) ||
|
|
718
|
+
startNode.classList.contains(markerClassName.endSelection))) {
|
|
719
|
+
var tempNode = startNode.previousSibling &&
|
|
720
|
+
startNode.previousSibling.nodeType === Node.TEXT_NODE ?
|
|
721
|
+
startNode.previousSibling : startNode;
|
|
722
|
+
if (!startNode.nextSibling && !startNode.previousSibling && startNode.tagName === 'BR') {
|
|
723
|
+
collectionNodes.push(tempNode);
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
collectionNodes.push(this.createTempNode(tempNode));
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
collectionNodes.push(parentNode);
|
|
731
|
+
}
|
|
708
732
|
}
|
|
709
733
|
}
|
|
710
734
|
var nodes = [];
|
|
@@ -773,6 +797,131 @@ var DOMNode = /** @class */ (function () {
|
|
|
773
797
|
DOMNode.prototype.ignoreTableTag = function (element) {
|
|
774
798
|
return !(CONSTANT.TABLE_BLOCK_TAGS.indexOf(element.tagName.toLocaleLowerCase()) >= 0);
|
|
775
799
|
};
|
|
800
|
+
DOMNode.prototype.getPreBlockNodeCollection = function (range) {
|
|
801
|
+
var startNode = this.getSelectedNode(range.startContainer, range.startOffset);
|
|
802
|
+
var endNode = this.getSelectedNode(range.endContainer, range.endOffset);
|
|
803
|
+
var nodes = [];
|
|
804
|
+
var rootNode = startNode.closest('td, th');
|
|
805
|
+
if (isNOU(rootNode)) {
|
|
806
|
+
return nodes;
|
|
807
|
+
}
|
|
808
|
+
var rootChildNode = Array.from(rootNode.childNodes);
|
|
809
|
+
var isContinue = true;
|
|
810
|
+
var processedStart = this.getClosestInlineParent(startNode, rootNode, true);
|
|
811
|
+
var processedEnd = this.getClosestInlineParent(endNode, rootNode, false);
|
|
812
|
+
for (var i = 0; i < rootChildNode.length; i++) {
|
|
813
|
+
var child = rootChildNode[i];
|
|
814
|
+
if (processedStart === processedEnd && child === processedStart) {
|
|
815
|
+
nodes.push(child);
|
|
816
|
+
isContinue = true;
|
|
817
|
+
}
|
|
818
|
+
else if (child === processedStart) {
|
|
819
|
+
isContinue = false;
|
|
820
|
+
}
|
|
821
|
+
else if (child === processedEnd) {
|
|
822
|
+
nodes.push(child); // Early Exit so Push the end node.
|
|
823
|
+
isContinue = true;
|
|
824
|
+
}
|
|
825
|
+
if (isContinue) {
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
nodes.push(child);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return nodes;
|
|
833
|
+
};
|
|
834
|
+
DOMNode.prototype.getClosestInlineParent = function (node, rootNode, isStart) {
|
|
835
|
+
// 1. If the node is a text node, return the node
|
|
836
|
+
// 2. If the node is a block node return block node
|
|
837
|
+
// 3. If the node is a inline node,
|
|
838
|
+
// Traverse back untill the TD or TH node
|
|
839
|
+
// Check if the the previous sibling , next sibling is a block node.
|
|
840
|
+
// If yes return the inline node that is closest to the block node.
|
|
841
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
842
|
+
return node;
|
|
843
|
+
}
|
|
844
|
+
if (this.isBlockNode(node)) {
|
|
845
|
+
return node;
|
|
846
|
+
}
|
|
847
|
+
var currentNode = node;
|
|
848
|
+
var rootFlag = false;
|
|
849
|
+
while (currentNode) {
|
|
850
|
+
var previousNode = currentNode;
|
|
851
|
+
if (rootFlag) {
|
|
852
|
+
if (this.isBlockNode(currentNode)) {
|
|
853
|
+
return previousNode;
|
|
854
|
+
}
|
|
855
|
+
if (isStart && currentNode.previousSibling) {
|
|
856
|
+
if (this.isBlockNode(currentNode.previousSibling) || currentNode.previousSibling.nodeName === 'BR') {
|
|
857
|
+
return previousNode;
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
currentNode = currentNode.previousSibling;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else if (!isStart && currentNode.nextSibling) {
|
|
864
|
+
if (this.isBlockNode(currentNode.nextSibling) || currentNode.nextSibling.nodeName === 'BR') {
|
|
865
|
+
return previousNode;
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
currentNode = currentNode.nextSibling;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
return currentNode;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
else {
|
|
876
|
+
currentNode = currentNode.parentElement;
|
|
877
|
+
if (currentNode === rootNode) {
|
|
878
|
+
currentNode = previousNode;
|
|
879
|
+
rootFlag = true;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return null;
|
|
884
|
+
};
|
|
885
|
+
DOMNode.prototype.wrapWithBlockNode = function (nodes, collectionNodes) {
|
|
886
|
+
var wrapperElement = createElement('p');
|
|
887
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
888
|
+
var child = nodes[i];
|
|
889
|
+
if (child.nodeName === 'BR') {
|
|
890
|
+
child.parentNode.insertBefore(wrapperElement, child);
|
|
891
|
+
wrapperElement.appendChild(child);
|
|
892
|
+
if (wrapperElement.childNodes.length > 0) {
|
|
893
|
+
collectionNodes.push(wrapperElement);
|
|
894
|
+
}
|
|
895
|
+
wrapperElement = createElement('p');
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
if (!this.isBlockNode(child)) {
|
|
899
|
+
if (child.nodeName === '#text' && child.textContent.trim() === '') {
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
if (wrapperElement.childElementCount === 0) {
|
|
903
|
+
child.parentNode.insertBefore(wrapperElement, child);
|
|
904
|
+
wrapperElement.appendChild(child);
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
wrapperElement.appendChild(child);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
collectionNodes.push(child);
|
|
912
|
+
}
|
|
913
|
+
// Use case when the BR is next sibling but the BR is not the part of selection.
|
|
914
|
+
if ((i === nodes.length - 1) && wrapperElement.nextElementSibling &&
|
|
915
|
+
wrapperElement.querySelectorAll('br').length === 0 &&
|
|
916
|
+
wrapperElement.nextElementSibling.nodeName === 'BR') {
|
|
917
|
+
wrapperElement.appendChild(wrapperElement.nextElementSibling);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
if (wrapperElement.childNodes.length > 0 && collectionNodes.indexOf(wrapperElement) < 0) {
|
|
922
|
+
collectionNodes.push(wrapperElement);
|
|
923
|
+
}
|
|
924
|
+
};
|
|
776
925
|
return DOMNode;
|
|
777
926
|
}());
|
|
778
927
|
export { DOMNode };
|
|
@@ -242,7 +242,7 @@ var Formats = /** @class */ (function () {
|
|
|
242
242
|
}
|
|
243
243
|
var save = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
244
244
|
this.parent.domNode.setMarker(save);
|
|
245
|
-
var formatsNodes = this.parent.domNode.blockNodes();
|
|
245
|
+
var formatsNodes = this.parent.domNode.blockNodes(true);
|
|
246
246
|
if (e.enterAction === 'BR') {
|
|
247
247
|
this.setSelectionBRConfig();
|
|
248
248
|
var allSelectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument);
|
|
@@ -79,7 +79,6 @@ var ImageCommand = /** @class */ (function () {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
ImageCommand.prototype.createImage = function (e) {
|
|
82
|
-
var _this = this;
|
|
83
82
|
var isReplaced = false;
|
|
84
83
|
e.item.url = isNOU(e.item.url) || e.item.url === 'undefined' ? e.item.src : e.item.url;
|
|
85
84
|
if (!isNOU(e.item.selectParent) && e.item.selectParent[0].tagName === 'IMG') {
|
|
@@ -109,21 +108,18 @@ var ImageCommand = /** @class */ (function () {
|
|
|
109
108
|
var selectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)[0];
|
|
110
109
|
var imgElm_1 = (e.value === 'Replace' || isReplaced) ? e.item.selectParent[0] :
|
|
111
110
|
(Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (e.value === 'Replace') {
|
|
125
|
-
e.item.subCommand = 'Replace';
|
|
126
|
-
this.callBack(e);
|
|
111
|
+
var imageInstance_1 = this;
|
|
112
|
+
var onImageLoadEvent_1 = function () {
|
|
113
|
+
e.callBack({
|
|
114
|
+
requestType: (e.value === 'Replace') ? (e.item.subCommand = 'Replace', "Replace") : 'Images',
|
|
115
|
+
editorMode: 'HTML',
|
|
116
|
+
event: e.event,
|
|
117
|
+
range: imageInstance_1.parent.nodeSelection.getRange(imageInstance_1.parent.currentDocument),
|
|
118
|
+
elements: [imgElm_1]
|
|
119
|
+
});
|
|
120
|
+
imgElm_1.removeEventListener('load', onImageLoadEvent_1);
|
|
121
|
+
};
|
|
122
|
+
imgElm_1.addEventListener('load', onImageLoadEvent_1);
|
|
127
123
|
}
|
|
128
124
|
};
|
|
129
125
|
ImageCommand.prototype.setStyle = function (imgElement, e, imgReplace) {
|
|
@@ -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);
|
|
@@ -554,6 +558,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
554
558
|
};
|
|
555
559
|
InsertHtml.closestEle = function (element, editNode) {
|
|
556
560
|
var el = element;
|
|
561
|
+
if (closest(el, 'li')) {
|
|
562
|
+
return closest(el, 'li');
|
|
563
|
+
}
|
|
557
564
|
while (el && el.nodeType === 1) {
|
|
558
565
|
if (el.parentNode === editNode ||
|
|
559
566
|
(!isNOU(el.parentNode.tagName) &&
|
|
@@ -564,6 +571,30 @@ var InsertHtml = /** @class */ (function () {
|
|
|
564
571
|
}
|
|
565
572
|
return null;
|
|
566
573
|
};
|
|
574
|
+
InsertHtml.insertTableInList = function (range, insertNode, parentNode, currentNode, nodeCutter) {
|
|
575
|
+
if (range.collapsed) {
|
|
576
|
+
var isStart = range.startOffset === 0;
|
|
577
|
+
var isEnd = range.startContainer.textContent.trimEnd().length === range.startOffset;
|
|
578
|
+
if (isStart || isEnd) {
|
|
579
|
+
if (isStart) {
|
|
580
|
+
InsertMethods.AppendBefore(insertNode, currentNode, false);
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
InsertMethods.AppendBefore(insertNode, currentNode, true);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
var preNode = nodeCutter.SplitNode(range, parentNode, true);
|
|
588
|
+
var sibNode = preNode.previousSibling;
|
|
589
|
+
sibNode.appendChild(insertNode);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
range.deleteContents();
|
|
594
|
+
parentNode.appendChild(insertNode);
|
|
595
|
+
}
|
|
596
|
+
insertNode.classList.add('ignore-table');
|
|
597
|
+
};
|
|
567
598
|
/**
|
|
568
599
|
* Insert method
|
|
569
600
|
*
|
|
@@ -194,7 +194,7 @@ var LinkCommand = /** @class */ (function () {
|
|
|
194
194
|
for (var i = 0, j_2 = 0, k = 0; i <= finalinlineNodes.length; i++) {
|
|
195
195
|
if (i === 0) {
|
|
196
196
|
finalinlineNodes[i].parentNode.insertBefore(anchorNodes[j_2], finalinlineNodes[i].nextSibling);
|
|
197
|
-
if (this.parent.domNode.blockNodes().length === 1) {
|
|
197
|
+
if (this.parent.domNode.blockNodes().length === 1 && anchorNodes.length === 1) {
|
|
198
198
|
this.parent.nodeSelection.setSelectionNode(this.parent.currentDocument, anchorNodes[j_2]);
|
|
199
199
|
}
|
|
200
200
|
removeNodes[k] = finalinlineNodes[i];
|
|
@@ -114,7 +114,8 @@ var Lists = /** @class */ (function () {
|
|
|
114
114
|
startNode.textContent = '';
|
|
115
115
|
}
|
|
116
116
|
var startNodeParent = startNode.parentElement;
|
|
117
|
-
|
|
117
|
+
var parentOfCurrentOLUL = startNodeParent.parentElement;
|
|
118
|
+
if (isNOU(parentOfCurrentOLUL.closest('UL')) && isNOU(parentOfCurrentOLUL.closest('OL'))) {
|
|
118
119
|
if (!isNOU(startNode.nextElementSibling)) {
|
|
119
120
|
var nearBlockNode = this.parent.domNode.blockParentNode(startNode);
|
|
120
121
|
this.parent.nodeCutter.GetSpliceNode(range, nearBlockNode);
|
|
@@ -141,6 +142,15 @@ var Lists = /** @class */ (function () {
|
|
|
141
142
|
detach(startNode);
|
|
142
143
|
}
|
|
143
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
|
+
}
|
|
144
154
|
}
|
|
145
155
|
};
|
|
146
156
|
Lists.prototype.backspaceList = function (e) {
|
|
@@ -514,7 +524,7 @@ var Lists = /** @class */ (function () {
|
|
|
514
524
|
this.currentAction = e.subCommand;
|
|
515
525
|
this.currentAction = e.subCommand = this.currentAction === 'NumberFormatList' ? 'OL' : this.currentAction === 'BulletFormatList' ? 'UL' : this.currentAction;
|
|
516
526
|
this.domNode.setMarker(this.saveSelection);
|
|
517
|
-
var listsNodes = this.domNode.blockNodes();
|
|
527
|
+
var listsNodes = this.domNode.blockNodes(true);
|
|
518
528
|
if (e.enterAction === 'BR') {
|
|
519
529
|
this.setSelectionBRConfig();
|
|
520
530
|
var allSelectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument);
|
|
@@ -629,6 +639,18 @@ var Lists = /** @class */ (function () {
|
|
|
629
639
|
listEle.innerHTML = '<li><br/></li>';
|
|
630
640
|
elements[i].appendChild(listEle);
|
|
631
641
|
}
|
|
642
|
+
else if ('LI' !== elements[i].tagName && isNOU(item) &&
|
|
643
|
+
elements[i].nodeName === 'BLOCKQUOTE') {
|
|
644
|
+
isReverse = false;
|
|
645
|
+
var elemAtt = this.domNode.attributes(elements[i]);
|
|
646
|
+
var openTag = '<' + type + '>';
|
|
647
|
+
var closeTag = '</' + type + '>';
|
|
648
|
+
var newTag = 'li' + elemAtt;
|
|
649
|
+
var replaceHTML = elements[i].innerHTML;
|
|
650
|
+
var innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
|
|
651
|
+
var collectionString = openTag + innerHTML + closeTag;
|
|
652
|
+
elements[i].innerHTML = collectionString;
|
|
653
|
+
}
|
|
632
654
|
else if ('LI' !== elements[i].tagName && isNOU(item)) {
|
|
633
655
|
isReverse = false;
|
|
634
656
|
var elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|