@syncfusion/ej2-richtexteditor 24.2.9 → 25.1.37
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 +32 -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 +936 -500
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +921 -490
- 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 +163 -13
- 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 +36 -2
- package/src/editor-manager/plugin/ms-word-clean-up.js +67 -59
- package/src/editor-manager/plugin/selection-commands.js +56 -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 +83 -62
- 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 +68 -11
- 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 +61 -17
- package/styles/bootstrap.css +62 -18
- package/styles/bootstrap4.css +62 -18
- package/styles/bootstrap5-dark.css +68 -17
- package/styles/bootstrap5.css +68 -17
- package/styles/fabric-dark.css +61 -17
- package/styles/fabric.css +62 -18
- package/styles/fluent-dark.css +61 -17
- package/styles/fluent.css +61 -17
- package/styles/highcontrast-light.css +61 -17
- package/styles/highcontrast.css +62 -18
- package/styles/material-dark.css +61 -17
- package/styles/material.css +61 -17
- package/styles/material3-dark.css +63 -19
- package/styles/material3.css +63 -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 +51 -17
- 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 +61 -17
- package/styles/rich-text-editor/bootstrap.css +62 -18
- package/styles/rich-text-editor/bootstrap4.css +62 -18
- package/styles/rich-text-editor/bootstrap5-dark.css +68 -17
- package/styles/rich-text-editor/bootstrap5.css +68 -17
- package/styles/rich-text-editor/fabric-dark.css +61 -17
- package/styles/rich-text-editor/fabric.css +62 -18
- package/styles/rich-text-editor/fluent-dark.css +61 -17
- package/styles/rich-text-editor/fluent.css +61 -17
- package/styles/rich-text-editor/highcontrast-light.css +61 -17
- package/styles/rich-text-editor/highcontrast.css +62 -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 +61 -17
- package/styles/rich-text-editor/material.css +61 -17
- package/styles/rich-text-editor/material3-dark.css +63 -19
- package/styles/rich-text-editor/material3.css +63 -19
- package/styles/rich-text-editor/tailwind-dark.css +65 -25
- package/styles/rich-text-editor/tailwind.css +65 -25
- package/styles/tailwind-dark.css +65 -25
- package/styles/tailwind.css +65 -25
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.37
|
|
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@25.1.35",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512
|
|
5
|
+
"_integrity": "sha512-+ZVGzeuC6zPgsx8Ydma2G5WgxqpfYz7NnO17cQwk7cLzhoGTJqSrY/dcHCwPYe884mJ4hm0P6QB1mD9kUXywFA==",
|
|
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-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-25.1.35.tgz",
|
|
29
|
+
"_shasum": "9b56182752bfc14fa4ccfbe95f8a3875a66ecabc",
|
|
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.37",
|
|
43
|
+
"@syncfusion/ej2-inputs": "~25.1.37",
|
|
44
|
+
"@syncfusion/ej2-navigations": "~25.1.37",
|
|
45
|
+
"@syncfusion/ej2-popups": "~25.1.35",
|
|
46
|
+
"@syncfusion/ej2-splitbuttons": "~25.1.37"
|
|
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.37",
|
|
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
|
}
|
|
@@ -580,7 +580,8 @@ var DOMNode = /** @class */ (function () {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
else {
|
|
583
|
-
|
|
583
|
+
var tagName = !isNOU(start.parentElement) ? start.parentElement.tagName.toLocaleLowerCase() : '';
|
|
584
|
+
if (start.tagName === 'IMG' && tagName !== 'p' && tagName !== 'div') {
|
|
584
585
|
var parNode = document.createElement('p');
|
|
585
586
|
start.parentElement.insertBefore(parNode, start);
|
|
586
587
|
parNode.appendChild(start);
|
|
@@ -670,11 +671,12 @@ var DOMNode = /** @class */ (function () {
|
|
|
670
671
|
/**
|
|
671
672
|
* blockNodes method
|
|
672
673
|
*
|
|
674
|
+
* @param {boolean} action - Optional Boolean that specifies the action is whether performed.
|
|
673
675
|
* @returns {Node[]} - returns the node array values
|
|
674
676
|
* @hidden
|
|
675
677
|
|
|
676
678
|
*/
|
|
677
|
-
DOMNode.prototype.blockNodes = function () {
|
|
679
|
+
DOMNode.prototype.blockNodes = function (action) {
|
|
678
680
|
var collectionNodes = [];
|
|
679
681
|
var selection = this.getSelection();
|
|
680
682
|
if (this.isEditorArea() && selection.rangeCount) {
|
|
@@ -688,23 +690,46 @@ var DOMNode = /** @class */ (function () {
|
|
|
688
690
|
collectionNodes.push(startNode);
|
|
689
691
|
}
|
|
690
692
|
parentNode = this.blockParentNode(startNode);
|
|
693
|
+
var endParentNode = this.blockParentNode(endNode);
|
|
691
694
|
if (parentNode && collectionNodes.indexOf(parentNode) < 0) {
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
695
|
+
if (!isNOU(action) && action) {
|
|
696
|
+
if (range.commonAncestorContainer.nodeName === 'TD' || parentNode.nodeName === 'TD' || endParentNode.nodeName === 'TD') {
|
|
697
|
+
var processedNodes = this.getPreBlockNodeCollection(range);
|
|
698
|
+
if (processedNodes.length > 1) {
|
|
699
|
+
this.wrapWithBlockNode(processedNodes, collectionNodes);
|
|
700
|
+
}
|
|
701
|
+
else if (processedNodes.length > 0) {
|
|
702
|
+
if (startNode !== endNode && startNode.nodeName !== 'BR') {
|
|
703
|
+
collectionNodes.push(this.createTempNode(startNode));
|
|
704
|
+
}
|
|
705
|
+
else if (startNode === endNode && startNode.nodeName === 'SPAN' && (startNode.classList.contains(markerClassName.startSelection)
|
|
706
|
+
|| startNode.classList.contains(markerClassName.endSelection))) {
|
|
707
|
+
collectionNodes.push(this.createTempNode(startNode));
|
|
708
|
+
}
|
|
709
|
+
}
|
|
701
710
|
}
|
|
702
711
|
else {
|
|
703
|
-
collectionNodes.push(
|
|
712
|
+
collectionNodes.push(parentNode);
|
|
704
713
|
}
|
|
705
714
|
}
|
|
706
715
|
else {
|
|
707
|
-
|
|
716
|
+
if (CONSTANT.IGNORE_BLOCK_TAGS.indexOf(parentNode.tagName.toLocaleLowerCase()) >= 0 && (startNode.tagName === 'BR' ||
|
|
717
|
+
startNode.nodeType === Node.TEXT_NODE ||
|
|
718
|
+
startNode.classList.contains(markerClassName.startSelection) ||
|
|
719
|
+
startNode.classList.contains(markerClassName.endSelection))) {
|
|
720
|
+
var tempNode = startNode.previousSibling &&
|
|
721
|
+
startNode.previousSibling.nodeType === Node.TEXT_NODE ?
|
|
722
|
+
startNode.previousSibling : startNode;
|
|
723
|
+
if (!startNode.nextSibling && !startNode.previousSibling && startNode.tagName === 'BR') {
|
|
724
|
+
collectionNodes.push(tempNode);
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
collectionNodes.push(this.createTempNode(tempNode));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
collectionNodes.push(parentNode);
|
|
732
|
+
}
|
|
708
733
|
}
|
|
709
734
|
}
|
|
710
735
|
var nodes = [];
|
|
@@ -773,6 +798,131 @@ var DOMNode = /** @class */ (function () {
|
|
|
773
798
|
DOMNode.prototype.ignoreTableTag = function (element) {
|
|
774
799
|
return !(CONSTANT.TABLE_BLOCK_TAGS.indexOf(element.tagName.toLocaleLowerCase()) >= 0);
|
|
775
800
|
};
|
|
801
|
+
DOMNode.prototype.getPreBlockNodeCollection = function (range) {
|
|
802
|
+
var startNode = this.getSelectedNode(range.startContainer, range.startOffset);
|
|
803
|
+
var endNode = this.getSelectedNode(range.endContainer, range.endOffset);
|
|
804
|
+
var nodes = [];
|
|
805
|
+
var rootNode = startNode.closest('td, th');
|
|
806
|
+
if (isNOU(rootNode)) {
|
|
807
|
+
return nodes;
|
|
808
|
+
}
|
|
809
|
+
var rootChildNode = Array.from(rootNode.childNodes);
|
|
810
|
+
var isContinue = true;
|
|
811
|
+
var processedStart = this.getClosestInlineParent(startNode, rootNode, true);
|
|
812
|
+
var processedEnd = this.getClosestInlineParent(endNode, rootNode, false);
|
|
813
|
+
for (var i = 0; i < rootChildNode.length; i++) {
|
|
814
|
+
var child = rootChildNode[i];
|
|
815
|
+
if (processedStart === processedEnd && child === processedStart) {
|
|
816
|
+
nodes.push(child);
|
|
817
|
+
isContinue = true;
|
|
818
|
+
}
|
|
819
|
+
else if (child === processedStart) {
|
|
820
|
+
isContinue = false;
|
|
821
|
+
}
|
|
822
|
+
else if (child === processedEnd) {
|
|
823
|
+
nodes.push(child); // Early Exit so Push the end node.
|
|
824
|
+
isContinue = true;
|
|
825
|
+
}
|
|
826
|
+
if (isContinue) {
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
nodes.push(child);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
return nodes;
|
|
834
|
+
};
|
|
835
|
+
DOMNode.prototype.getClosestInlineParent = function (node, rootNode, isStart) {
|
|
836
|
+
// 1. If the node is a text node, return the node
|
|
837
|
+
// 2. If the node is a block node return block node
|
|
838
|
+
// 3. If the node is a inline node,
|
|
839
|
+
// Traverse back untill the TD or TH node
|
|
840
|
+
// Check if the the previous sibling , next sibling is a block node.
|
|
841
|
+
// If yes return the inline node that is closest to the block node.
|
|
842
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
843
|
+
return node;
|
|
844
|
+
}
|
|
845
|
+
if (this.isBlockNode(node)) {
|
|
846
|
+
return node;
|
|
847
|
+
}
|
|
848
|
+
var currentNode = node;
|
|
849
|
+
var rootFlag = false;
|
|
850
|
+
while (currentNode) {
|
|
851
|
+
var previousNode = currentNode;
|
|
852
|
+
if (rootFlag) {
|
|
853
|
+
if (this.isBlockNode(currentNode)) {
|
|
854
|
+
return previousNode;
|
|
855
|
+
}
|
|
856
|
+
if (isStart && currentNode.previousSibling) {
|
|
857
|
+
if (this.isBlockNode(currentNode.previousSibling) || currentNode.previousSibling.nodeName === 'BR') {
|
|
858
|
+
return previousNode;
|
|
859
|
+
}
|
|
860
|
+
else {
|
|
861
|
+
currentNode = currentNode.previousSibling;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
else if (!isStart && currentNode.nextSibling) {
|
|
865
|
+
if (this.isBlockNode(currentNode.nextSibling) || currentNode.nextSibling.nodeName === 'BR') {
|
|
866
|
+
return previousNode;
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
currentNode = currentNode.nextSibling;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
return currentNode;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
else {
|
|
877
|
+
currentNode = currentNode.parentElement;
|
|
878
|
+
if (currentNode === rootNode) {
|
|
879
|
+
currentNode = previousNode;
|
|
880
|
+
rootFlag = true;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return null;
|
|
885
|
+
};
|
|
886
|
+
DOMNode.prototype.wrapWithBlockNode = function (nodes, collectionNodes) {
|
|
887
|
+
var wrapperElement = createElement('p');
|
|
888
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
889
|
+
var child = nodes[i];
|
|
890
|
+
if (child.nodeName === 'BR') {
|
|
891
|
+
child.parentNode.insertBefore(wrapperElement, child);
|
|
892
|
+
wrapperElement.appendChild(child);
|
|
893
|
+
if (wrapperElement.childNodes.length > 0) {
|
|
894
|
+
collectionNodes.push(wrapperElement);
|
|
895
|
+
}
|
|
896
|
+
wrapperElement = createElement('p');
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
if (!this.isBlockNode(child)) {
|
|
900
|
+
if (child.nodeName === '#text' && child.textContent.trim() === '') {
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
if (wrapperElement.childElementCount === 0) {
|
|
904
|
+
child.parentNode.insertBefore(wrapperElement, child);
|
|
905
|
+
wrapperElement.appendChild(child);
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
wrapperElement.appendChild(child);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
collectionNodes.push(child);
|
|
913
|
+
}
|
|
914
|
+
// Use case when the BR is next sibling but the BR is not the part of selection.
|
|
915
|
+
if ((i === nodes.length - 1) && wrapperElement.nextElementSibling &&
|
|
916
|
+
wrapperElement.querySelectorAll('br').length === 0 &&
|
|
917
|
+
wrapperElement.nextElementSibling.nodeName === 'BR') {
|
|
918
|
+
wrapperElement.appendChild(wrapperElement.nextElementSibling);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
if (wrapperElement.childNodes.length > 0 && collectionNodes.indexOf(wrapperElement) < 0) {
|
|
923
|
+
collectionNodes.push(wrapperElement);
|
|
924
|
+
}
|
|
925
|
+
};
|
|
776
926
|
return DOMNode;
|
|
777
927
|
}());
|
|
778
928
|
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]);
|
|
@@ -721,8 +743,17 @@ var Lists = /** @class */ (function () {
|
|
|
721
743
|
};
|
|
722
744
|
Lists.prototype.cleanNode = function () {
|
|
723
745
|
var liParents = this.parent.editableElement.querySelectorAll('ol + ol, ul + ul');
|
|
746
|
+
var listStyleType;
|
|
747
|
+
var firstNodeOL;
|
|
724
748
|
for (var c = 0; c < liParents.length; c++) {
|
|
725
749
|
var node = liParents[c];
|
|
750
|
+
var toFindtopOlUl = true;
|
|
751
|
+
if (toFindtopOlUl && (liParents[c].parentElement.parentElement.nodeName === 'OL' || liParents[c].parentElement.parentElement.nodeName === 'UL')) {
|
|
752
|
+
toFindtopOlUl = false;
|
|
753
|
+
var preElement = liParents[c].parentElement.parentElement;
|
|
754
|
+
listStyleType = preElement.style.listStyleType;
|
|
755
|
+
firstNodeOL = node.previousElementSibling;
|
|
756
|
+
}
|
|
726
757
|
if (this.domNode.isList(node.previousElementSibling) &&
|
|
727
758
|
this.domNode.openTagString(node) === this.domNode.openTagString(node.previousElementSibling)) {
|
|
728
759
|
var contentNodes = this.domNode.contents(node);
|
|
@@ -737,6 +768,9 @@ var Lists = /** @class */ (function () {
|
|
|
737
768
|
}
|
|
738
769
|
}
|
|
739
770
|
}
|
|
771
|
+
if (firstNodeOL) {
|
|
772
|
+
firstNodeOL.style.listStyleType = listStyleType;
|
|
773
|
+
}
|
|
740
774
|
};
|
|
741
775
|
Lists.prototype.findUnSelected = function (temp, elements) {
|
|
742
776
|
temp = temp.slice().reverse();
|