@syncfusion/ej2-richtexteditor 20.1.57 → 20.1.60
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 +46 -0
- 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 +147 -12
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +136 -13
- 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 +10 -10
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +38 -1
- package/src/editor-manager/plugin/selection-commands.js +10 -2
- package/src/rich-text-editor/actions/html-editor.js +11 -1
- package/src/rich-text-editor/actions/toolbar.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 +4 -0
- package/src/rich-text-editor/base/rich-text-editor.d.ts +5 -0
- package/src/rich-text-editor/base/rich-text-editor.js +43 -2
- package/src/rich-text-editor/base/util.js +5 -0
- package/src/rich-text-editor/formatter/formatter.js +15 -0
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +5 -2
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 20.1.
|
|
3
|
+
* version : 20.1.60
|
|
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@20.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@20.1.59",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-O3QS2MUDxyND2e4A9Dl8mIlNzLQXd5eC5w1F6tRfYmRCNfW3cWqa1LUDaNT5pQVpzuMky/5MuX18aY1Gx1Mp6g==",
|
|
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-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.1.
|
|
30
|
-
"_shasum": "
|
|
29
|
+
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.1.59.tgz",
|
|
30
|
+
"_shasum": "7b77b788311525699b0cf6710a46229c87d43b4f",
|
|
31
31
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
32
32
|
"_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
|
|
33
33
|
"author": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"bundleDependencies": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@syncfusion/ej2-base": "~20.1.
|
|
41
|
+
"@syncfusion/ej2-base": "~20.1.60",
|
|
42
42
|
"@syncfusion/ej2-buttons": "~20.1.55",
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~20.1.
|
|
44
|
-
"@syncfusion/ej2-inputs": "~20.1.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~20.1.
|
|
46
|
-
"@syncfusion/ej2-popups": "~20.1.
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~20.1.60",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~20.1.59",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~20.1.60",
|
|
46
|
+
"@syncfusion/ej2-popups": "~20.1.58",
|
|
47
47
|
"@syncfusion/ej2-splitbuttons": "~20.1.57"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
@@ -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": "20.1.
|
|
73
|
+
"version": "20.1.60",
|
|
74
74
|
"sideEffects": false
|
|
75
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as CONSTANT from './../base/constant';
|
|
2
|
-
import { createElement, detach, prepend, append, attributes } from '@syncfusion/ej2-base';
|
|
2
|
+
import { createElement, detach, prepend, append, attributes, Browser } from '@syncfusion/ej2-base';
|
|
3
3
|
import { markerClassName } from './dom-node';
|
|
4
4
|
import * as EVENTS from './../../common/constant';
|
|
5
5
|
import { setStyleAttribute } from '@syncfusion/ej2-base';
|
|
@@ -178,6 +178,29 @@ var Lists = /** @class */ (function () {
|
|
|
178
178
|
parentList.parentElement.insertBefore(startNode.children[1], parentList);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
+
this.removeList(range, e);
|
|
182
|
+
};
|
|
183
|
+
Lists.prototype.removeList = function (range, e) {
|
|
184
|
+
var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
|
|
185
|
+
var endNode = this.parent.domNode.getSelectedNode(range.endContainer, range.endOffset);
|
|
186
|
+
startNode = startNode.nodeName === 'BR' ? startNode.parentElement : startNode;
|
|
187
|
+
endNode = endNode.nodeName === 'BR' ? endNode.parentElement : endNode;
|
|
188
|
+
if (((range.commonAncestorContainer.nodeName === 'OL' || range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'LI') &&
|
|
189
|
+
isNOU(endNode.nextElementSibling) && endNode.textContent.length === range.endOffset &&
|
|
190
|
+
isNOU(startNode.previousElementSibling) && range.startOffset === 0) ||
|
|
191
|
+
(Browser.userAgent.indexOf('Firefox') != -1 && range.startContainer === range.endContainer && range.startContainer === this.parent.editableElement &&
|
|
192
|
+
range.startOffset === 0 && range.endOffset === 1)) {
|
|
193
|
+
if (Browser.userAgent.indexOf('Firefox') != -1) {
|
|
194
|
+
detach(range.commonAncestorContainer.childNodes[0]);
|
|
195
|
+
}
|
|
196
|
+
else if (range.commonAncestorContainer.nodeName === 'LI') {
|
|
197
|
+
detach(range.commonAncestorContainer.parentElement);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
detach(range.commonAncestorContainer);
|
|
201
|
+
}
|
|
202
|
+
e.event.preventDefault();
|
|
203
|
+
}
|
|
181
204
|
};
|
|
182
205
|
Lists.prototype.keyDownHandler = function (e) {
|
|
183
206
|
if (e.event.which === 13) {
|
|
@@ -202,6 +225,7 @@ var Lists = /** @class */ (function () {
|
|
|
202
225
|
&& (commonAncestor.lastElementChild === closest(endNode, 'li')) && !range.collapsed) {
|
|
203
226
|
detach(commonAncestor);
|
|
204
227
|
}
|
|
228
|
+
this.removeList(range, e);
|
|
205
229
|
}
|
|
206
230
|
if (e.event.which === 9) {
|
|
207
231
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
@@ -417,6 +441,19 @@ var Lists = /** @class */ (function () {
|
|
|
417
441
|
};
|
|
418
442
|
Lists.prototype.applyListsHandler = function (e) {
|
|
419
443
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
444
|
+
if (Browser.userAgent.indexOf('Firefox') != -1 && range.startContainer === range.endContainer && range.startContainer === this.parent.editableElement) {
|
|
445
|
+
var startChildNodes = range.startContainer.childNodes;
|
|
446
|
+
var startNode = ((startChildNodes[(range.startOffset > 0) ? (range.startOffset - 1) : range.startOffset]) || range.startContainer);
|
|
447
|
+
var endNode = (range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset] || range.endContainer);
|
|
448
|
+
var lastSelectionNode = endNode.lastChild.nodeName === 'BR' ? (isNOU(endNode.lastChild.previousSibling) ? endNode
|
|
449
|
+
: endNode.lastChild.previousSibling) : endNode.lastChild;
|
|
450
|
+
while (!isNOU(lastSelectionNode) && lastSelectionNode.nodeName !== '#text' && lastSelectionNode.nodeName !== 'IMG' &&
|
|
451
|
+
lastSelectionNode.nodeName !== 'BR' && lastSelectionNode.nodeName !== 'HR') {
|
|
452
|
+
lastSelectionNode = lastSelectionNode.lastChild;
|
|
453
|
+
}
|
|
454
|
+
this.parent.nodeSelection.setSelectionText(this.parent.currentDocument, startNode, lastSelectionNode, 0, lastSelectionNode.textContent.length);
|
|
455
|
+
range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
456
|
+
}
|
|
420
457
|
if (range.startContainer === range.endContainer && range.startContainer === this.parent.editableElement &&
|
|
421
458
|
range.startOffset === range.endOffset && range.startOffset === 0 &&
|
|
422
459
|
this.parent.editableElement.textContent.length === 0 && (this.parent.editableElement.childNodes[0].nodeName != 'TABLE' &&
|
|
@@ -270,8 +270,16 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
270
270
|
for (; nodeTraverse && nodeTraverse.parentElement && nodeTraverse.parentElement !== endNode;
|
|
271
271
|
// eslint-disable-next-line
|
|
272
272
|
nodeTraverse = nodeTraverse) {
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
var nodeTraverseCondition = void 0;
|
|
274
|
+
if (formatNode.nodeName === 'SPAN') {
|
|
275
|
+
nodeTraverseCondition = nodeTraverse.parentElement.tagName.toLocaleLowerCase()
|
|
276
|
+
=== formatNode.tagName.toLocaleLowerCase() && nodeTraverse.parentElement.getAttribute('style') === formatNodeStyles;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
nodeTraverseCondition = nodeTraverse.parentElement.tagName.toLocaleLowerCase()
|
|
280
|
+
=== formatNode.tagName.toLocaleLowerCase();
|
|
281
|
+
}
|
|
282
|
+
if (nodeTraverse.parentElement && nodeTraverseCondition &&
|
|
275
283
|
(nodeTraverse.parentElement.childElementCount > 1 || range.startOffset > 1)) {
|
|
276
284
|
if (textNode.parentElement && textNode.parentElement.tagName.toLocaleLowerCase()
|
|
277
285
|
=== formatNode.tagName.toLocaleLowerCase()) {
|
|
@@ -153,7 +153,17 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
153
153
|
e.args.keyCode === 13) {
|
|
154
154
|
this.spaceLink(e.args);
|
|
155
155
|
if (this.parent.editorMode === 'HTML' && !this.parent.readonly) {
|
|
156
|
-
this.parent.
|
|
156
|
+
var currentLength = this.parent.getText().trim().length;
|
|
157
|
+
var selectionLength = this.parent.getSelection().length;
|
|
158
|
+
var totalLength = (currentLength - selectionLength) + 1;
|
|
159
|
+
if (!(this.parent.maxLength === -1 || totalLength <= this.parent.maxLength) &&
|
|
160
|
+
e.args.keyCode === 13) {
|
|
161
|
+
e.args.preventDefault();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this.parent.notify(events.enterHandler, { args: e.args });
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
if (e.args.action === 'space') {
|
|
@@ -452,9 +452,7 @@ var Toolbar = /** @class */ (function () {
|
|
|
452
452
|
|
|
453
453
|
*/
|
|
454
454
|
Toolbar.prototype.refreshToolbarOverflow = function () {
|
|
455
|
-
|
|
456
|
-
this.baseToolbar.toolbarObj.refreshOverflow();
|
|
457
|
-
}
|
|
455
|
+
this.baseToolbar.toolbarObj.refreshOverflow();
|
|
458
456
|
};
|
|
459
457
|
Toolbar.prototype.isToolbarDestroyed = function () {
|
|
460
458
|
return this.baseToolbar.toolbarObj && !this.baseToolbar.toolbarObj.isDestroyed;
|
|
@@ -635,7 +633,9 @@ var Toolbar = /** @class */ (function () {
|
|
|
635
633
|
}
|
|
636
634
|
};
|
|
637
635
|
Toolbar.prototype.onRefresh = function () {
|
|
638
|
-
this.
|
|
636
|
+
if (!this.parent.inlineMode.enable) {
|
|
637
|
+
this.refreshToolbarOverflow();
|
|
638
|
+
}
|
|
639
639
|
this.parent.setContentHeight('', true);
|
|
640
640
|
};
|
|
641
641
|
/**
|
|
@@ -606,3 +606,8 @@ export var closeTableDialog = 'closeTableDialog';
|
|
|
606
606
|
|
|
607
607
|
*/
|
|
608
608
|
export var bindCssClass = 'closeTableDialog';
|
|
609
|
+
/**
|
|
610
|
+
* @hidden
|
|
611
|
+
|
|
612
|
+
*/
|
|
613
|
+
export var blockInlineEmptyNodes = "address:empty, article:empty, aside:empty, blockquote:empty,\ndetails:empty, dd:empty, div:empty, dl:empty, dt:empty, fieldset:empty, footer:empty,form:empty, h1:empty,\nh2:empty, h3:empty, h4:empty, h5:empty, h6:empty, header:empty, hgroup:empty, hr:empty, li:empty, main:empty, nav:empty,\nnoscript:empty, output:empty, p:empty, pre:empty, section:empty, td:empty, th:empty,\na:empty, abbr:empty, acronym:empty, b:empty, bdi:empty, bdo:empty, big:empty, button:empty,\ncanvas:empty, cite:empty, code:empty, data:empty, datalist:empty, del:empty, dfn:empty, em:empty, font:empty, i:empty, iframe:empty,\nins:empty, kbd:empty, label:empty, map:empty, mark:empty, meter:empty, noscript:empty, object:empty, output:empty, picture:empty, progress:empty,\nq:empty, ruby:empty, s:empty, samp:empty, script:empty, select:empty, slot:empty, small:empty, span:empty, strong:empty, strike:empty, sub:empty, sup:empty, svg:empty,\ntemplate:empty, textarea:empty, time:empty, u:empty, tt:empty, var:empty, wbr:empty";
|
|
@@ -118,6 +118,7 @@ export interface IRichTextEditor extends Component<HTMLElement> {
|
|
|
118
118
|
getCollection?(items: string | string[]): string[];
|
|
119
119
|
getRange(): Range;
|
|
120
120
|
getID(): string;
|
|
121
|
+
getText(): string;
|
|
121
122
|
updateValueData?(): void;
|
|
122
123
|
getBaseToolbarObject(): BaseToolbar;
|
|
123
124
|
setContentHeight(target?: string, isExpand?: boolean): void;
|
|
@@ -148,6 +149,7 @@ export interface IRichTextEditor extends Component<HTMLElement> {
|
|
|
148
149
|
enableHtmlSanitizer?: boolean;
|
|
149
150
|
getInsertImgMaxWidth?(): string | number;
|
|
150
151
|
getSelection(): string;
|
|
152
|
+
currentTarget: HTMLElement;
|
|
151
153
|
}
|
|
152
154
|
/**
|
|
153
155
|
|
|
@@ -225,6 +227,8 @@ export interface IItemCollectionArgs {
|
|
|
225
227
|
selectParent?: Node[];
|
|
226
228
|
/** Defines the URL action details for link element */
|
|
227
229
|
url?: string;
|
|
230
|
+
/** Defines the Display Text action details for link element */
|
|
231
|
+
text?: string;
|
|
228
232
|
/** Defines the title of the link action details */
|
|
229
233
|
title?: string;
|
|
230
234
|
/** Defines the target as string for link element */
|
|
@@ -339,6 +339,35 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
339
339
|
this.formatter.saveData();
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
+
if (this.maxLength !== -1 && !isNOU(tool.command)) {
|
|
343
|
+
var currentInsertContentLength = 0;
|
|
344
|
+
if (tool.command === 'Links') {
|
|
345
|
+
currentInsertContentLength = value.text.length === 0 ?
|
|
346
|
+
value.url.length : value.text.length;
|
|
347
|
+
}
|
|
348
|
+
if (tool.command === 'Images' || tool.command === 'Table' || tool.command === 'Files') {
|
|
349
|
+
currentInsertContentLength = 1;
|
|
350
|
+
}
|
|
351
|
+
if (tool.command === 'InsertHTML') {
|
|
352
|
+
if (!isNOU(value)) {
|
|
353
|
+
var tempElem = this.createElement('div');
|
|
354
|
+
tempElem.innerHTML = value;
|
|
355
|
+
currentInsertContentLength = tempElem.textContent.length;
|
|
356
|
+
}
|
|
357
|
+
else if (!isNOU(tool.value) && (tool.value === '<hr/>' || tool.value === '<br/>')) {
|
|
358
|
+
currentInsertContentLength = 1;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (tool.command === 'InsertText') {
|
|
362
|
+
currentInsertContentLength = value.length;
|
|
363
|
+
}
|
|
364
|
+
var currentLength = this.getText().trim().length;
|
|
365
|
+
var selectionLength = this.getSelection().length;
|
|
366
|
+
var totalLength = (currentLength - selectionLength) + currentInsertContentLength;
|
|
367
|
+
if (!(this.maxLength === -1 || totalLength <= this.maxLength)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
342
371
|
this.formatter.editorManager.execCommand(tool.command, tool.subCommand ? tool.subCommand : (value ? value : tool.value), null, null, (value ? value : tool.value), (value ? value : tool.value));
|
|
343
372
|
if (option && option.undo) {
|
|
344
373
|
this.formatter.saveData();
|
|
@@ -475,7 +504,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
475
504
|
range.endContainer;
|
|
476
505
|
var closestLI = closest(endNode, 'LI');
|
|
477
506
|
if (!isNOU(closestLI) && endNode.textContent.length === range.endOffset &&
|
|
478
|
-
!range.collapsed) {
|
|
507
|
+
!range.collapsed && isNOU(endNode.nextElementSibling)) {
|
|
479
508
|
closestLI.textContent = closestLI.textContent.trim();
|
|
480
509
|
currentEndOffset = closestLI.textContent.length - 1;
|
|
481
510
|
var currentLastElem = closestLI;
|
|
@@ -571,6 +600,17 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
571
600
|
this.autoResize();
|
|
572
601
|
};
|
|
573
602
|
RichTextEditor.prototype.keyUp = function (e) {
|
|
603
|
+
if (this.editorMode === "HTML") {
|
|
604
|
+
var range = this.getRange();
|
|
605
|
+
if (Browser.userAgent.indexOf('Firefox') != -1 && range.startContainer.nodeName === '#text' &&
|
|
606
|
+
range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
|
|
607
|
+
var range_1 = this.getRange();
|
|
608
|
+
var tempElem = this.createElement(this.enterKey);
|
|
609
|
+
range_1.startContainer.parentElement.insertBefore(tempElem, range_1.startContainer);
|
|
610
|
+
tempElem.appendChild(range_1.startContainer);
|
|
611
|
+
this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), tempElem.childNodes[0], tempElem.childNodes[0], tempElem.childNodes[0].textContent.length, tempElem.childNodes[0].textContent.length);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
574
614
|
this.notify(events.keyUp, { member: 'keyup', args: e });
|
|
575
615
|
if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
|
|
576
616
|
this.inputElement.innerHTML === '<br>')) {
|
|
@@ -723,7 +763,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
723
763
|
requestType: 'Paste'
|
|
724
764
|
};
|
|
725
765
|
this.trigger(events.actionBegin, evenArgs, function (pasteArgs) {
|
|
726
|
-
var currentLength = _this.
|
|
766
|
+
var currentLength = _this.inputElement.textContent.length;
|
|
727
767
|
var selectionLength = _this.getSelection().length;
|
|
728
768
|
var pastedContentLength = (isNOU(e) || isNOU(e.clipboardData))
|
|
729
769
|
? 0 : e.clipboardData.getData('text/plain').length;
|
|
@@ -2088,6 +2128,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
2088
2128
|
};
|
|
2089
2129
|
RichTextEditor.prototype.onIframeMouseDown = function (e) {
|
|
2090
2130
|
this.isBlur = false;
|
|
2131
|
+
this.currentTarget = e.target;
|
|
2091
2132
|
this.notify(events.iframeMouseDown, e);
|
|
2092
2133
|
};
|
|
2093
2134
|
RichTextEditor.prototype.editorKeyDown = function (e) {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { isNullOrUndefined as isNOU, addClass, removeClass, selectAll, createElement } from '@syncfusion/ej2-base';
|
|
5
5
|
import { Browser, detach, SanitizeHtmlHelper, extend } from '@syncfusion/ej2-base';
|
|
6
6
|
import * as classes from '../base/classes';
|
|
7
|
+
import * as CONSTANT from '../base/constant';
|
|
7
8
|
import * as model from '../models/items';
|
|
8
9
|
import { toolsLocale, fontNameLocale, formatsLocale, numberFormatListLocale, bulletFormatListLocale } from '../models/default-locale';
|
|
9
10
|
var undoRedoItems = ['Undo', 'Redo'];
|
|
@@ -413,6 +414,10 @@ export function updateTextNode(value, rteObj) {
|
|
|
413
414
|
var previousParent = void 0;
|
|
414
415
|
var insertElem = void 0;
|
|
415
416
|
while (tempNode.firstChild) {
|
|
417
|
+
var emptyElem = tempNode.querySelectorAll(CONSTANT.blockInlineEmptyNodes);
|
|
418
|
+
for (var i = 0; i < emptyElem.length; i++) {
|
|
419
|
+
emptyElem[i].innerHTML = '<br>';
|
|
420
|
+
}
|
|
416
421
|
if (rteObj.enterKey !== 'BR' && ((tempNode.firstChild.nodeName === '#text' &&
|
|
417
422
|
(tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
|
|
418
423
|
inlineNode.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
@@ -43,6 +43,21 @@ var Formatter = /** @class */ (function () {
|
|
|
43
43
|
|| self.contentModule.getPanel() === range.commonAncestorContainer)) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
if (!isNullOrUndefined(args) && self.maxLength !== -1 && !isNullOrUndefined(args.item.command)) {
|
|
47
|
+
var currentInsertContentLength = 0;
|
|
48
|
+
if (args.item.command === 'Links') {
|
|
49
|
+
currentInsertContentLength = value.text.length === 0 ? value.url.length : value.text.length;
|
|
50
|
+
}
|
|
51
|
+
if (args.item.command === 'Images' || args.item.command === 'Table' || args.item.command === 'Files') {
|
|
52
|
+
currentInsertContentLength = 1;
|
|
53
|
+
}
|
|
54
|
+
var currentLength = self.getText().trim().length;
|
|
55
|
+
var selectionLength = self.getSelection().length;
|
|
56
|
+
var totalLength = (currentLength - selectionLength) + currentInsertContentLength;
|
|
57
|
+
if (!(self.maxLength === -1 || totalLength <= self.maxLength)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
46
61
|
if (isNullOrUndefined(args)) {
|
|
47
62
|
var action_1 = event.action;
|
|
48
63
|
if (action_1 !== 'tab' && action_1 !== 'enter' && action_1 !== 'space' && action_1 !== 'escape') {
|
|
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
import { ContentRender } from '../renderer/content-renderer';
|
|
15
15
|
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
16
|
import { getEditValue } from '../base/util';
|
|
17
|
-
var IFRAMEHEADER = "\n<!DOCTYPE html> \n <html>\n <head>\n <meta charset='utf-8' /> \n <style>\n @charset \"UTF-8\";\n body {\n font-family: \"Roboto\", sans-serif;\n font-size: 14px;\n }\n html, body{height: 100%;margin: 0;}\n body.e-cursor{cursor:default}\n span.e-selected-node\t{background-color: #939393;color: white;}\n span.e-selected-node.e-highlight {background-color: #1d9dd8;}\n body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}\n .e-rte-image {border: 0;cursor: pointer;display:\n block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-img-caption { display: inline-block; float: none; margin: 5px auto; max-width: 100%;position: relative;}\n .e-img-caption.e-caption-inline {display: inline-block;float: none;\n margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));\n position: relativetext-align: center;vertical-align: bottom;}\n .e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;\n margin: auto;opacity: .9;text-align: center;width: 100%;}\n .e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}\n .e-imgleft {float: left;margin: 0 5px 0 0;text-align: left;}\n .e-imgright {float: right;margin: 0 0 0 5px;text-align: right;}\n .e-imgcenter {cursor: pointer;display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-control img:not(.e-resize) {border: 2px solid transparent; z-index: 1000}\n .e-imginline {display: inline-block;float: none;margin-left: 5px;margin-right: 5px;\n max-width: calc(100% - (2 * 5px));vertical-align: bottom;}\n .e-imgbreak {border: 0;cursor: pointer;\n display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-img-focus:not(.e-resize) {border: solid 2px #4a90e2;}\n img.e-img-focus::selection { background: transparent;color: transparent;}\n span.e-rte-imageboxmark { width: 10px; height: 10px; position: absolute; display: block;\n background: #4a90e2; border: 1px solid #fff; z-index: 1000;}\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-mob-rte span.e-rte-imageboxmark { background: #fff; border: 1px solid #4a90e2;\n border-radius: 15px; height: 20px; width: 20px; }\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-rte-content .e-content img.e-resize { z-index: 1000; }\n .e-img-caption .e-img-inner { outline: 0; }\n .e-img-caption a:focus-visible { outline: none; }\n .e-img-caption .e-rte-image.e-imgright, .e-img-caption .e-rte-image.e-imgleft { float: none; margin: 0;}\n body{box-sizing: border-box;min-height: 100px;outline: 0 solid transparent;\n overflow-x: auto;padding: 16px;position: relative;text-align: inherit;z-index: 2;}\n p{margin: 0 0 10px;margin-bottom: 10px;}\n li{margin-bottom: 10px;}\n h1{font-size: 2.17em;font-weight: 400;line-height: 1;margin: 10px 0;}\n h2{font-size: 1.74em;font-weight: 400;margin: 10px 0;}\n h3{font-size: 1.31em;font-weight: 400;margin: 10px 0;}\n h4{font-size: 16px;font-weight: 400;line-height: 1.5;margin: 0;}\n h5{font-size: 00.8em;font-weight: 400;margin: 0;}\n h6{font-size: 00.65em;font-weight: 400;margin: 0;}\n blockquote{margin: 10px 0;margin-left: 0;padding-left: 5px;border-left: solid 2px #5c5c5c;}\n pre{background-color: inherit;border: 0;border-radius: 0;color: #333;\n font-size: inherit;line-height: inherit;margin: 0 0 10px;overflow: visible;padding: 0;\n white-space: pre-wrap;word-break: inherit;word-wrap: break-word;}\n strong, b{font-weight: 700;}\n a{text-decoration: none;user-select: auto;}\n a:hover{text-decoration: underline;};\n p:last-child, pre:last-child, blockquote:last-child{margin-bottom: 0;}\n h3+h4, h4+h5, h5+h6{margin-top: 00.6em;}\n ul:last-child{margin-bottom: 0;}\n table { border-collapse: collapse; empty-cells: show;}\n table td,table th {border: 1px solid #BDBDBD; height: 20px; vertical-align: middle;}\n table.e-alternate-border tbody tr:nth-child(2n) {background-color: #F5F5F5;}\n table th {background-color: #E0E0E0;}\n table.e-dashed-border td,table.e-dashed-border th { border: 1px dashed #BDBDBD} \n table .e-cell-select {border: 1px double #4a90e2;}\n span.e-table-box { cursor: nwse-resize; display: block; height: 10px; position: absolute; width: 10px; }\n span.e-table-box.e-rmob {height: 14px;width: 14px;}\n .e-row-resize, .e-column-resize { background-color: transparent; background-repeat: repeat;\n bottom: 0;cursor: col-resize;height: 1px;overflow: visible;position: absolute;width: 1px; }\n .e-row-resize { cursor: row-resize; height: 1px;}\n .e-table-rhelper { cursor: col-resize; opacity: .87;position: absolute;}\n .e-table-rhelper.e-column-helper { width: 1px; }\n .e-table-rhelper.e-row-helper {height: 1px;}\n .e-reicon::before { border-bottom: 6px solid transparent; border-right: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block; height: 0;\n position: absolute; right: 4px; top: 4px; width: 20px; }\n .e-reicon::after { border-bottom: 6px solid transparent; border-left: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block;\n height: 0; left: 4px; position: absolute; top: 4px; width: 20px; z-index: 3; }\n .e-row-helper.e-reicon::after { top: 10px; transform: rotate(90deg); }\n .e-row-helper.e-reicon::before { left: 4px; top: -20px; transform: rotate(90deg); }\n span.e-table-box { background-color: #ffffff; border: 1px solid #BDBDBD; }\n span.e-table-box.e-rbox-select { background-color: #BDBDBD; border: 1px solid #BDBDBD; }\n .e-table-rhelper { background-color: #4a90e2;}\n .e-rtl { direction: rtl; }\n </style>\n </head>";
|
|
17
|
+
var IFRAMEHEADER = "\n<!DOCTYPE html> \n <html>\n <head>\n <meta charset='utf-8' /> \n <style>\n @charset \"UTF-8\";\n body {\n font-family: \"Roboto\", sans-serif;\n font-size: 14px;\n }\n html, body{height: 100%;margin: 0;}\n body.e-cursor{cursor:default}\n span.e-selected-node\t{background-color: #939393;color: white;}\n span.e-selected-node.e-highlight {background-color: #1d9dd8;}\n body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}\n .e-rte-image {border: 0;cursor: pointer;display:\n block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imginline {display: inline-block;float: none;max-width: calc(100% - (2 * 5px));padding: 1px;vertical-align: bottom;}\n .e-rte-image.e-imgcenter {cursor: pointer;display: block;float: none;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imgright { float: right; margin: 0 auto;margin-left: 5px;text-align: right;}\n .e-rte-image.e-imgleft {float: left;margin: 0 auto;margin-right: 5px;text-align: left;}\n .e-img-caption { display: inline-block; float: none; margin: 5px auto; max-width: 100%;position: relative;}\n .e-img-caption.e-caption-inline {display: inline-block;float: none;\n margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));\n position: relativetext-align: center;vertical-align: bottom;}\n .e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;\n margin: auto;opacity: .9;text-align: center;width: 100%;}\n .e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}\n .e-imgleft {float: left;margin: 0 5px 0 0;text-align: left;}\n .e-imgright {float: right;margin: 0 0 0 5px;text-align: right;}\n .e-imgcenter {cursor: pointer;display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-control img:not(.e-resize) {border: 2px solid transparent; z-index: 1000}\n .e-imginline {display: inline-block;float: none;margin-left: 5px;margin-right: 5px;\n max-width: calc(100% - (2 * 5px));vertical-align: bottom;}\n .e-imgbreak {border: 0;cursor: pointer;\n display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-img-focus:not(.e-resize) {border: solid 2px #4a90e2;}\n img.e-img-focus::selection { background: transparent;color: transparent;}\n span.e-rte-imageboxmark { width: 10px; height: 10px; position: absolute; display: block;\n background: #4a90e2; border: 1px solid #fff; z-index: 1000;}\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-mob-rte span.e-rte-imageboxmark { background: #fff; border: 1px solid #4a90e2;\n border-radius: 15px; height: 20px; width: 20px; }\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-rte-content .e-content img.e-resize { z-index: 1000; }\n .e-img-caption .e-img-inner { outline: 0; }\n .e-img-caption a:focus-visible { outline: none; }\n .e-img-caption .e-rte-image.e-imgright, .e-img-caption .e-rte-image.e-imgleft { float: none; margin: 0;}\n body{box-sizing: border-box;min-height: 100px;outline: 0 solid transparent;\n overflow-x: auto;padding: 16px;position: relative;text-align: inherit;z-index: 2;}\n p{margin: 0 0 10px;margin-bottom: 10px;}\n li{margin-bottom: 10px;}\n h1{font-size: 2.17em;font-weight: 400;line-height: 1;margin: 10px 0;}\n h2{font-size: 1.74em;font-weight: 400;margin: 10px 0;}\n h3{font-size: 1.31em;font-weight: 400;margin: 10px 0;}\n h4{font-size: 16px;font-weight: 400;line-height: 1.5;margin: 0;}\n h5{font-size: 00.8em;font-weight: 400;margin: 0;}\n h6{font-size: 00.65em;font-weight: 400;margin: 0;}\n blockquote{margin: 10px 0;margin-left: 0;padding-left: 5px;border-left: solid 2px #5c5c5c;}\n pre{background-color: inherit;border: 0;border-radius: 0;color: #333;\n font-size: inherit;line-height: inherit;margin: 0 0 10px;overflow: visible;padding: 0;\n white-space: pre-wrap;word-break: inherit;word-wrap: break-word;}\n strong, b{font-weight: 700;}\n a{text-decoration: none;user-select: auto;}\n a:hover{text-decoration: underline;};\n p:last-child, pre:last-child, blockquote:last-child{margin-bottom: 0;}\n h3+h4, h4+h5, h5+h6{margin-top: 00.6em;}\n ul:last-child{margin-bottom: 0;}\n table { border-collapse: collapse; empty-cells: show;}\n table td,table th {border: 1px solid #BDBDBD; height: 20px; vertical-align: middle;}\n table.e-alternate-border tbody tr:nth-child(2n) {background-color: #F5F5F5;}\n table th {background-color: #E0E0E0;}\n table.e-dashed-border td,table.e-dashed-border th { border: 1px dashed #BDBDBD} \n table .e-cell-select {border: 1px double #4a90e2;}\n span.e-table-box { cursor: nwse-resize; display: block; height: 10px; position: absolute; width: 10px; }\n span.e-table-box.e-rmob {height: 14px;width: 14px;}\n .e-row-resize, .e-column-resize { background-color: transparent; background-repeat: repeat;\n bottom: 0;cursor: col-resize;height: 1px;overflow: visible;position: absolute;width: 1px; }\n .e-row-resize { cursor: row-resize; height: 1px;}\n .e-table-rhelper { cursor: col-resize; opacity: .87;position: absolute;}\n .e-table-rhelper.e-column-helper { width: 1px; }\n .e-table-rhelper.e-row-helper {height: 1px;}\n .e-reicon::before { border-bottom: 6px solid transparent; border-right: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block; height: 0;\n position: absolute; right: 4px; top: 4px; width: 20px; }\n .e-reicon::after { border-bottom: 6px solid transparent; border-left: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block;\n height: 0; left: 4px; position: absolute; top: 4px; width: 20px; z-index: 3; }\n .e-row-helper.e-reicon::after { top: 10px; transform: rotate(90deg); }\n .e-row-helper.e-reicon::before { left: 4px; top: -20px; transform: rotate(90deg); }\n span.e-table-box { background-color: #ffffff; border: 1px solid #BDBDBD; }\n span.e-table-box.e-rbox-select { background-color: #BDBDBD; border: 1px solid #BDBDBD; }\n .e-table-rhelper { background-color: #4a90e2;}\n .e-rtl { direction: rtl; }\n </style>\n </head>";
|
|
18
18
|
/**
|
|
19
19
|
* Content module is used to render Rich Text Editor content
|
|
20
20
|
*
|
|
@@ -1394,6 +1394,9 @@ var Image = /** @class */ (function () {
|
|
|
1394
1394
|
if (target.nodeName === 'IMG') {
|
|
1395
1395
|
this.imgEle = target;
|
|
1396
1396
|
}
|
|
1397
|
+
if (target.nodeName !== '#document') {
|
|
1398
|
+
this.parent.currentTarget = e.target;
|
|
1399
|
+
}
|
|
1397
1400
|
if (!isNullOrUndefined(this.dialogObj) && ((
|
|
1398
1401
|
// eslint-disable-next-line
|
|
1399
1402
|
!closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
|
|
@@ -1411,12 +1414,12 @@ var Image = /** @class */ (function () {
|
|
|
1411
1414
|
}
|
|
1412
1415
|
/* eslint-enable */
|
|
1413
1416
|
}
|
|
1414
|
-
if (e.target.tagName !== 'IMG' && this.imgResizeDiv && !(this.quickToolObj &&
|
|
1417
|
+
if (!(this.parent.iframeSettings.enable && this.parent.currentTarget.nodeName === 'IMG') && e.target.tagName !== 'IMG' && this.imgResizeDiv && !(this.quickToolObj &&
|
|
1415
1418
|
this.quickToolObj.imageQTBar && this.quickToolObj.imageQTBar.element.contains(e.target)) &&
|
|
1416
1419
|
this.contentModule.getEditPanel().contains(this.imgResizeDiv)) {
|
|
1417
1420
|
this.cancelResizeAction();
|
|
1418
1421
|
}
|
|
1419
|
-
if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
|
|
1422
|
+
if (this.contentModule.getEditPanel().querySelector('.e-img-resize') && !(this.parent.iframeSettings.enable && this.parent.currentTarget.nodeName === 'IMG')) {
|
|
1420
1423
|
if (target.tagName !== 'IMG') {
|
|
1421
1424
|
this.removeResizeEle();
|
|
1422
1425
|
}
|