@syncfusion/ej2-richtexteditor 27.1.57 → 27.2.2
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/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 +241 -100
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +231 -77
- 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 +0 -7
- package/src/common/config.js +0 -12
- package/src/common/editor-styles.js +1 -1
- package/src/common/interface.d.ts +2 -0
- package/src/common/util.js +2 -1
- package/src/editor-manager/base/constant.d.ts +4 -0
- package/src/editor-manager/base/constant.js +4 -0
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +25 -0
- package/src/editor-manager/plugin/image.js +8 -2
- package/src/editor-manager/plugin/inserthtml.d.ts +2 -0
- package/src/editor-manager/plugin/inserthtml.js +96 -17
- package/src/editor-manager/plugin/nodecutter.js +2 -2
- package/src/rich-text-editor/actions/html-editor.js +9 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +48 -21
- package/src/rich-text-editor/base/rich-text-editor.js +5 -2
- package/src/rich-text-editor/renderer/image-module.js +7 -6
- package/src/rich-text-editor/renderer/slash-menu.js +9 -0
- package/src/rich-text-editor/renderer/table-module.js +1 -1
- package/src/selection/selection.d.ts +2 -1
- package/src/selection/selection.js +15 -12
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 27.
|
|
3
|
+
* version : 27.2.2
|
|
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@27.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@27.1.58",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-Mh3t2LCFc+U9cNHK+RW1CSAMAdEXR1MtXB6bm0CzjWQUvz5Rw96pX4GLVIiNEnodxod34bycX8mXnV1Blrr1Hg==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -25,8 +25,8 @@
|
|
|
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-27.1.
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-27.1.58.tgz",
|
|
29
|
+
"_shasum": "a8af7e987df55ace85a6b6f36e76e57aebab28fd",
|
|
30
30
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
31
31
|
"_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
|
|
32
32
|
"author": {
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
},
|
|
38
38
|
"bundleDependencies": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@syncfusion/ej2-base": "~27.
|
|
41
|
-
"@syncfusion/ej2-buttons": "~27.
|
|
42
|
-
"@syncfusion/ej2-dropdowns": "~27.
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~27.
|
|
44
|
-
"@syncfusion/ej2-inputs": "~27.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~27.
|
|
46
|
-
"@syncfusion/ej2-popups": "~27.
|
|
47
|
-
"@syncfusion/ej2-splitbuttons": "~27.
|
|
40
|
+
"@syncfusion/ej2-base": "~27.2.2",
|
|
41
|
+
"@syncfusion/ej2-buttons": "~27.2.2",
|
|
42
|
+
"@syncfusion/ej2-dropdowns": "~27.2.2",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~27.2.2",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~27.2.2",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~27.2.2",
|
|
46
|
+
"@syncfusion/ej2-popups": "~27.2.2",
|
|
47
|
+
"@syncfusion/ej2-splitbuttons": "~27.2.2"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
50
50
|
"description": "Essential JS 2 RichTextEditor component",
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
81
81
|
},
|
|
82
82
|
"typings": "index.d.ts",
|
|
83
|
-
"version": "27.
|
|
83
|
+
"version": "27.2.2",
|
|
84
84
|
"sideEffects": false
|
|
85
85
|
}
|
package/src/common/config.d.ts
CHANGED
|
@@ -54,13 +54,6 @@ export declare const selfClosingTags: string[];
|
|
|
54
54
|
*
|
|
55
55
|
*/
|
|
56
56
|
export declare const imageResizeFactor: IImageResizeFactor;
|
|
57
|
-
/**
|
|
58
|
-
* Resize factor for image in iframe editor.
|
|
59
|
-
*
|
|
60
|
-
*@hidden
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
export declare const iframeResizeFactor: IImageResizeFactor;
|
|
64
57
|
/**
|
|
65
58
|
* Mention restrict key configuration.
|
|
66
59
|
*
|
package/src/common/config.js
CHANGED
|
@@ -142,18 +142,6 @@ export var imageResizeFactor = {
|
|
|
142
142
|
botRight: [1, 1],
|
|
143
143
|
botLeft: [-1, 1]
|
|
144
144
|
};
|
|
145
|
-
/**
|
|
146
|
-
* Resize factor for image in iframe editor.
|
|
147
|
-
*
|
|
148
|
-
*@hidden
|
|
149
|
-
*
|
|
150
|
-
*/
|
|
151
|
-
export var iframeResizeFactor = {
|
|
152
|
-
topLeft: [-1.2, -1.2],
|
|
153
|
-
topRight: [1.2, -1.2],
|
|
154
|
-
botRight: [1.2, 1.2],
|
|
155
|
-
botLeft: [-1.2, 1.2]
|
|
156
|
-
};
|
|
157
145
|
/**
|
|
158
146
|
* Mention restrict key configuration.
|
|
159
147
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var IFRAME_EDITOR_STYLES = "\n@charset \"UTF-8\";\n\nhtml {\n height: auto;\n}\n\nhtml, body {\n margin: 0;\n}\n\nbody {\n color: #333;\n word-wrap: break-word;\n}\n\n.e-content {\n background: unset;\n box-sizing: border-box;\n min-height: 100px;\n outline: 0 solid transparent;\n padding: 16px;\n position: relative;\n overflow-x: auto;\n font-weight: normal;\n line-height: 1.5;\n font-size: 14px;\n text-align: inherit;\n font-family: \"Roboto\", \"Segoe UI\", \"GeezaPro\", \"DejaVu Serif\", \"sans-serif\", \"-apple-system\", \"BlinkMacSystemFont\";\n}\n\n.e-content p {\n margin: 0 0 10px;\n margin-bottom: 10px;\n}\n\n.e-content h1 {\n font-size: 2.857em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h2 {\n font-size: 2.285em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h3 {\n font-size: 2em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h4 {\n font-size: 1.714em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h5 {\n font-size: 1.428em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h6 {\n font-size: 1.142em;\n font-weight: 600;\n line-height: 1.5;\n margin: 10px 0;\n}\n\n.e-content blockquote {\n margin: 10px 0;\n padding-left: 12px;\n border-left: 2px solid #5c5c5c;\n}\n\n.e-rtl.e-content blockquote {\n padding-left: 0;\n padding-right: 12px;\n}\n\n.e-content pre {\n border: 0;\n border-radius: 0;\n color: #333;\n font-size: inherit;\n line-height: inherit;\n margin: 0 0 10px;\n overflow: visible;\n padding: 0;\n white-space: pre-wrap;\n word-break: inherit;\n word-wrap: break-word;\n}\n\n.e-content code {\n background: #9d9d9d26;\n color: #ed484c;\n}\n\n.e-content strong,\n.e-content b {\n font-weight: bold;\n}\n\n.e-content a {\n text-decoration: none;\n user-select: auto;\n}\n\n.e-content a:hover {\n text-decoration: underline;\n}\n\n.e-content li {\n margin-bottom: 10px;\n}\n\n.e-content li ol,\n.e-content li ul {\n margin-block-start: 10px;\n}\n\n.e-content ul {\n list-style-type: disc;\n}\n\n.e-content ul ul,\n.e-content ol ul {\n list-style-type: circle;\n}\n\n.e-content ul ul ul,\n.e-content ol ul ul,\n.e-content ul ol ul,\n.e-content ol ol ul {\n list-style-type: square;\n}\n\n.e-rte-image,\n.e-rte-video {\n border: 0;\n cursor: pointer;\n display: block;\n float: none;\n height: auto;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-content p:last-child,\n.e-content pre:last-child,\n.e-content blockquote:last-child {\n margin-bottom: 0;\n}\n\n.e-content h3 + h4,\n.e-content h4 + h5,\n.e-content h5 + h6 {\n margin-top: 0.6em;\n}\n\n.e-content ul:last-child {\n margin-bottom: 0;\n}\n\n.e-content table {\n margin-bottom: 10px;\n border-collapse: collapse;\n empty-cells: show;\n}\n\n.e-content table.e-cell-select {\n position: relative;\n}\n\n.e-content table.e-cell-select::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4a90e2;\n pointer-events: none;\n}\n\ntable .e-cell-select {\n border: 1px double #4a90e2 !important;\n}\n\n.e-content table.e-rte-table th {\n background-color: #E0E0E0;\n}\n\n.e-rte-table td,\n.e-rte-table th {\n border: 1px solid #BDBDBD;\n height: 20px;\n min-width: 20px;\n padding: 2px 5px;\n box-sizing: border-box;\n}\n\n.e-rte-table td.e-cell-select.e-multi-cells-select,\n.e-rte-table th.e-cell-select.e-multi-cells-select {\n position: relative;\n}\n\n.e-rte-table td.e-cell-select.e-multi-cells-select::after,\n.e-rte-table th.e-cell-select.e-multi-cells-select::after {\n background-color: rgba(13, 110, 253, 0.08);\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n bottom: 0;\n pointer-events: none;\n right: 0;\n}\n\ntable td.e-multi-cells-select ::selection,\ntable th.e-multi-cells-select ::selection {\n background-color: transparent;\n}\n\ntd.e-multi-cells-select,\nth.e-multi-cells-select {\n user-select: none !important;\n}\n\n.e-rte-table.e-dashed-border td,\n.e-rte-table.e-dashed-border th {\n border-style: dashed;\n}\n\n.e-rte-table .e-alternate-border tbody tr:nth-child(2n) {\n background-color: #F5F5F5;\n}\n\n.e-rte-audio {\n border: 0;\n cursor: pointer;\n display: block;\n float: none;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-image.e-imginline,\n.e-rte-audio.e-audio-inline,\n.e-rte-video.e-video-inline {\n display: inline-block;\n float: none;\n margin-left: 5px;\n margin-right: 5px;\n max-width: calc(100% - (2 * 5px));\n padding: 1px;\n vertical-align: bottom;\n}\n\n.e-rte-image.e-imgcenter,\n.e-rte-video.e-video-center {\n cursor: pointer;\n display: block;\n float: none;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-image.e-imgright,\n.e-rte-video.e-video-right {\n float: right;\n margin: 0 auto;\n margin-left: 5px;\n text-align: right;\n}\n\n.e-rte-image.e-imgleft,\n.e-rte-video.e-video-left {\n float: left;\n margin: 0 auto;\n margin-right: 5px;\n text-align: left;\n}\n\n.e-img-caption {\n display: inline-block;\n float: none;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-img-caption.e-caption-inline {\n display: inline-block;\n float: none;\n margin: 5px auto;\n margin-left: 5px;\n margin-right: 5px;\n max-width: calc(100% - (2 * 5px));\n position: relative;\n text-align: center;\n vertical-align: bottom;\n}\n\n.e-rte-img-caption.e-imgcenter {\n display: contents;\n margin-left: auto;\n margin-right: auto;\n}\n\n.e-rte-img-caption.e-imgright {\n display: contents;\n margin-left: auto;\n margin-right: 0;\n}\n\n.e-rte-img-caption.e-imgleft {\n display: contents;\n margin-left: 0;\n margin-right: auto;\n}\n\n.e-img-caption.e-rte-img-caption.e-imgbreak {\n display: contents;\n}\n\n.e-img-inner {\n box-sizing: border-box;\n display: block;\n font-size: 16px;\n font-weight: initial;\n margin: auto;\n opacity: .9;\n text-align: center;\n width: 100%;\n}\n\n.e-img-wrap {\n display: inline-block;\n margin: auto;\n padding: 0;\n text-align: center;\n width: 100%;\n}\n\n.e-imgleft,\n.e-video-left {\n float: left;\n margin: 0 5px 0 0;\n text-align: left;\n}\n\n.e-imgright,\n.e-video-right {\n float: right;\n margin: 0 0 0 5px;\n text-align: right;\n}\n\n.e-imgcenter,\n.e-video-center {\n cursor: pointer;\n display: block;\n float: none;\n height: auto;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-control img:not(.e-resize) {\n border: 2px solid transparent;\n z-index: 1000\n}\n\n.e-imginline,\n.e-audio-inline,\n.e-video-inline {\n display: inline-block;\n float: none;\n margin-left: 5px;\n margin-right: 5px;\n max-width: calc(100% - (2 * 5px));\n vertical-align: bottom;\n}\n\n.e-imgbreak,\n.e-audio-break,\n.e-video-break {\n border: 0;\n cursor: pointer;\n display: block;\n float: none;\n height: auto;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-image.e-img-focus:not(.e-resize),\n.e-audio-focus:not(.e-resize),\n.e-video-focus:not(.e-resize) {\n border: solid 2px #4a90e2;\n}\n\nimg.e-img-focus::selection,\naudio.e-audio-focus::selection,\n.e-video-focus::selection {\n background: transparent;\n color: transparent;\n}\n\nspan.e-rte-imageboxmark,\nspan.e-rte-videoboxmark {\n width: 10px;\n height: 10px;\n position: absolute;\n display: block;\n background: #4a90e2;\n border: 1px solid #fff;\n z-index: 1000;\n}\n\n.e-mob-rte.e-mob-span span.e-rte-imageboxmark,\n.e-mob-rte.e-mob-span span.e-rte-videoboxmark {\n background: #4a90e2;\n border: 1px solid #fff;\n}\n\n.e-mob-rte span.e-rte-imageboxmark,\n.e-mob-rte span.e-rte-videoboxmark {\n background: #fff;\n border: 1px solid #4a90e2;\n border-radius: 15px;\n height: 20px;\n width: 20px;\n}\n\n.e-mob-rte.e-mob-span span.e-rte-imageboxmark,\n.e-mob-rte.e-mob-span span.e-rte-videoboxmark {\n background: #4a90e2;\n border: 1px solid #fff;\n}\n\n.e-content img.e-resize,\n.e-content video.e-resize {\n z-index: 1000;\n}\n\n.e-img-caption .e-img-inner {\n outline: 0;\n}\n\n.e-rte-img-caption.e-imgleft .e-img-inner {\n float: left;\n text-align: left;\n}\n\n.e-rte-img-caption.e-imgright .e-img-inner {\n float: right;\n text-align: right;\n}\n\n.e-rte-img-caption.e-imgleft .e-img-wrap,\n.e-rte-img-caption.e-imgright .e-img-wrap {\n display: contents;\n}\n\n.e-img-caption a:focus-visible {\n outline: none;\n}\n\n.e-rte-img-caption .e-rte-image.e-imgright {\n margin-left: auto;\n margin-right: 0;\n}\n\n.e-rte-img-caption .e-rte-image.e-imgleft {\n margin: 0;\n}\n\nspan.e-table-box {\n cursor: nwse-resize;\n display: block;\n height: 10px;\n position: absolute;\n width: 10px;\n background-color: #ffffff;\n border: 1px solid #BDBDBD;\n}\n\nspan.e-table-box.e-rmob {\n height: 14px;\n width: 14px;\n background-color: #BDBDBD;\n border: 1px solid #BDBDBD;\n}\n\n.e-row-resize,\n.e-column-resize {\n background-color: transparent;\n background-repeat: repeat;\n bottom: 0;\n cursor: col-resize;\n height: 1px;\n overflow: visible;\n position: absolute;\n width: 1px;\n}\n\n.e-row-resize {\n cursor: row-resize;\n height: 1px;\n}\n\n.e-table-rhelper {\n cursor: col-resize;\n opacity: .87;\n position: absolute;\n}\n\n.e-table-rhelper.e-column-helper {\n width: 1px;\n}\n\n.e-table-rhelper.e-row-helper {\n height: 1px;\n}\n\n.e-reicon::before {\n border-bottom: 6px solid transparent;\n border-right: 6px solid;\n border-top: 6px solid transparent;\n content: '';\n display: block;\n height: 0;\n position: absolute;\n right: 4px;\n top: 4px;\n width: 20px;\n}\n\n.e-reicon::after {\n border-bottom: 6px solid transparent;\n border-left: 6px solid;\n border-top: 6px solid transparent;\n content: '';\n display: block;\n height: 0;\n left: 4px;\n position: absolute;\n top: 4px;\n width: 20px;\n z-index: 3;\n}\n\n.e-row-helper.e-reicon::after {\n top: 10px;\n transform: rotate(90deg);\n}\n\n.e-row-helper.e-reicon::before {\n left: 4px;\n top: -20px;\n transform: rotate(90deg);\n}\n\n\n.e-table-rhelper {\n background-color: #4a90e2;\n}\n\n.e-rtl {\n direction: rtl;\n}\n\n.e-rte-placeholder::before {\n content: attr(placeholder);\n opacity: 0.54;\n overflow: hidden;\n padding-top: 16px;\n position: absolute;\n text-align: start;\n top: 0;\n z-index: 1;\n}\n\n.e-resize-enabled,\n.e-count-enabled {\n padding-bottom: 0px;\n}\n";
|
|
1
|
+
export var IFRAME_EDITOR_STYLES = "\n@charset \"UTF-8\";\n\n* {\n box-sizing: border-box;\n}\n\nhtml {\n height: auto;\n}\n\nhtml, body {\n margin: 0;\n}\n\nbody {\n color: #333;\n word-wrap: break-word;\n}\n\n.e-content {\n background: unset;\n min-height: 100px;\n outline: 0 solid transparent;\n padding: 16px;\n position: relative;\n overflow-x: auto;\n font-weight: normal;\n line-height: 1.5;\n font-size: 14px;\n text-align: inherit;\n font-family: \"Roboto\", \"Segoe UI\", \"GeezaPro\", \"DejaVu Serif\", \"sans-serif\", \"-apple-system\", \"BlinkMacSystemFont\";\n}\n\n.e-content p {\n margin: 0 0 10px;\n margin-bottom: 10px;\n}\n\n.e-content h1 {\n font-size: 2.857em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h2 {\n font-size: 2.285em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h3 {\n font-size: 2em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h4 {\n font-size: 1.714em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h5 {\n font-size: 1.428em;\n font-weight: 600;\n line-height: 1.2;\n margin: 10px 0;\n}\n\n.e-content h6 {\n font-size: 1.142em;\n font-weight: 600;\n line-height: 1.5;\n margin: 10px 0;\n}\n\n.e-content blockquote {\n margin: 10px 0;\n padding-left: 12px;\n border-left: 2px solid #5c5c5c;\n}\n\n.e-rtl.e-content blockquote {\n padding-left: 0;\n padding-right: 12px;\n}\n\n.e-content pre {\n border: 0;\n border-radius: 0;\n color: #333;\n font-size: inherit;\n line-height: inherit;\n margin: 0 0 10px;\n overflow: visible;\n padding: 0;\n white-space: pre-wrap;\n word-break: inherit;\n word-wrap: break-word;\n}\n\n.e-content code {\n background: #9d9d9d26;\n color: #ed484c;\n}\n\n.e-content strong,\n.e-content b {\n font-weight: bold;\n}\n\n.e-content a {\n text-decoration: none;\n user-select: auto;\n}\n\n.e-content a:hover {\n text-decoration: underline;\n}\n\n.e-content li {\n margin-bottom: 10px;\n}\n\n.e-content li ol,\n.e-content li ul {\n margin-block-start: 10px;\n}\n\n.e-content ul {\n list-style-type: disc;\n}\n\n.e-content ul ul,\n.e-content ol ul {\n list-style-type: circle;\n}\n\n.e-content ul ul ul,\n.e-content ol ul ul,\n.e-content ul ol ul,\n.e-content ol ol ul {\n list-style-type: square;\n}\n\n.e-content p:last-child,\n.e-content pre:last-child,\n.e-content blockquote:last-child {\n margin-bottom: 0;\n}\n\n.e-content h3 + h4,\n.e-content h4 + h5,\n.e-content h5 + h6 {\n margin-top: 0.6em;\n}\n\n.e-content ul:last-child {\n margin-bottom: 0;\n}\n\n.e-content table {\n margin-bottom: 10px;\n border-collapse: collapse;\n empty-cells: show;\n}\n\n.e-content table.e-cell-select {\n position: relative;\n}\n\n.e-content table.e-cell-select::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4a90e2;\n pointer-events: none;\n}\n\ntable .e-cell-select {\n border: 1px double #4a90e2 !important;\n}\n\n.e-content table.e-rte-table th {\n background-color: #E0E0E0;\n}\n\n.e-rte-table td,\n.e-rte-table th {\n border: 1px solid #BDBDBD;\n height: 20px;\n min-width: 20px;\n padding: 2px 5px;\n}\n\n.e-rte-table td.e-cell-select.e-multi-cells-select,\n.e-rte-table th.e-cell-select.e-multi-cells-select {\n position: relative;\n}\n\n.e-rte-table td.e-cell-select.e-multi-cells-select::after,\n.e-rte-table th.e-cell-select.e-multi-cells-select::after {\n background-color: rgba(13, 110, 253, 0.08);\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n bottom: 0;\n pointer-events: none;\n right: 0;\n}\n\ntable td.e-multi-cells-select ::selection,\ntable th.e-multi-cells-select ::selection {\n background-color: transparent;\n}\n\ntd.e-multi-cells-select,\nth.e-multi-cells-select {\n user-select: none !important;\n}\n\n.e-rte-table.e-dashed-border td,\n.e-rte-table.e-dashed-border th {\n border-style: dashed;\n}\n\n.e-rte-table .e-alternate-border tbody tr:nth-child(2n) {\n background-color: #F5F5F5;\n}\n\n.e-rte-image,\n.e-rte-audio,\n.e-rte-video {\n border: 0;\n cursor: pointer;\n display: block;\n float: none;\n margin: auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-image.e-imginline,\n.e-rte-audio.e-audio-inline,\n.e-rte-video.e-video-inline {\n margin-left: 5px;\n margin-right: 5px;\n display: inline-block;\n float: none;\n max-width: 100%;\n padding: 1px;\n vertical-align: bottom;\n}\n\n.e-rte-image.e-imgcenter,\n.e-rte-video.e-video-center {\n cursor: pointer;\n display: block;\n float: none;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-image.e-imgright,\n.e-rte-video.e-video-right {\n float: right;\n margin: 0 auto;\n margin-left: 5px;\n text-align: right;\n}\n\n.e-rte-image.e-imgleft,\n.e-rte-video.e-video-left {\n float: left;\n margin: 0 auto;\n margin-right: 5px;\n text-align: left;\n}\n\n.e-rte-img-caption {\n display: inline-block;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-img-caption.e-caption-inline {\n display: inline-block;\n margin: 5px auto;\n margin-left: 5px;\n margin-right: 5px;\n max-width: calc(100% - (2 * 5px));\n position: relative;\n text-align: center;\n vertical-align: bottom;\n}\n\n.e-rte-img-caption.e-imgcenter {\n display: contents;\n margin-left: auto;\n margin-right: auto;\n}\n\n.e-rte-img-caption.e-imgright {\n display: contents;\n margin-left: auto;\n margin-right: 0;\n}\n\n.e-rte-img-caption.e-imgleft {\n display: contents;\n margin-left: 0;\n margin-right: auto;\n}\n\n.e-img-caption.e-rte-img-caption.e-imgbreak {\n display: contents;\n}\n\n.e-rte-img-caption .e-img-inner {\n display: block;\n font-size: 16px;\n font-weight: initial;\n margin: auto;\n opacity: .9;\n position: relative;\n text-align: center;\n width: 100%;\n}\n\n.e-img-wrap {\n display: inline-block;\n margin: auto;\n padding: 0;\n text-align: center;\n width: 100%;\n}\n\n.e-imgleft,\n.e-video-left {\n float: left;\n margin: 0 5px 0 0;\n text-align: left;\n}\n\n.e-imgright,\n.e-video-right {\n float: right;\n margin: 0 0 0 5px;\n text-align: right;\n}\n\n.e-imgcenter,\n.e-video-center {\n cursor: pointer;\n display: block;\n float: none;\n height: auto;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-control img:not(.e-resize) {\n border: 2px solid transparent;\n z-index: 1000\n}\n\n.e-imginline,\n.e-audio-inline,\n.e-video-inline {\n display: inline-block;\n float: none;\n margin-left: 5px;\n margin-right: 5px;\n vertical-align: bottom;\n}\n\n.e-imgbreak,\n.e-audio-break,\n.e-video-break {\n border: 0;\n cursor: pointer;\n display: block;\n float: none;\n height: auto;\n margin: 5px auto;\n max-width: 100%;\n position: relative;\n}\n\n.e-rte-image.e-img-focus:not(.e-resize),\n.e-audio-focus:not(.e-resize),\n.e-video-focus:not(.e-resize) {\n border: solid 2px #4a90e2;\n}\n\nimg.e-img-focus::selection,\naudio.e-audio-focus::selection,\n.e-video-focus::selection {\n background: transparent;\n color: transparent;\n}\n\nspan.e-rte-imageboxmark,\nspan.e-rte-videoboxmark {\n width: 10px;\n height: 10px;\n position: absolute;\n display: block;\n background: #4a90e2;\n border: 1px solid #fff;\n z-index: 1000;\n}\n\n.e-mob-rte.e-mob-span span.e-rte-imageboxmark,\n.e-mob-rte.e-mob-span span.e-rte-videoboxmark {\n background: #4a90e2;\n border: 1px solid #fff;\n}\n\n.e-mob-rte span.e-rte-imageboxmark,\n.e-mob-rte span.e-rte-videoboxmark {\n background: #fff;\n border: 1px solid #4a90e2;\n border-radius: 15px;\n height: 20px;\n width: 20px;\n}\n\n.e-mob-rte.e-mob-span span.e-rte-imageboxmark,\n.e-mob-rte.e-mob-span span.e-rte-videoboxmark {\n background: #4a90e2;\n border: 1px solid #fff;\n}\n\n.e-content img.e-resize,\n.e-content video.e-resize {\n z-index: 1000;\n}\n\n.e-img-caption .e-img-inner {\n outline: 0;\n}\n\n.e-rte-img-caption.e-imgleft .e-img-inner {\n float: left;\n text-align: left;\n}\n\n.e-rte-img-caption.e-imgright .e-img-inner {\n float: right;\n text-align: right;\n}\n\n.e-rte-img-caption.e-imgleft .e-img-wrap,\n.e-rte-img-caption.e-imgright .e-img-wrap {\n display: contents;\n}\n\n.e-img-caption a:focus-visible {\n outline: none;\n}\n\n.e-rte-img-caption .e-rte-image.e-imgright {\n margin-left: auto;\n margin-right: 0;\n}\n\n.e-rte-img-caption .e-rte-image.e-imgleft {\n margin: 0;\n}\n\nspan.e-table-box {\n cursor: nwse-resize;\n display: block;\n height: 10px;\n position: absolute;\n width: 10px;\n background-color: #ffffff;\n border: 1px solid #BDBDBD;\n}\n\nspan.e-table-box.e-rmob {\n height: 14px;\n width: 14px;\n background-color: #BDBDBD;\n border: 1px solid #BDBDBD;\n}\n\n.e-row-resize,\n.e-column-resize {\n background-color: transparent;\n background-repeat: repeat;\n bottom: 0;\n cursor: col-resize;\n height: 1px;\n overflow: visible;\n position: absolute;\n width: 1px;\n}\n\n.e-row-resize {\n cursor: row-resize;\n height: 1px;\n}\n\n.e-table-rhelper {\n cursor: col-resize;\n opacity: .87;\n position: absolute;\n}\n\n.e-table-rhelper.e-column-helper {\n width: 1px;\n}\n\n.e-table-rhelper.e-row-helper {\n height: 1px;\n}\n\n.e-reicon::before {\n border-bottom: 6px solid transparent;\n border-right: 6px solid;\n border-top: 6px solid transparent;\n content: '';\n display: block;\n height: 0;\n position: absolute;\n right: 4px;\n top: 4px;\n width: 20px;\n}\n\n.e-reicon::after {\n border-bottom: 6px solid transparent;\n border-left: 6px solid;\n border-top: 6px solid transparent;\n content: '';\n display: block;\n height: 0;\n left: 4px;\n position: absolute;\n top: 4px;\n width: 20px;\n z-index: 3;\n}\n\n.e-row-helper.e-reicon::after {\n top: 10px;\n transform: rotate(90deg);\n}\n\n.e-row-helper.e-reicon::before {\n left: 4px;\n top: -20px;\n transform: rotate(90deg);\n}\n\n\n.e-table-rhelper {\n background-color: #4a90e2;\n}\n\n.e-rtl {\n direction: rtl;\n}\n\n.e-rte-placeholder::before {\n content: attr(placeholder);\n opacity: 0.54;\n overflow: hidden;\n padding-top: 16px;\n position: absolute;\n text-align: start;\n top: 0;\n z-index: 1;\n}\n\n.e-resize-enabled,\n.e-count-enabled {\n padding-bottom: 0px;\n}\n";
|
|
@@ -104,6 +104,8 @@ export interface ImageOrTableCursor {
|
|
|
104
104
|
startName: string;
|
|
105
105
|
end: boolean;
|
|
106
106
|
endName: string;
|
|
107
|
+
startNode?: HTMLElement;
|
|
108
|
+
endNode?: HTMLElement;
|
|
107
109
|
}
|
|
108
110
|
/**
|
|
109
111
|
* The `ImageDimension` is used to specify the width and height of the editor image.
|
package/src/common/util.js
CHANGED
|
@@ -82,7 +82,8 @@ export function updateTextNode(value, enterAction) {
|
|
|
82
82
|
}
|
|
83
83
|
var tableElm = resultElm.querySelectorAll('table');
|
|
84
84
|
for (var i = 0; i < tableElm.length; i++) {
|
|
85
|
-
if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table')
|
|
85
|
+
if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table') &&
|
|
86
|
+
!tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
86
87
|
tableElm[i].classList.add('e-rte-paste-table');
|
|
87
88
|
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
88
89
|
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
@@ -93,3 +93,7 @@ export var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'inp
|
|
|
93
93
|
* @hidden
|
|
94
94
|
*/
|
|
95
95
|
export var PASTE_SOURCE = ['word', 'excel', 'onenote'];
|
|
96
|
+
/**
|
|
97
|
+
* @hidden
|
|
98
|
+
*/
|
|
99
|
+
export var ALLOWED_TABLE_BLOCK_TAGS = ['article', 'aside', 'blockquote', 'body', 'canvas', 'details', 'div', 'fieldset', 'figure', 'footer', 'form', 'header', 'li', 'main', 'nav', 'noscript', 'section'];
|
|
@@ -261,6 +261,14 @@ var Formats = /** @class */ (function () {
|
|
|
261
261
|
};
|
|
262
262
|
Formats.prototype.applyFormats = function (e) {
|
|
263
263
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
264
|
+
var tableCursor = this.parent.nodeSelection.processedTableImageCursor(range);
|
|
265
|
+
if (tableCursor.start || tableCursor.end) {
|
|
266
|
+
if (tableCursor.startName === 'TABLE' || tableCursor.endName === 'TABLE') {
|
|
267
|
+
var tableNode = tableCursor.start ? tableCursor.startNode : tableCursor.endNode;
|
|
268
|
+
this.applyTableSidesFormat(e, tableCursor.start, tableNode);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
264
272
|
var isSelectAll = false;
|
|
265
273
|
if (this.parent.editableElement === range.endContainer &&
|
|
266
274
|
!isNOU(this.parent.editableElement.children[range.endOffset - 1]) &&
|
|
@@ -509,6 +517,23 @@ var Formats = /** @class */ (function () {
|
|
|
509
517
|
element.style.removeProperty(ignoreAttr[i]);
|
|
510
518
|
}
|
|
511
519
|
};
|
|
520
|
+
Formats.prototype.applyTableSidesFormat = function (e, start, table) {
|
|
521
|
+
var formatNode = createElement(e.subCommand);
|
|
522
|
+
if (!(e.enterAction === 'BR')) {
|
|
523
|
+
formatNode.appendChild(createElement('br'));
|
|
524
|
+
}
|
|
525
|
+
table.insertAdjacentElement(start ? 'beforebegin' : 'afterend', formatNode);
|
|
526
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, formatNode, 0);
|
|
527
|
+
if (e.callBack) {
|
|
528
|
+
e.callBack({
|
|
529
|
+
requestType: e.subCommand,
|
|
530
|
+
editorMode: 'HTML',
|
|
531
|
+
event: e.event,
|
|
532
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
533
|
+
elements: this.parent.domNode.blockNodes()
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
};
|
|
512
537
|
Formats.prototype.destroy = function () {
|
|
513
538
|
this.removeEventListener();
|
|
514
539
|
};
|
|
@@ -119,8 +119,14 @@ var ImageCommand = /** @class */ (function () {
|
|
|
119
119
|
(Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
|
|
120
120
|
var onImageLoadEvent_1 = function () {
|
|
121
121
|
if (!isNOU(_this.parent.currentDocument)) {
|
|
122
|
-
imgElm_1.
|
|
123
|
-
imgElm_1.
|
|
122
|
+
var imgWidth = imgElm_1.getAttribute('width');
|
|
123
|
+
var imgHeight = imgElm_1.getAttribute('height');
|
|
124
|
+
if (isNOU(imgWidth) || imgWidth === 'auto') {
|
|
125
|
+
imgElm_1.setAttribute('width', imgElm_1.offsetWidth.toString());
|
|
126
|
+
}
|
|
127
|
+
if (isNOU(imgHeight) || imgHeight === 'auto') {
|
|
128
|
+
imgElm_1.setAttribute('height', imgElm_1.offsetHeight.toString());
|
|
129
|
+
}
|
|
124
130
|
e.callBack({
|
|
125
131
|
requestType: (e.value === 'Replace') ? (e.item.subCommand = 'Replace', 'Replace') : 'Images',
|
|
126
132
|
editorMode: 'HTML',
|
|
@@ -17,6 +17,8 @@ export declare class InsertHtml {
|
|
|
17
17
|
private static findFirstTextNode;
|
|
18
18
|
private static pasteInsertHTML;
|
|
19
19
|
private static listCleanUp;
|
|
20
|
+
private static cleanUpListItems;
|
|
21
|
+
private static cleanUpListContainer;
|
|
20
22
|
private static placeCursorEnd;
|
|
21
23
|
private static getNodeCollection;
|
|
22
24
|
private static insertTempNode;
|
|
@@ -107,7 +107,12 @@ var InsertHtml = /** @class */ (function () {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
if (!isNOU(sibNode) && !isNOU(sibNode.parentNode)) {
|
|
110
|
-
|
|
110
|
+
if (docElement.contains(sibNode)) {
|
|
111
|
+
InsertMethods.AppendBefore(node, sibNode, true);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
range.insertNode(node);
|
|
115
|
+
}
|
|
111
116
|
}
|
|
112
117
|
else {
|
|
113
118
|
var previousNode = null;
|
|
@@ -395,26 +400,99 @@ var InsertHtml = /** @class */ (function () {
|
|
|
395
400
|
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
396
401
|
}
|
|
397
402
|
this.alignCheck(editNode);
|
|
398
|
-
|
|
399
|
-
this.listCleanUp(currentRange);
|
|
403
|
+
this.listCleanUp(nodeSelection, docElement);
|
|
400
404
|
};
|
|
401
|
-
InsertHtml.listCleanUp = function (
|
|
405
|
+
InsertHtml.listCleanUp = function (nodeSelection, docElement) {
|
|
406
|
+
var range = nodeSelection.getRange(docElement);
|
|
407
|
+
var startContainer = range.startContainer;
|
|
408
|
+
var startOffset = range.startOffset;
|
|
402
409
|
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
403
|
-
var
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
410
|
+
var haslistCleanUp = this.cleanUpListItems(range.startContainer.parentElement.closest('ol,ul'));
|
|
411
|
+
var haslistContainerCleanUp = this.cleanUpListContainer(range.startContainer.parentElement.closest('ol,ul'));
|
|
412
|
+
if (haslistCleanUp || haslistContainerCleanUp) {
|
|
413
|
+
range.setStart(startContainer, startOffset);
|
|
414
|
+
range.setEnd(startContainer, startOffset);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
InsertHtml.cleanUpListItems = function (parentContainer) {
|
|
419
|
+
var _this = this;
|
|
420
|
+
var hasListCleanUp = false;
|
|
421
|
+
var listItems = parentContainer.closest('ol, ul').querySelectorAll('li');
|
|
422
|
+
if (listItems.length === 0) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
var nearestListItem = null;
|
|
426
|
+
listItems.forEach(function (listItem) {
|
|
427
|
+
if (!isNOU(listItem.firstChild) && (listItem.firstChild.nodeName === 'OL' || listItem.firstChild.nodeName === 'UL')) {
|
|
428
|
+
listItem.style.listStyleType = 'none';
|
|
429
|
+
}
|
|
430
|
+
var parentElement = listItem.parentElement;
|
|
431
|
+
if (!isNOU(parentElement) && parentElement.nodeName !== 'OL' && parentElement.nodeName !== 'UL') {
|
|
432
|
+
if (isNOU(nearestListItem)) {
|
|
433
|
+
nearestListItem = parentElement.closest('li');
|
|
434
|
+
}
|
|
435
|
+
if (!isNOU(nearestListItem)) {
|
|
436
|
+
var nextSibling = listItem.nextSibling;
|
|
437
|
+
if (!isNOU(nextSibling) && nextSibling.nodeName !== 'LI') {
|
|
438
|
+
var startIndex = Array.prototype.indexOf.call(parentElement.childNodes, nextSibling);
|
|
439
|
+
var clonedParent = parentElement.cloneNode(false);
|
|
440
|
+
var totalChildren = parentElement.childNodes.length;
|
|
441
|
+
for (var i = startIndex; i < totalChildren; i++) {
|
|
442
|
+
clonedParent.appendChild(parentElement.childNodes[startIndex]);
|
|
443
|
+
}
|
|
444
|
+
if (clonedParent.childNodes.length > 0) {
|
|
445
|
+
var newListItem = document.createElement('li');
|
|
446
|
+
newListItem.appendChild(clonedParent);
|
|
447
|
+
nearestListItem.insertAdjacentElement('afterend', newListItem);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
clonedParent.remove();
|
|
451
|
+
}
|
|
414
452
|
}
|
|
415
|
-
|
|
453
|
+
var closestList = parentElement.closest('ol, ul');
|
|
454
|
+
nearestListItem.insertAdjacentElement('afterend', listItem);
|
|
455
|
+
nearestListItem = nearestListItem.nextSibling;
|
|
456
|
+
_this.removeEmptyElements(closestList);
|
|
457
|
+
hasListCleanUp = true;
|
|
458
|
+
}
|
|
416
459
|
}
|
|
460
|
+
var nestedLi = Array.from(listItem.children).find(function (child) {
|
|
461
|
+
return child.tagName === 'LI' && (child.parentElement && child.parentElement.tagName !== 'OL' && child.parentElement.tagName !== 'UL');
|
|
462
|
+
});
|
|
463
|
+
if (nestedLi && listItem.parentNode) {
|
|
464
|
+
listItem.parentNode.replaceChild(nestedLi, listItem);
|
|
465
|
+
hasListCleanUp = true;
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
return hasListCleanUp;
|
|
469
|
+
};
|
|
470
|
+
InsertHtml.cleanUpListContainer = function (parentList) {
|
|
471
|
+
var hasListContainerCleanUp = false;
|
|
472
|
+
var nonLiElementCollection = [];
|
|
473
|
+
var replacements = [];
|
|
474
|
+
if (!isNOU(parentList)) {
|
|
475
|
+
parentList.childNodes.forEach(function (childNode) {
|
|
476
|
+
if (childNode.nodeName.toLocaleUpperCase() !== 'LI') {
|
|
477
|
+
nonLiElementCollection.push(childNode);
|
|
478
|
+
}
|
|
479
|
+
if ((childNode.nodeName.toLocaleUpperCase() === 'LI' || parentList.lastChild === childNode) && nonLiElementCollection.length > 0) {
|
|
480
|
+
replacements.push({ elements: nonLiElementCollection.slice() });
|
|
481
|
+
nonLiElementCollection = [];
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
replacements.forEach(function (_a) {
|
|
485
|
+
var elements = _a.elements;
|
|
486
|
+
var newListItem = document.createElement('li');
|
|
487
|
+
elements[0].parentNode.replaceChild(newListItem, elements[0]);
|
|
488
|
+
elements.forEach(function (child) { return newListItem.appendChild(child); });
|
|
489
|
+
if (newListItem.textContent && newListItem.textContent.trim() === '') {
|
|
490
|
+
parentList.removeChild(newListItem);
|
|
491
|
+
}
|
|
492
|
+
hasListContainerCleanUp = true;
|
|
493
|
+
});
|
|
417
494
|
}
|
|
495
|
+
return hasListContainerCleanUp;
|
|
418
496
|
};
|
|
419
497
|
InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
420
498
|
lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNOU(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
|
|
@@ -630,7 +708,8 @@ var InsertHtml = /** @class */ (function () {
|
|
|
630
708
|
while (el && el.nodeType === 1) {
|
|
631
709
|
if (el.parentNode === editNode ||
|
|
632
710
|
(!isNOU(el.parentNode.tagName) &&
|
|
633
|
-
CONSTANT.IGNORE_BLOCK_TAGS.indexOf(el.parentNode.tagName.toLocaleLowerCase()) !== -1
|
|
711
|
+
(CONSTANT.IGNORE_BLOCK_TAGS.indexOf(el.parentNode.tagName.toLocaleLowerCase()) !== -1
|
|
712
|
+
|| CONSTANT.ALLOWED_TABLE_BLOCK_TAGS.indexOf(el.parentNode.tagName.toLocaleLowerCase()) !== -1))) {
|
|
634
713
|
return el;
|
|
635
714
|
}
|
|
636
715
|
el = el.parentNode;
|
|
@@ -50,7 +50,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
50
50
|
fragment = this.spliceEmptyNode(fragment, false);
|
|
51
51
|
if (fragment && fragment.childNodes.length > 0) {
|
|
52
52
|
var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0)
|
|
53
|
-
&& this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
|
|
53
|
+
&& this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
|
|
54
54
|
if (!isEmpty) {
|
|
55
55
|
if (node) {
|
|
56
56
|
InsertMethods.AppendBefore(fragment, node);
|
|
@@ -71,7 +71,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
71
71
|
fragment = this.spliceEmptyNode(fragment, true);
|
|
72
72
|
if (fragment && fragment.childNodes.length > 0) {
|
|
73
73
|
var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
|
|
74
|
-
&& this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
|
|
74
|
+
&& this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
|
|
75
75
|
if (!isEmpty) {
|
|
76
76
|
if (node) {
|
|
77
77
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
@@ -131,7 +131,11 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
131
131
|
HtmlEditor.prototype.isTableClassAdded = function () {
|
|
132
132
|
var tableElement = this.parent.inputElement.querySelectorAll('table');
|
|
133
133
|
for (var i = 0; i < tableElement.length; i++) {
|
|
134
|
-
|
|
134
|
+
// e-rte-table class is added to the table element for styling.
|
|
135
|
+
// e-rte-paste-table class is added for pasted table element from MS Word and other sources such as Web will not have any styles.
|
|
136
|
+
// e-rte-custom-table class is added for custom table element will not have any styles.
|
|
137
|
+
if (!tableElement[i].classList.contains('e-rte-table') && !tableElement[i].classList.contains('e-rte-paste-table')
|
|
138
|
+
&& !tableElement[i].classList.contains('e-rte-custom-table')) {
|
|
135
139
|
tableElement[i].classList.add('e-rte-table');
|
|
136
140
|
}
|
|
137
141
|
}
|
|
@@ -651,12 +655,16 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
651
655
|
}
|
|
652
656
|
var brNode = this.deleteRangeElement.querySelector('BR');
|
|
653
657
|
var brLastChildNode = this.deleteRangeElement.lastChild;
|
|
658
|
+
var brParentNode = brLastChildNode.parentNode;
|
|
654
659
|
if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
|
|
655
660
|
removeClass([brNode], ['e-rte-image-focus']);
|
|
656
661
|
return;
|
|
657
662
|
}
|
|
658
663
|
else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
|
|
659
664
|
detach(brLastChildNode);
|
|
665
|
+
if (!isNullOrUndefined(brParentNode) && brParentNode.childNodes.length === 0) {
|
|
666
|
+
detach(brParentNode);
|
|
667
|
+
}
|
|
660
668
|
e.args.preventDefault();
|
|
661
669
|
}
|
|
662
670
|
if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
|
|
@@ -11,7 +11,7 @@ import * as EVENTS from './../../common/constant';
|
|
|
11
11
|
import { RenderType, ImageInputSource } from '../base/enum';
|
|
12
12
|
import { Uploader } from '@syncfusion/ej2-inputs';
|
|
13
13
|
import * as classes from '../base/classes';
|
|
14
|
-
import { sanitizeHelper, convertToBlob
|
|
14
|
+
import { sanitizeHelper, convertToBlob } from '../base/util';
|
|
15
15
|
import { scrollToCursor } from '../../common/util';
|
|
16
16
|
/**
|
|
17
17
|
* PasteCleanup module called when pasting content in RichTextEditor
|
|
@@ -206,38 +206,62 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
PasteCleanup.prototype.splitBreakLine = function (value) {
|
|
209
|
-
var enterSplitText = value.split('\n');
|
|
210
|
-
var
|
|
209
|
+
var enterSplitText = value.split('\r\n\r\n');
|
|
210
|
+
var finalText = '';
|
|
211
211
|
var startNode = this.parent.enterKey === 'P' ? '<p>' : (this.parent.enterKey === 'DIV' ? '<div>' : '');
|
|
212
212
|
var endNode = this.parent.enterKey === 'P' ? '</p>' : (this.parent.enterKey === 'DIV' ? '</div>' : '<br>');
|
|
213
213
|
for (var i = 0; i < enterSplitText.length; i++) {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
var content = enterSplitText[i];
|
|
215
|
+
var contentWithSpace = this.makeSpace(content);
|
|
216
|
+
var contentWithLineBreak = contentWithSpace.replace(/\r\n|\n/g, '<br>');
|
|
217
|
+
if (i === 0) {
|
|
218
|
+
if (this.parent.enterKey === 'BR') {
|
|
219
|
+
finalText += (contentWithLineBreak + endNode);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
finalText += contentWithLineBreak; // In order to merge the content in current line. No P/Div tag is added.
|
|
223
|
+
}
|
|
216
224
|
}
|
|
217
225
|
else {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
226
|
+
if (this.parent.enterKey === 'BR') {
|
|
227
|
+
if (i === enterSplitText.length - 1) {
|
|
228
|
+
finalText += (contentWithLineBreak + endNode);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
finalText += (contentWithLineBreak + endNode + endNode);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
finalText += startNode + contentWithLineBreak + endNode;
|
|
236
|
+
}
|
|
222
237
|
}
|
|
223
238
|
}
|
|
224
|
-
return
|
|
239
|
+
return finalText;
|
|
225
240
|
};
|
|
226
|
-
PasteCleanup.prototype.makeSpace = function (
|
|
227
|
-
var
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
PasteCleanup.prototype.makeSpace = function (text) {
|
|
242
|
+
var spacedContent = '';
|
|
243
|
+
if (text === '') {
|
|
244
|
+
return text;
|
|
245
|
+
}
|
|
246
|
+
var lineBreakSplitText = text.split(' ');
|
|
247
|
+
for (var i = 0; i < lineBreakSplitText.length; i++) {
|
|
248
|
+
var currentText = lineBreakSplitText[i];
|
|
249
|
+
if (currentText === '') {
|
|
250
|
+
spacedContent += ' ';
|
|
251
|
+
}
|
|
252
|
+
else if (currentText === '\t') {
|
|
253
|
+
spacedContent += ' ';
|
|
234
254
|
}
|
|
235
255
|
else {
|
|
236
|
-
|
|
237
|
-
|
|
256
|
+
if (i > 0 && i < lineBreakSplitText.length) {
|
|
257
|
+
spacedContent += ' ';
|
|
258
|
+
}
|
|
259
|
+
spacedContent += currentText;
|
|
238
260
|
}
|
|
239
261
|
}
|
|
240
|
-
|
|
262
|
+
spacedContent = spacedContent.replace(/\t/g, ' ');
|
|
263
|
+
spacedContent = spacedContent.replace(/ /g, ' ');
|
|
264
|
+
return spacedContent;
|
|
241
265
|
};
|
|
242
266
|
PasteCleanup.prototype.imgUploading = function (elm) {
|
|
243
267
|
var allImgElm = elm.querySelectorAll('.pasteContent_Img');
|
|
@@ -822,6 +846,9 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
822
846
|
var tableElement = element.querySelectorAll('table');
|
|
823
847
|
for (var i = 0; i < tableElement.length; i++) {
|
|
824
848
|
var isMSTeamsTable = tableElement[i].parentElement.nodeName === 'FIGURE';
|
|
849
|
+
if (tableElement[i].classList.length > 0 && tableElement[i].classList.contains('e-rte-custom-table')) {
|
|
850
|
+
continue; // Skip the custom table class
|
|
851
|
+
}
|
|
825
852
|
if (this.parent.pasteCleanupSettings.keepFormat && source && !isMSTeamsTable) {
|
|
826
853
|
tableElement[i].classList.add('e-rte-paste-' + source + '-table');
|
|
827
854
|
}
|
|
@@ -781,7 +781,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
781
781
|
}
|
|
782
782
|
var notFormatPainterCopy = isNOU(e.action) ? true : (e.action !== 'format-copy' ? true : false);
|
|
783
783
|
if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy &&
|
|
784
|
-
!(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which === 67))) {
|
|
784
|
+
!(e.altKey || (e.shiftKey && e.which === 16) || (e.altKey && e.shiftKey && e.which === 67))) {
|
|
785
785
|
this.formatter.saveData();
|
|
786
786
|
}
|
|
787
787
|
var preventingMention = false;
|
|
@@ -1835,7 +1835,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1835
1835
|
var item = compiledTemplate[i];
|
|
1836
1836
|
append([item], appendElem);
|
|
1837
1837
|
}
|
|
1838
|
-
|
|
1838
|
+
var content = appendElem.innerHTML.trim();
|
|
1839
|
+
if (content.length > 0) {
|
|
1840
|
+
this.setProperties({ value: content });
|
|
1841
|
+
}
|
|
1839
1842
|
this.renderReactTemplates();
|
|
1840
1843
|
}
|
|
1841
1844
|
}
|
|
@@ -8,7 +8,7 @@ import { Button, CheckBox } from '@syncfusion/ej2-buttons';
|
|
|
8
8
|
import { RenderType, ImageInputSource } from '../base/enum';
|
|
9
9
|
import { dispatchEvent, parseHtml, hasClass, convertToBlob } from '../base/util';
|
|
10
10
|
import { isIDevice } from '../../common/util';
|
|
11
|
-
import {
|
|
11
|
+
import { imageResizeFactor } from '../../common/config';
|
|
12
12
|
/**
|
|
13
13
|
* `Image` module is used to handle image actions.
|
|
14
14
|
*/
|
|
@@ -521,9 +521,6 @@ var Image = /** @class */ (function () {
|
|
|
521
521
|
return dimensions;
|
|
522
522
|
};
|
|
523
523
|
Image.prototype.getResizeFactor = function (value) {
|
|
524
|
-
if (this.parent.iframeSettings.enable) {
|
|
525
|
-
return iframeResizeFactor[value];
|
|
526
|
-
}
|
|
527
524
|
return imageResizeFactor[value];
|
|
528
525
|
};
|
|
529
526
|
Image.prototype.findAspectRatio = function (image) {
|
|
@@ -939,7 +936,9 @@ var Image = /** @class */ (function () {
|
|
|
939
936
|
_this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
|
|
940
937
|
_this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
|
|
941
938
|
_this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
|
|
942
|
-
_this.
|
|
939
|
+
if (_this.parent.insertImageSettings.resize === true) {
|
|
940
|
+
_this.resizeStart(e.args, target);
|
|
941
|
+
}
|
|
943
942
|
}, 400);
|
|
944
943
|
}
|
|
945
944
|
else {
|
|
@@ -2422,7 +2421,9 @@ var Image = /** @class */ (function () {
|
|
|
2422
2421
|
if (imageElement) {
|
|
2423
2422
|
this.showImageQTbarTime = setTimeout(function () {
|
|
2424
2423
|
_this.showImageQuickToolbar(args);
|
|
2425
|
-
_this.
|
|
2424
|
+
if (_this.parent.insertImageSettings.resize) {
|
|
2425
|
+
_this.resizeStart(e.args, imageElement);
|
|
2426
|
+
}
|
|
2426
2427
|
}, 0);
|
|
2427
2428
|
}
|
|
2428
2429
|
};
|