@syncfusion/ej2-richtexteditor 19.2.62 → 19.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -1
- package/CHANGELOG.md +21 -9
- 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 +858 -245
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +864 -243
- 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 +12 -12
- package/src/common/types.d.ts +8 -0
- package/src/editor-manager/base/editor-manager.d.ts +1 -1
- package/src/editor-manager/base/editor-manager.js +6 -6
- package/src/editor-manager/base/interface.d.ts +7 -1
- package/src/editor-manager/plugin/clearformat-exec.js +2 -2
- package/src/editor-manager/plugin/clearformat.d.ts +3 -1
- package/src/editor-manager/plugin/clearformat.js +19 -9
- package/src/editor-manager/plugin/dom-node.js +2 -2
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +87 -7
- package/src/editor-manager/plugin/image.js +55 -47
- package/src/editor-manager/plugin/inserthtml.js +10 -2
- package/src/editor-manager/plugin/isformatted.js +2 -1
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +87 -8
- package/src/editor-manager/plugin/nodecutter.d.ts +1 -0
- package/src/editor-manager/plugin/nodecutter.js +1 -0
- package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
- package/src/editor-manager/plugin/selection-commands.js +14 -6
- package/src/editor-manager/plugin/selection-exec.js +2 -2
- package/src/editor-manager/plugin/table.js +19 -9
- package/src/rich-text-editor/actions/base-quick-toolbar.js +3 -4
- package/src/rich-text-editor/actions/enter-key.d.ts +18 -0
- package/src/rich-text-editor/actions/enter-key.js +290 -0
- package/src/rich-text-editor/actions/html-editor.js +30 -20
- package/src/rich-text-editor/actions/paste-clean-up.js +5 -5
- package/src/rich-text-editor/actions/resize.js +4 -4
- 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 +15 -3
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +27 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +34 -5
- package/src/rich-text-editor/base/rich-text-editor.js +58 -56
- package/src/rich-text-editor/base/util.d.ts +7 -1
- package/src/rich-text-editor/base/util.js +45 -11
- package/src/rich-text-editor/formatter/formatter.js +9 -7
- package/src/rich-text-editor/models/items.js +3 -3
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -2
- package/src/rich-text-editor/renderer/image-module.d.ts +6 -0
- package/src/rich-text-editor/renderer/image-module.js +70 -26
- package/src/rich-text-editor/renderer/link-module.js +4 -3
- package/src/rich-text-editor/renderer/popup-renderer.js +1 -2
- package/src/rich-text-editor/renderer/render.js +10 -2
- package/src/rich-text-editor/renderer/table-module.js +13 -5
- package/src/rich-text-editor/renderer/view-source.js +21 -3
- package/styles/bootstrap-dark.css +25 -12
- package/styles/bootstrap.css +25 -12
- package/styles/bootstrap4.css +21 -13
- package/styles/bootstrap5-dark.css +3058 -0
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +3058 -0
- package/styles/bootstrap5.scss +1 -0
- package/styles/fabric-dark.css +20 -12
- package/styles/fabric.css +20 -12
- package/styles/highcontrast-light.css +20 -12
- package/styles/highcontrast.css +19 -18
- package/styles/material-dark.css +22 -14
- package/styles/material.css +19 -11
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -1
- package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
- package/styles/rich-text-editor/_bootstrap4-definition.scss +2 -2
- package/styles/rich-text-editor/_bootstrap5-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap5-definition.scss +168 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -1
- package/styles/rich-text-editor/_fabric-definition.scss +1 -1
- package/styles/rich-text-editor/_highcontrast-definition.scss +2 -2
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -1
- package/styles/rich-text-editor/_layout.scss +64 -7
- package/styles/rich-text-editor/_tailwind-dark-definition.scss +1 -165
- package/styles/rich-text-editor/_tailwind-definition.scss +74 -72
- package/styles/rich-text-editor/_theme.scss +103 -3
- package/styles/rich-text-editor/bootstrap-dark.css +25 -12
- package/styles/rich-text-editor/bootstrap.css +25 -12
- package/styles/rich-text-editor/bootstrap4.css +21 -13
- package/styles/rich-text-editor/bootstrap5-dark.css +3058 -0
- package/styles/rich-text-editor/bootstrap5-dark.scss +4 -0
- package/styles/rich-text-editor/bootstrap5.css +3058 -0
- package/styles/rich-text-editor/bootstrap5.scss +4 -0
- package/styles/rich-text-editor/fabric-dark.css +20 -12
- package/styles/rich-text-editor/fabric.css +20 -12
- package/styles/rich-text-editor/highcontrast-light.css +20 -12
- package/styles/rich-text-editor/highcontrast.css +19 -18
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap4.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap5-dark.scss +1 -0
- package/styles/rich-text-editor/icons/_bootstrap5.scss +303 -0
- package/styles/rich-text-editor/icons/_fabric-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_fabric.scss +1 -1
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +1 -1
- package/styles/rich-text-editor/icons/_highcontrast.scss +1 -1
- package/styles/rich-text-editor/icons/_material-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_material.scss +1 -1
- package/styles/rich-text-editor/icons/_tailwind-dark.scss +1 -304
- package/styles/rich-text-editor/icons/_tailwind.scss +2 -2
- package/styles/rich-text-editor/material-dark.css +22 -14
- package/styles/rich-text-editor/material.css +19 -11
- package/styles/rich-text-editor/tailwind-dark.css +51 -20
- package/styles/rich-text-editor/tailwind.css +49 -18
- package/styles/tailwind-dark.css +51 -20
- package/styles/tailwind.css +49 -18
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 19.
|
|
3
|
+
* version : 19.3.43
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. 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@18.56.3",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-A4SCmlOjvTVUxWapX9kGMVSNNLBAtftqknMvjF8zGq6hZL43VGLW2UpoMJqfWIw84dVOhEsuMuyl0Jpvt+8k4Q==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
27
27
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
28
28
|
],
|
|
29
|
-
"_resolved": "http://nexus.syncfusion.com/repository/ej2-
|
|
30
|
-
"_shasum": "
|
|
29
|
+
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-18.56.3.tgz",
|
|
30
|
+
"_shasum": "826e64146698b4573f40bc66de6a6b253b2e3272",
|
|
31
31
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
32
32
|
"_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
|
|
33
33
|
"author": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"bundleDependencies": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@syncfusion/ej2-base": "~19.
|
|
42
|
-
"@syncfusion/ej2-buttons": "~19.
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~19.
|
|
44
|
-
"@syncfusion/ej2-inputs": "~19.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~19.
|
|
46
|
-
"@syncfusion/ej2-popups": "~19.
|
|
47
|
-
"@syncfusion/ej2-splitbuttons": "~19.
|
|
41
|
+
"@syncfusion/ej2-base": "~19.3.43",
|
|
42
|
+
"@syncfusion/ej2-buttons": "~19.3.43",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~19.3.43",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~19.3.43",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~19.3.43",
|
|
46
|
+
"@syncfusion/ej2-popups": "~19.3.43",
|
|
47
|
+
"@syncfusion/ej2-splitbuttons": "~19.3.43"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
50
50
|
"description": "Essential JS 2 RichTextEditor component",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
71
71
|
},
|
|
72
72
|
"typings": "index.d.ts",
|
|
73
|
-
"version": "19.
|
|
73
|
+
"version": "19.3.43",
|
|
74
74
|
"sideEffects": false
|
|
75
75
|
}
|
package/src/common/types.d.ts
CHANGED
|
@@ -6,3 +6,11 @@ export declare type EditorMode = 'HTML' | 'Markdown';
|
|
|
6
6
|
* Defines types to be used to save the image.
|
|
7
7
|
*/
|
|
8
8
|
export declare type SaveFormat = 'Base64' | 'Blob';
|
|
9
|
+
/**
|
|
10
|
+
* Defines tag to be used when enter key is pressed.
|
|
11
|
+
*/
|
|
12
|
+
export declare type EnterKey = 'P' | 'DIV' | 'BR';
|
|
13
|
+
/**
|
|
14
|
+
* Defines tag to be used when shift + enter key is pressed.
|
|
15
|
+
*/
|
|
16
|
+
export declare type ShiftEnterKey = 'P' | 'DIV' | 'BR';
|
|
@@ -71,5 +71,5 @@ export declare class EditorManager {
|
|
|
71
71
|
* @hidden
|
|
72
72
|
|
|
73
73
|
*/
|
|
74
|
-
execCommand<T>(command: ExecCommand, value: T, event?: Event, callBack?: Function, text?: string | Node, exeValue?: T, selector?: string): void;
|
|
74
|
+
execCommand<T>(command: ExecCommand, value: T, event?: Event, callBack?: Function, text?: string | Node, exeValue?: T, selector?: string, enterAction?: string): void;
|
|
75
75
|
}
|
|
@@ -92,15 +92,15 @@ var EditorManager = /** @class */ (function () {
|
|
|
92
92
|
|
|
93
93
|
*/
|
|
94
94
|
/* eslint-enable */
|
|
95
|
-
EditorManager.prototype.execCommand = function (command, value, event, callBack, text, exeValue, selector) {
|
|
95
|
+
EditorManager.prototype.execCommand = function (command, value, event, callBack, text, exeValue, selector, enterAction) {
|
|
96
96
|
switch (command.toLocaleLowerCase()) {
|
|
97
97
|
case 'lists':
|
|
98
98
|
this.observer.notify(EVENTS.LIST_TYPE, { subCommand: value, event: event, callBack: callBack,
|
|
99
|
-
selector: selector, item: exeValue });
|
|
99
|
+
selector: selector, item: exeValue, enterAction: enterAction });
|
|
100
100
|
break;
|
|
101
101
|
case 'formats':
|
|
102
102
|
this.observer.notify(EVENTS.FORMAT_TYPE, { subCommand: value, event: event, callBack: callBack,
|
|
103
|
-
selector: selector, exeValue: exeValue
|
|
103
|
+
selector: selector, exeValue: exeValue, enterAction: enterAction
|
|
104
104
|
});
|
|
105
105
|
break;
|
|
106
106
|
case 'alignments':
|
|
@@ -129,7 +129,7 @@ var EditorManager = /** @class */ (function () {
|
|
|
129
129
|
case 'table':
|
|
130
130
|
switch (value.toString().toLocaleLowerCase()) {
|
|
131
131
|
case 'createtable':
|
|
132
|
-
this.observer.notify(CONSTANT.TABLE, { item: exeValue, event: event, callBack: callBack });
|
|
132
|
+
this.observer.notify(CONSTANT.TABLE, { item: exeValue, event: event, callBack: callBack, enterAction: enterAction });
|
|
133
133
|
break;
|
|
134
134
|
case 'insertrowbefore':
|
|
135
135
|
case 'insertrowafter':
|
|
@@ -171,7 +171,7 @@ var EditorManager = /** @class */ (function () {
|
|
|
171
171
|
case 'style':
|
|
172
172
|
case 'effects':
|
|
173
173
|
case 'casing':
|
|
174
|
-
this.observer.notify(CONSTANT.SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector });
|
|
174
|
+
this.observer.notify(CONSTANT.SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
|
|
175
175
|
break;
|
|
176
176
|
case 'inserthtml':
|
|
177
177
|
this.observer.notify(CONSTANT.INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
@@ -180,7 +180,7 @@ var EditorManager = /** @class */ (function () {
|
|
|
180
180
|
this.observer.notify(CONSTANT.INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
181
181
|
break;
|
|
182
182
|
case 'clear':
|
|
183
|
-
this.observer.notify(CONSTANT.CLEAR_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector });
|
|
183
|
+
this.observer.notify(CONSTANT.CLEAR_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector, enterAction: enterAction });
|
|
184
184
|
break;
|
|
185
185
|
case 'actions':
|
|
186
186
|
this.observer.notify(EVENTS.ACTION, { subCommand: value, event: event, callBack: callBack, selector: selector });
|
|
@@ -57,6 +57,7 @@ export interface IHtmlSubCommands {
|
|
|
57
57
|
exeValue?: {
|
|
58
58
|
[key: string]: string;
|
|
59
59
|
};
|
|
60
|
+
enterAction?: string;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Specifies IKeyboardActionArgs interfaces for command line.
|
|
@@ -85,6 +86,7 @@ export interface IHtmlItem {
|
|
|
85
86
|
value: string;
|
|
86
87
|
selector: string;
|
|
87
88
|
callBack(args: IHtmlFormatterCallBack): () => void;
|
|
89
|
+
enterAction?: string;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
|
|
@@ -109,7 +111,7 @@ export interface IHtmlItemArgs {
|
|
|
109
111
|
height?: string | number;
|
|
110
112
|
};
|
|
111
113
|
altText?: string;
|
|
112
|
-
|
|
114
|
+
rows?: number;
|
|
113
115
|
columns?: number;
|
|
114
116
|
subCommand?: string;
|
|
115
117
|
tableCell?: HTMLElement;
|
|
@@ -148,4 +150,8 @@ export interface IHtmlKeyboardEvent {
|
|
|
148
150
|
* Specifies the notifier name.
|
|
149
151
|
*/
|
|
150
152
|
name?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Specifies the enter key configuration.
|
|
155
|
+
*/
|
|
156
|
+
enterAction?: string;
|
|
151
157
|
}
|
|
@@ -27,14 +27,14 @@ var ClearFormatExec = /** @class */ (function () {
|
|
|
27
27
|
ClearFormatExec.prototype.onKeyDown = function (e) {
|
|
28
28
|
switch (e.event.action) {
|
|
29
29
|
case 'clear-format':
|
|
30
|
-
this.applyClear({ subCommand: 'ClearFormat', callBack: e.callBack });
|
|
30
|
+
this.applyClear({ subCommand: 'ClearFormat', callBack: e.callBack, enterAction: e.enterAction });
|
|
31
31
|
e.event.preventDefault();
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
ClearFormatExec.prototype.applyClear = function (e) {
|
|
36
36
|
if (e.subCommand === 'ClearFormat') {
|
|
37
|
-
ClearFormat.clear(this.parent.currentDocument, this.parent.editableElement, e.selector);
|
|
37
|
+
ClearFormat.clear(this.parent.currentDocument, this.parent.editableElement, e.enterAction, e.selector);
|
|
38
38
|
if (e.callBack) {
|
|
39
39
|
e.callBack({
|
|
40
40
|
requestType: e.subCommand,
|
|
@@ -3,6 +3,8 @@ export declare class ClearFormat {
|
|
|
3
3
|
private static NONVALID_PARENT_TAGS;
|
|
4
4
|
private static IGNORE_PARENT_TAGS;
|
|
5
5
|
private static NONVALID_TAGS;
|
|
6
|
+
private static defaultTag;
|
|
7
|
+
private static domNode;
|
|
6
8
|
/**
|
|
7
9
|
* clear method
|
|
8
10
|
*
|
|
@@ -13,7 +15,7 @@ export declare class ClearFormat {
|
|
|
13
15
|
* @hidden
|
|
14
16
|
|
|
15
17
|
*/
|
|
16
|
-
static clear(docElement: Document, endNode: Node, selector?: string): void;
|
|
18
|
+
static clear(docElement: Document, endNode: Node, enterAction: string, selector?: string): void;
|
|
17
19
|
private static reSelection;
|
|
18
20
|
private static clearBlocks;
|
|
19
21
|
private static spliceParent;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { closest } from '@syncfusion/ej2-base';
|
|
5
5
|
import { NodeSelection } from './../../selection/index';
|
|
6
6
|
import { NodeCutter } from './nodecutter';
|
|
7
|
+
import { DOMNode } from './dom-node';
|
|
7
8
|
import { InsertMethods } from './insert-methods';
|
|
8
9
|
import { IsFormatted } from './isformatted';
|
|
9
10
|
import { isIDevice, setEditFrameFocus } from '../../common/util';
|
|
@@ -20,7 +21,9 @@ var ClearFormat = /** @class */ (function () {
|
|
|
20
21
|
* @hidden
|
|
21
22
|
|
|
22
23
|
*/
|
|
23
|
-
ClearFormat.clear = function (docElement, endNode, selector) {
|
|
24
|
+
ClearFormat.clear = function (docElement, endNode, enterAction, selector) {
|
|
25
|
+
this.domNode = new DOMNode(endNode, docElement);
|
|
26
|
+
this.defaultTag = enterAction === 'P' ? this.defaultTag : 'div';
|
|
24
27
|
var nodeSelection = new NodeSelection();
|
|
25
28
|
var nodeCutter = new NodeCutter();
|
|
26
29
|
var range = nodeSelection.getRange(docElement);
|
|
@@ -165,12 +168,12 @@ var ClearFormat = /** @class */ (function () {
|
|
|
165
168
|
&& this.IGNORE_PARENT_TAGS.indexOf(parentNodes[index1].childNodes[0].nodeName.toLocaleLowerCase()) > -1)
|
|
166
169
|
&& !(parentNodes[index1].childNodes.length === 1
|
|
167
170
|
&& parentNodes[index1].childNodes[0].nodeName.toLocaleLowerCase() === 'p')) {
|
|
168
|
-
InsertMethods.Wrap(parentNodes[index1], docElement.createElement(
|
|
171
|
+
InsertMethods.Wrap(parentNodes[index1], docElement.createElement(this.defaultTag));
|
|
169
172
|
}
|
|
170
173
|
var childNodes = InsertMethods.unwrap(parentNodes[index1]);
|
|
171
174
|
if (childNodes.length === 1
|
|
172
175
|
&& childNodes[0].parentNode.nodeName.toLocaleLowerCase() === 'p') {
|
|
173
|
-
InsertMethods.Wrap(parentNodes[index1], docElement.createElement(
|
|
176
|
+
InsertMethods.Wrap(parentNodes[index1], docElement.createElement(this.defaultTag));
|
|
174
177
|
InsertMethods.unwrap(parentNodes[index1]);
|
|
175
178
|
}
|
|
176
179
|
for (var index2 = 0; index2 < childNodes.length; index2++) {
|
|
@@ -188,13 +191,13 @@ var ClearFormat = /** @class */ (function () {
|
|
|
188
191
|
}
|
|
189
192
|
else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
|
|
190
193
|
childNodes[index2].nodeName.toLocaleLowerCase() === 'p') {
|
|
191
|
-
InsertMethods.Wrap(childNodes[index2], docElement.createElement(
|
|
194
|
+
InsertMethods.Wrap(childNodes[index2], docElement.createElement(this.defaultTag));
|
|
192
195
|
InsertMethods.unwrap(childNodes[index2]);
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
}
|
|
196
199
|
else {
|
|
197
|
-
InsertMethods.Wrap(parentNodes[index1], docElement.createElement(
|
|
200
|
+
InsertMethods.Wrap(parentNodes[index1], docElement.createElement(this.defaultTag));
|
|
198
201
|
InsertMethods.unwrap(parentNodes[index1]);
|
|
199
202
|
}
|
|
200
203
|
}
|
|
@@ -203,10 +206,16 @@ var ClearFormat = /** @class */ (function () {
|
|
|
203
206
|
// eslint-disable-next-line
|
|
204
207
|
endNode) {
|
|
205
208
|
for (var index = 0; index < textNodes.length; index++) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
var currentInlineNode = textNodes[index];
|
|
210
|
+
var currentNode = void 0;
|
|
211
|
+
while (!this.domNode.isBlockNode(currentInlineNode)) {
|
|
212
|
+
currentNode = currentInlineNode;
|
|
213
|
+
currentInlineNode = currentInlineNode.parentElement;
|
|
214
|
+
}
|
|
215
|
+
if (currentNode &&
|
|
216
|
+
IsFormatted.inlineTags.indexOf(currentNode.nodeName.toLocaleLowerCase()) > -1) {
|
|
217
|
+
nodeCutter.GetSpliceNode(range, currentNode);
|
|
218
|
+
this.removeInlineParent(currentNode);
|
|
210
219
|
}
|
|
211
220
|
}
|
|
212
221
|
};
|
|
@@ -229,6 +238,7 @@ var ClearFormat = /** @class */ (function () {
|
|
|
229
238
|
ClearFormat.NONVALID_PARENT_TAGS = ['thead', 'tbody', 'ul', 'ol', 'table', 'tfoot', 'tr'];
|
|
230
239
|
ClearFormat.IGNORE_PARENT_TAGS = ['ul', 'ol', 'table'];
|
|
231
240
|
ClearFormat.NONVALID_TAGS = ['thead', 'tbody', 'figcaption', 'td', 'tr', 'th', 'tfoot', 'figcaption', 'li'];
|
|
241
|
+
ClearFormat.defaultTag = 'p';
|
|
232
242
|
return ClearFormat;
|
|
233
243
|
}());
|
|
234
244
|
export { ClearFormat };
|
|
@@ -573,8 +573,8 @@ var DOMNode = /** @class */ (function () {
|
|
|
573
573
|
this.replaceWith(start, this.marker(className, this.encode(start.textContent)));
|
|
574
574
|
}
|
|
575
575
|
else if (start.tagName === 'BR') {
|
|
576
|
-
this.replaceWith(start, this.marker(
|
|
577
|
-
var markerStart = range.startContainer.querySelector('.' +
|
|
576
|
+
this.replaceWith(start, this.marker(className, this.encode(start.textContent)));
|
|
577
|
+
var markerStart = range.startContainer.querySelector('.' + className);
|
|
578
578
|
markerStart.appendChild(start);
|
|
579
579
|
}
|
|
580
580
|
else {
|
|
@@ -39,7 +39,7 @@ var Formats = /** @class */ (function () {
|
|
|
39
39
|
if (e.event.which === 13 && range.startContainer === endCon && endCon.nodeType !== 3) {
|
|
40
40
|
var pTag = createElement('p');
|
|
41
41
|
pTag.innerHTML = '<br>';
|
|
42
|
-
if (lastChild && lastChild.nodeName === 'BR' && (lastChild.previousSibling && lastChild.previousSibling.nodeName === 'TABLE')) {
|
|
42
|
+
if (!isNOU(lastChild) && lastChild && lastChild.nodeName === 'BR' && (lastChild.previousSibling && lastChild.previousSibling.nodeName === 'TABLE')) {
|
|
43
43
|
endCon.replaceChild(pTag, lastChild);
|
|
44
44
|
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, pTag, 0);
|
|
45
45
|
}
|
|
@@ -82,7 +82,7 @@ var Formats = /** @class */ (function () {
|
|
|
82
82
|
var startParent = range.startContainer;
|
|
83
83
|
if (!isNOU(lastEmpty) && !isNOU(lastBeforeBr) && isNOU(lastEmpty.nextSibling) &&
|
|
84
84
|
lastEmpty.nodeName === 'BR' && lastBeforeBr.nodeName === 'BR') {
|
|
85
|
-
this.paraFocus(range.startContainer);
|
|
85
|
+
this.paraFocus(range.startContainer, e.enterAction);
|
|
86
86
|
}
|
|
87
87
|
else if ((startParent.textContent.charCodeAt(0) === 8203 &&
|
|
88
88
|
startParent.textContent.length === 1) || startParent.textContent.length === 0) {
|
|
@@ -125,11 +125,21 @@ var Formats = /** @class */ (function () {
|
|
|
125
125
|
range.deleteContents();
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
Formats.prototype.paraFocus = function (referNode) {
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
Formats.prototype.paraFocus = function (referNode, enterAction) {
|
|
129
|
+
var insertTag;
|
|
130
|
+
if (enterAction === 'DIV') {
|
|
131
|
+
insertTag = createElement('div');
|
|
132
|
+
insertTag.innerHTML = '<br>';
|
|
133
|
+
}
|
|
134
|
+
else if (enterAction === 'BR') {
|
|
135
|
+
insertTag = createElement('br');
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
insertTag = createElement('p');
|
|
139
|
+
insertTag.innerHTML = '<br>';
|
|
140
|
+
}
|
|
141
|
+
this.parent.domNode.insertAfter(insertTag, referNode);
|
|
142
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, insertTag, 0);
|
|
133
143
|
detach(referNode.lastChild);
|
|
134
144
|
};
|
|
135
145
|
Formats.prototype.isNotEndCursor = function (preElem, range) {
|
|
@@ -211,6 +221,66 @@ var Formats = /** @class */ (function () {
|
|
|
211
221
|
var save = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
212
222
|
this.parent.domNode.setMarker(save);
|
|
213
223
|
var formatsNodes = this.parent.domNode.blockNodes();
|
|
224
|
+
if (e.enterAction === 'BR') {
|
|
225
|
+
this.setSelectionBRConfig();
|
|
226
|
+
var allSelectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument);
|
|
227
|
+
var selectedNodes = this.parent.nodeSelection.getSelectionNodes(allSelectedNode);
|
|
228
|
+
var currentFormatNodes = [];
|
|
229
|
+
if (selectedNodes.length === 0) {
|
|
230
|
+
selectedNodes.push(formatsNodes[0]);
|
|
231
|
+
}
|
|
232
|
+
for (var i = 0; i < selectedNodes.length; i++) {
|
|
233
|
+
var currentNode = selectedNodes[i];
|
|
234
|
+
var previousCurrentNode = void 0;
|
|
235
|
+
while (!this.parent.domNode.isBlockNode(currentNode) && currentNode !== this.parent.editableElement) {
|
|
236
|
+
previousCurrentNode = currentNode;
|
|
237
|
+
currentNode = currentNode.parentElement;
|
|
238
|
+
}
|
|
239
|
+
if (this.parent.domNode.isBlockNode(currentNode) && currentNode === this.parent.editableElement) {
|
|
240
|
+
currentFormatNodes.push(previousCurrentNode);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
for (var i = 0; i < currentFormatNodes.length; i++) {
|
|
244
|
+
if (!this.parent.domNode.isBlockNode(currentFormatNodes[i])) {
|
|
245
|
+
var currentNode = currentFormatNodes[i];
|
|
246
|
+
var previousNode = currentNode;
|
|
247
|
+
while (currentNode === this.parent.editableElement) {
|
|
248
|
+
previousNode = currentNode;
|
|
249
|
+
currentNode = currentNode.parentElement;
|
|
250
|
+
}
|
|
251
|
+
var tempElem = void 0;
|
|
252
|
+
if (this.parent.domNode.isBlockNode(previousNode.parentElement) &&
|
|
253
|
+
previousNode.parentElement === this.parent.editableElement) {
|
|
254
|
+
tempElem = createElement('div');
|
|
255
|
+
previousNode.parentElement.insertBefore(tempElem, previousNode);
|
|
256
|
+
tempElem.appendChild(previousNode);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
tempElem = previousNode;
|
|
260
|
+
}
|
|
261
|
+
var preNode = tempElem.previousSibling;
|
|
262
|
+
while (!isNOU(preNode) && preNode.nodeName !== 'BR' &&
|
|
263
|
+
!this.parent.domNode.isBlockNode(preNode)) {
|
|
264
|
+
tempElem.firstChild.parentElement.insertBefore(preNode, tempElem.firstChild);
|
|
265
|
+
preNode = tempElem.previousSibling;
|
|
266
|
+
}
|
|
267
|
+
if (!isNOU(preNode) && preNode.nodeName === 'BR') {
|
|
268
|
+
detach(preNode);
|
|
269
|
+
}
|
|
270
|
+
var postNode = tempElem.nextSibling;
|
|
271
|
+
while (!isNOU(postNode) && postNode.nodeName !== 'BR' &&
|
|
272
|
+
!this.parent.domNode.isBlockNode(postNode)) {
|
|
273
|
+
tempElem.appendChild(postNode);
|
|
274
|
+
postNode = tempElem.nextSibling;
|
|
275
|
+
}
|
|
276
|
+
if (!isNOU(postNode) && postNode.nodeName === 'BR') {
|
|
277
|
+
detach(postNode);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this.setSelectionBRConfig();
|
|
282
|
+
formatsNodes = this.parent.domNode.blockNodes();
|
|
283
|
+
}
|
|
214
284
|
for (var i = 0; i < formatsNodes.length; i++) {
|
|
215
285
|
var parentNode = void 0;
|
|
216
286
|
var replaceHTML = void 0;
|
|
@@ -269,6 +339,16 @@ var Formats = /** @class */ (function () {
|
|
|
269
339
|
});
|
|
270
340
|
}
|
|
271
341
|
};
|
|
342
|
+
Formats.prototype.setSelectionBRConfig = function () {
|
|
343
|
+
var startElem = this.parent.editableElement.querySelector('.' + markerClassName.startSelection);
|
|
344
|
+
var endElem = this.parent.editableElement.querySelector('.' + markerClassName.endSelection);
|
|
345
|
+
if (isNOU(endElem)) {
|
|
346
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, startElem, 0);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
this.parent.nodeSelection.setSelectionText(this.parent.currentDocument, startElem, endElem, 0, 0);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
272
352
|
Formats.prototype.preFormatMerge = function () {
|
|
273
353
|
var preNodes = this.parent.editableElement.querySelectorAll('PRE');
|
|
274
354
|
if (!isNOU(preNodes)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement, isNullOrUndefined as isNOU, detach, closest, addClass, removeClass, select, Browser } from '@syncfusion/ej2-base';
|
|
1
|
+
import { createElement, isNullOrUndefined as isNOU, detach, closest, addClass, removeClass, select, Browser, formatUnit } from '@syncfusion/ej2-base';
|
|
2
2
|
import * as CONSTANT from './../base/constant';
|
|
3
3
|
import * as classes from './../base/classes';
|
|
4
4
|
import { InsertHtml } from './inserthtml';
|
|
@@ -253,8 +253,10 @@ var ImageCommand = /** @class */ (function () {
|
|
|
253
253
|
var selectNode = e.item.selectNode[0];
|
|
254
254
|
selectNode.style.height = '';
|
|
255
255
|
selectNode.style.width = '';
|
|
256
|
-
selectNode.width = e.item.width
|
|
257
|
-
|
|
256
|
+
e.item.width !== 'auto' ? selectNode.style.width = formatUnit(e.item.width) :
|
|
257
|
+
selectNode.removeAttribute('width');
|
|
258
|
+
e.item.height !== 'auto' ? selectNode.style.height = formatUnit(e.item.height) :
|
|
259
|
+
selectNode.removeAttribute('height');
|
|
258
260
|
this.callBack(e);
|
|
259
261
|
};
|
|
260
262
|
ImageCommand.prototype.imageCaption = function (e) {
|
|
@@ -263,59 +265,65 @@ var ImageCommand = /** @class */ (function () {
|
|
|
263
265
|
};
|
|
264
266
|
ImageCommand.prototype.imageJustifyLeft = function (e) {
|
|
265
267
|
var selectNode = e.item.selectNode[0];
|
|
266
|
-
selectNode
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
268
|
+
if (!isNOU(selectNode)) {
|
|
269
|
+
selectNode.removeAttribute('class');
|
|
270
|
+
addClass([selectNode], 'e-rte-image');
|
|
271
|
+
if (!isNOU(closest(selectNode, '.' + classes.CLASS_CAPTION))) {
|
|
272
|
+
removeClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_RIGHT);
|
|
273
|
+
addClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_LEFT);
|
|
274
|
+
}
|
|
275
|
+
if (selectNode.parentElement.nodeName === 'A') {
|
|
276
|
+
removeClass([selectNode.parentElement], classes.CLASS_IMAGE_RIGHT);
|
|
277
|
+
addClass([selectNode.parentElement], classes.CLASS_IMAGE_LEFT);
|
|
278
|
+
addClass([selectNode], classes.CLASS_IMAGE_LEFT);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
addClass([selectNode], classes.CLASS_IMAGE_LEFT);
|
|
282
|
+
}
|
|
283
|
+
this.callBack(e);
|
|
279
284
|
}
|
|
280
|
-
this.callBack(e);
|
|
281
285
|
};
|
|
282
286
|
ImageCommand.prototype.imageJustifyCenter = function (e) {
|
|
283
287
|
var selectNode = e.item.selectNode[0];
|
|
284
|
-
selectNode
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
288
|
+
if (!isNOU(selectNode)) {
|
|
289
|
+
selectNode.removeAttribute('class');
|
|
290
|
+
addClass([selectNode], 'e-rte-image');
|
|
291
|
+
if (!isNOU(closest(selectNode, '.' + classes.CLASS_CAPTION))) {
|
|
292
|
+
removeClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_LEFT);
|
|
293
|
+
removeClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_RIGHT);
|
|
294
|
+
addClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_CENTER);
|
|
295
|
+
}
|
|
296
|
+
if (selectNode.parentElement.nodeName === 'A') {
|
|
297
|
+
removeClass([selectNode.parentElement], classes.CLASS_IMAGE_LEFT);
|
|
298
|
+
removeClass([selectNode.parentElement], classes.CLASS_IMAGE_RIGHT);
|
|
299
|
+
addClass([selectNode.parentElement], classes.CLASS_IMAGE_CENTER);
|
|
300
|
+
addClass([selectNode], classes.CLASS_IMAGE_CENTER);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
addClass([selectNode], classes.CLASS_IMAGE_CENTER);
|
|
304
|
+
}
|
|
305
|
+
this.callBack(e);
|
|
299
306
|
}
|
|
300
|
-
this.callBack(e);
|
|
301
307
|
};
|
|
302
308
|
ImageCommand.prototype.imageJustifyRight = function (e) {
|
|
303
309
|
var selectNode = e.item.selectNode[0];
|
|
304
|
-
selectNode
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
310
|
+
if (!isNOU(selectNode)) {
|
|
311
|
+
selectNode.removeAttribute('class');
|
|
312
|
+
addClass([selectNode], 'e-rte-image');
|
|
313
|
+
if (!isNOU(closest(selectNode, '.' + classes.CLASS_CAPTION))) {
|
|
314
|
+
removeClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_LEFT);
|
|
315
|
+
addClass([closest(selectNode, '.' + classes.CLASS_CAPTION)], classes.CLASS_IMAGE_RIGHT);
|
|
316
|
+
}
|
|
317
|
+
if (selectNode.parentElement.nodeName === 'A') {
|
|
318
|
+
removeClass([selectNode.parentElement], classes.CLASS_IMAGE_LEFT);
|
|
319
|
+
addClass([selectNode.parentElement], classes.CLASS_IMAGE_RIGHT);
|
|
320
|
+
addClass([selectNode], classes.CLASS_IMAGE_RIGHT);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
addClass([selectNode], classes.CLASS_IMAGE_RIGHT);
|
|
324
|
+
}
|
|
325
|
+
this.callBack(e);
|
|
317
326
|
}
|
|
318
|
-
this.callBack(e);
|
|
319
327
|
};
|
|
320
328
|
ImageCommand.prototype.imageInline = function (e) {
|
|
321
329
|
var selectNode = e.item.selectNode[0];
|
|
@@ -115,7 +115,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
117
117
|
range.deleteContents();
|
|
118
|
-
if (isCursor && range.startContainer.textContent === '') {
|
|
118
|
+
if (isCursor && range.startContainer.textContent === '' && range.startContainer.nodeName !== 'BR') {
|
|
119
119
|
range.startContainer.innerHTML = '';
|
|
120
120
|
}
|
|
121
121
|
if (Browser.isIE) {
|
|
@@ -134,7 +134,12 @@ var InsertHtml = /** @class */ (function () {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
|
-
range.
|
|
137
|
+
if (range.startContainer.nodeName === 'BR') {
|
|
138
|
+
range.startContainer.parentElement.insertBefore(node, range.startContainer);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
range.insertNode(node);
|
|
142
|
+
}
|
|
138
143
|
}
|
|
139
144
|
if (node.nodeType !== 3 && node.childNodes.length > 0) {
|
|
140
145
|
nodeSelection.setSelectionText(docElement, node, node, 1, 1);
|
|
@@ -346,6 +351,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
346
351
|
range.setStart(editNode.firstElementChild, editNode.firstElementChild.textContent.length);
|
|
347
352
|
range.setEnd(editNode.firstElementChild, editNode.firstElementChild.textContent.length);
|
|
348
353
|
}
|
|
354
|
+
if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
355
|
+
blockNode = range.startContainer;
|
|
356
|
+
}
|
|
349
357
|
if (blockNode.nodeName === 'TD' || blockNode.nodeName === 'TH') {
|
|
350
358
|
var tempSpan = createElement('span', { className: 'tempSpan' });
|
|
351
359
|
range.insertNode(tempSpan);
|