@syncfusion/ej2-richtexteditor 25.1.37 → 25.1.39
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 +36 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +2793 -2632
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +7506 -7346
- 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 +11 -11
- package/src/editor-manager/plugin/indents.js +1 -1
- package/src/editor-manager/plugin/inserthtml.js +24 -21
- package/src/editor-manager/plugin/link.js +4 -2
- package/src/editor-manager/plugin/lists.js +49 -17
- package/src/editor-manager/plugin/nodecutter.js +3 -0
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +84 -2
- package/src/editor-manager/plugin/table.d.ts +4 -0
- package/src/editor-manager/plugin/table.js +62 -19
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +1 -0
- package/src/rich-text-editor/actions/base-quick-toolbar.js +9 -13
- package/src/rich-text-editor/actions/base-toolbar.js +3 -2
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +1 -0
- package/src/rich-text-editor/actions/dropdown-buttons.js +8 -23
- package/src/rich-text-editor/actions/emoji-picker.js +1 -1
- package/src/rich-text-editor/actions/enter-key.js +4 -1
- package/src/rich-text-editor/actions/format-painter.js +4 -1
- package/src/rich-text-editor/actions/html-editor.js +9 -7
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +2 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +18 -4
- package/src/rich-text-editor/base/rich-text-editor.js +4 -18
- package/src/rich-text-editor/base/util.d.ts +0 -4
- package/src/rich-text-editor/base/util.js +1 -35
- package/src/rich-text-editor/formatter/formatter.js +2 -1
- package/src/rich-text-editor/renderer/audio-module.js +9 -4
- package/src/rich-text-editor/renderer/image-module.js +4 -1
- package/src/rich-text-editor/renderer/table-module.js +15 -5
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -1
- package/src/rich-text-editor/renderer/toolbar-renderer.js +30 -24
- package/src/rich-text-editor/renderer/video-module.js +29 -15
- package/styles/bootstrap-dark.css +21 -7
- package/styles/bootstrap.css +14 -3
- package/styles/bootstrap4.css +11 -0
- package/styles/bootstrap5-dark.css +11 -0
- package/styles/bootstrap5.css +11 -0
- package/styles/fabric-dark.css +11 -0
- package/styles/fabric.css +11 -0
- package/styles/fluent-dark.css +28 -5
- package/styles/fluent.css +28 -5
- package/styles/highcontrast-light.css +11 -0
- package/styles/highcontrast.css +11 -0
- package/styles/material-dark.css +12 -1
- package/styles/material.css +12 -1
- package/styles/material3-dark.css +11 -0
- package/styles/material3.css +11 -0
- package/styles/rich-text-editor/_bds-definition.scss +6 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +10 -4
- package/styles/rich-text-editor/_bootstrap-definition.scss +8 -2
- package/styles/rich-text-editor/_bootstrap4-definition.scss +6 -0
- package/styles/rich-text-editor/_bootstrap5-definition.scss +6 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -0
- package/styles/rich-text-editor/_fabric-definition.scss +6 -0
- package/styles/rich-text-editor/_fluent-definition.scss +11 -5
- package/styles/rich-text-editor/_fusionnew-definition.scss +6 -0
- package/styles/rich-text-editor/_highcontrast-definition.scss +6 -0
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -0
- package/styles/rich-text-editor/_layout.scss +13 -3
- package/styles/rich-text-editor/_material-dark-definition.scss +6 -0
- package/styles/rich-text-editor/_material-definition.scss +6 -0
- package/styles/rich-text-editor/_material3-definition.scss +6 -0
- package/styles/rich-text-editor/_tailwind-definition.scss +11 -5
- package/styles/rich-text-editor/_theme.scss +21 -0
- package/styles/rich-text-editor/bootstrap-dark.css +21 -7
- package/styles/rich-text-editor/bootstrap.css +14 -3
- package/styles/rich-text-editor/bootstrap4.css +11 -0
- package/styles/rich-text-editor/bootstrap5-dark.css +11 -0
- package/styles/rich-text-editor/bootstrap5.css +11 -0
- package/styles/rich-text-editor/fabric-dark.css +11 -0
- package/styles/rich-text-editor/fabric.css +11 -0
- package/styles/rich-text-editor/fluent-dark.css +28 -5
- package/styles/rich-text-editor/fluent.css +28 -5
- package/styles/rich-text-editor/highcontrast-light.css +11 -0
- package/styles/rich-text-editor/highcontrast.css +11 -0
- package/styles/rich-text-editor/material-dark.css +12 -1
- package/styles/rich-text-editor/material.css +12 -1
- package/styles/rich-text-editor/material3-dark.css +11 -0
- package/styles/rich-text-editor/material3.css +11 -0
- package/styles/rich-text-editor/tailwind-dark.css +20 -9
- package/styles/rich-text-editor/tailwind.css +20 -9
- package/styles/tailwind-dark.css +20 -9
- package/styles/tailwind.css +20 -9
|
@@ -170,15 +170,16 @@ var BaseToolbar = /** @class */ (function () {
|
|
|
170
170
|
for (var num = 0; num < items.length; num++) {
|
|
171
171
|
var tooltipText = items[num].tooltipText;
|
|
172
172
|
var shortCutKey = void 0;
|
|
173
|
+
var isMacDev = window.navigator.platform.toLocaleLowerCase().includes('mac');
|
|
173
174
|
if (windowKeys["" + tooltipText]) {
|
|
174
|
-
shortCutKey =
|
|
175
|
+
shortCutKey = isMacDev ? windowKeys["" + tooltipText].replace('Ctrl+', '⌘').replace('Shift+', '⇧').replace('Alt+', '⌥') : windowKeys["" + tooltipText];
|
|
175
176
|
}
|
|
176
177
|
else {
|
|
177
178
|
shortCutKey = tooltipText;
|
|
178
179
|
}
|
|
179
180
|
if (shortCutKey) {
|
|
180
181
|
if (!(items[num].command === "Images" && items[num].subCommand === "InsertLink")) {
|
|
181
|
-
items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
|
|
182
|
+
items[num].tooltipText = (tooltipText !== shortCutKey) ? (isMacDev) ? shortCutKey : tooltipText + ' (' + shortCutKey + ')' : tooltipText;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
}
|
|
@@ -3,8 +3,7 @@ import { RenderType } from '../base/enum';
|
|
|
3
3
|
import { getIndex } from '../base/util';
|
|
4
4
|
import * as events from '../base/constant';
|
|
5
5
|
import * as classes from '../base/classes';
|
|
6
|
-
import { getDropDownValue, getFormattedFontSize, getTooltipText
|
|
7
|
-
import { fontNameLocale, formatsLocale, numberFormatListLocale, bulletFormatListLocale } from '../models/default-locale';
|
|
6
|
+
import { getDropDownValue, getFormattedFontSize, getTooltipText } from '../base/util';
|
|
8
7
|
import * as model from '../models/items';
|
|
9
8
|
import { dispatchEvent } from '../base/util';
|
|
10
9
|
/**
|
|
@@ -25,28 +24,10 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
25
24
|
if (item.cssClass) {
|
|
26
25
|
addClass([args.element], item.cssClass);
|
|
27
26
|
}
|
|
28
|
-
if (item.command === 'Images' || item.command === 'Videos' || item.command === 'Audios' || item.command === 'Table') {
|
|
29
|
-
args.element.setAttribute('title', getQuickToolbarTooltipText(item.text) !== '' ? getQuickToolbarTooltipText(item.text) : item.text);
|
|
30
|
-
}
|
|
31
27
|
if (item.command === 'Alignments' || item.subCommand === 'JustifyLeft'
|
|
32
28
|
|| item.subCommand === 'JustifyRight' || item.subCommand === 'JustifyCenter') {
|
|
33
29
|
args.element.setAttribute('title', getTooltipText(item.subCommand.toLocaleLowerCase(), this.locator));
|
|
34
30
|
}
|
|
35
|
-
if (item.command === 'Formats') {
|
|
36
|
-
args.element.setAttribute('title', getTooltipTextDropdownItems(item.subCommand.toLocaleLowerCase(), this.locator, formatsLocale));
|
|
37
|
-
}
|
|
38
|
-
if (item.command === 'Font') {
|
|
39
|
-
args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) : item.text);
|
|
40
|
-
}
|
|
41
|
-
if (item.subCommand === 'BulletFormatList') {
|
|
42
|
-
args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) : item.text);
|
|
43
|
-
}
|
|
44
|
-
if (item.subCommand === 'NumberFormatList') {
|
|
45
|
-
args.element.setAttribute('title', (getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale)) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale) : item.text);
|
|
46
|
-
}
|
|
47
|
-
if (item.subCommand === 'FontSize') {
|
|
48
|
-
args.element.setAttribute('title', getTooltipTextDropdownItems(item.value.toLocaleLowerCase(), null, null, this.parent));
|
|
49
|
-
}
|
|
50
31
|
};
|
|
51
32
|
DropDownButtons.prototype.dropdownContent = function (width, type, content) {
|
|
52
33
|
return ('<span style="display: inline-flex;' + 'width:' + ((type === 'quick') ? 'auto' : width) + '" >' +
|
|
@@ -352,7 +333,7 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
352
333
|
if (targetElement.classList.contains(classes.CLS_DROPDOWN_BTN)) {
|
|
353
334
|
return;
|
|
354
335
|
}
|
|
355
|
-
this.
|
|
336
|
+
this.tableCellDropDown = this.toolbarRenderer.renderDropDownButton({
|
|
356
337
|
iconCss: 'e-table-cell e-icons',
|
|
357
338
|
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_QUICK_DROPDOWN,
|
|
358
339
|
itemName: 'TableCell',
|
|
@@ -460,6 +441,10 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
460
441
|
this.removeDropDownClasses(this.tableColumnsDropDown.element);
|
|
461
442
|
this.tableColumnsDropDown.destroy();
|
|
462
443
|
}
|
|
444
|
+
if (this.tableCellDropDown) {
|
|
445
|
+
this.removeDropDownClasses(this.tableCellDropDown.element);
|
|
446
|
+
this.tableCellDropDown.destroy();
|
|
447
|
+
}
|
|
463
448
|
if (this.tableCellVerticalAlignDropDown) {
|
|
464
449
|
this.removeDropDownClasses(this.tableCellVerticalAlignDropDown.element);
|
|
465
450
|
this.tableCellVerticalAlignDropDown.destroy();
|
|
@@ -513,7 +498,7 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
513
498
|
var dropDownObj = [
|
|
514
499
|
this.formatDropDown, this.fontNameDropDown, this.fontSizeDropDown, this.alignDropDown, this.imageAlignDropDown,
|
|
515
500
|
this.displayDropDown, this.numberFormatListDropDown, this.bulletFormatListDropDown, this.tableRowsDropDown,
|
|
516
|
-
this.tableColumnsDropDown, this.tableCellVerticalAlignDropDown
|
|
501
|
+
this.tableColumnsDropDown, this.tableCellDropDown, this.tableCellVerticalAlignDropDown
|
|
517
502
|
];
|
|
518
503
|
for (var i = 0; i < dropDownObj.length; i++) {
|
|
519
504
|
this.updateCss(dropDownObj[i], e);
|
|
@@ -531,7 +516,7 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
531
516
|
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
532
517
|
};
|
|
533
518
|
DropDownButtons.prototype.onIframeMouseDown = function () {
|
|
534
|
-
if (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0) {
|
|
519
|
+
if (!isNullOrUndefined(this.parent.getToolbarElement()) && (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0 || this.parent.getToolbarElement().querySelectorAll('.e-dropdown-btn.e-rte-inline-dropdown[aria-expanded="true"]').length > 0)) {
|
|
535
520
|
dispatchEvent(document, 'mousedown');
|
|
536
521
|
}
|
|
537
522
|
};
|
|
@@ -638,7 +638,7 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':')) {
|
|
641
|
+
if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':' && value !== ': :')) {
|
|
642
642
|
noEmojiObj.innerHTML = '<span style="color: rgba(0, 0, 0, 0.75); font-weight: 500; font-size: 16px;">' + this.i10n.getConstant('emojiPickerNoResultFound') + ' 😥 </span>' + '<br>' + '<span style="color: rgba(0, 0, 0, 0.75);"> ' + this.i10n.getConstant('emojiPickerTrySomethingElse') + ' ? </span>';
|
|
643
643
|
noEmojiObj.style.margin = '55px';
|
|
644
644
|
emojipickerAll.appendChild(noEmojiObj);
|
|
@@ -47,7 +47,7 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
47
47
|
curElement = curElement.parentElement;
|
|
48
48
|
blockElement = curElement;
|
|
49
49
|
}
|
|
50
|
-
isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
50
|
+
isTableEnter = blockElement.tagName === 'TH' || blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
51
51
|
}
|
|
52
52
|
if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
|
|
53
53
|
if (isNOU(this.startNode.closest('LI, UL, OL')) && isNOU(this.endNode.closest('LI, UL, OL')) &&
|
|
@@ -62,6 +62,9 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
62
62
|
};
|
|
63
63
|
this.parent.trigger(events.actionBegin, actionBeginArgs, function (actionBeginArgs) {
|
|
64
64
|
if (!actionBeginArgs.cancel) {
|
|
65
|
+
if (_this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
66
|
+
_this.parent.formatter.saveData();
|
|
67
|
+
}
|
|
65
68
|
if (!(_this.range.startOffset === _this.range.endOffset && _this.range.startContainer === _this.range.endContainer)) {
|
|
66
69
|
if (!(_this.range.startContainer.nodeName === 'SPAN' && (_this.range.startContainer.classList.contains('e-video-wrap') ||
|
|
67
70
|
_this.range.startContainer.classList.contains('e-audio-wrap')))) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass, isNullOrUndefined as isNOU, removeClass } from '@syncfusion/ej2-base';
|
|
1
|
+
import { addClass, Browser, isNullOrUndefined as isNOU, removeClass } from '@syncfusion/ej2-base';
|
|
2
2
|
import * as events from '../base/constant';
|
|
3
3
|
var FormatPainter = /** @class */ (function () {
|
|
4
4
|
function FormatPainter(parent) {
|
|
@@ -43,6 +43,9 @@ var FormatPainter = /** @class */ (function () {
|
|
|
43
43
|
if ((originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste')) {
|
|
44
44
|
originalEvent.stopPropagation();
|
|
45
45
|
}
|
|
46
|
+
if (Browser.userAgent.indexOf('Firefox') !== -1) {
|
|
47
|
+
originalEvent.preventDefault();
|
|
48
|
+
}
|
|
46
49
|
this.actionHandler(event, 'keyBoard');
|
|
47
50
|
}
|
|
48
51
|
};
|
|
@@ -90,9 +90,6 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
90
90
|
};
|
|
91
91
|
HtmlEditor.prototype.onSelectionRestore = function (e) {
|
|
92
92
|
this.parent.isBlur = false;
|
|
93
|
-
if (isNOU(this.saveSelection) || isNOU(closest(this.saveSelection.range.startContainer.parentElement, ".e-img-caption")) ? true : !(closest(this.saveSelection.range.startContainer.parentElement, ".e-img-caption").getAttribute("contenteditable") == "false")) {
|
|
94
|
-
this.contentRenderer.getEditPanel().focus();
|
|
95
|
-
}
|
|
96
93
|
if (isNullOrUndefined(e.items) || e.items) {
|
|
97
94
|
this.saveSelection.restore();
|
|
98
95
|
}
|
|
@@ -454,12 +451,17 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
454
451
|
}
|
|
455
452
|
var lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
|
|
456
453
|
while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
|
|
457
|
-
lastNode.nodeName !== 'BR') {
|
|
454
|
+
lastNode.nodeName !== 'BR' && !isNOU(lastNode.lastChild)) {
|
|
458
455
|
lastNode = lastNode.lastChild;
|
|
459
456
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
457
|
+
if (lastNode.nodeName === 'IMG') {
|
|
458
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastNode.parentElement, lastNode.parentElement.childNodes.length);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
|
|
462
|
+
// eslint-disable-next-line
|
|
463
|
+
lastNode, lastNode.textContent.length);
|
|
464
|
+
}
|
|
463
465
|
if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
464
466
|
detach(this.oldRangeElement.querySelector('BR'));
|
|
465
467
|
}
|
|
@@ -22,6 +22,7 @@ export declare class QuickToolbar {
|
|
|
22
22
|
videoQTBar: BaseQuickToolbar;
|
|
23
23
|
tableQTBar: BaseQuickToolbar;
|
|
24
24
|
inlineQTBar: BaseQuickToolbar;
|
|
25
|
+
debounceTimeout: number;
|
|
25
26
|
private renderFactory;
|
|
26
27
|
constructor(parent?: IRichTextEditor, locator?: ServiceLocator);
|
|
27
28
|
private formatItems;
|
|
@@ -72,6 +73,7 @@ export declare class QuickToolbar {
|
|
|
72
73
|
hideQuickToolbars(): void;
|
|
73
74
|
private deBounce;
|
|
74
75
|
private mouseUpHandler;
|
|
76
|
+
private isEmbedVidElem;
|
|
75
77
|
private keyDownHandler;
|
|
76
78
|
private inlineQTBarMouseDownHandler;
|
|
77
79
|
private keyUpHandler;
|
|
@@ -4,12 +4,13 @@ import * as events from '../base/constant';
|
|
|
4
4
|
import { pageYOffset, hasClass, isIDevice } from '../base/util';
|
|
5
5
|
import { BaseQuickToolbar } from './base-quick-toolbar';
|
|
6
6
|
import { PopupRenderer } from '../renderer/popup-renderer';
|
|
7
|
-
import { CLS_INLINE_POP, CLS_INLINE } from '../base/classes';
|
|
7
|
+
import { CLS_INLINE_POP, CLS_INLINE, CLS_VID_CLICK_ELEM } from '../base/classes';
|
|
8
8
|
/**
|
|
9
9
|
* `Quick toolbar` module is used to handle Quick toolbar actions.
|
|
10
10
|
*/
|
|
11
11
|
var QuickToolbar = /** @class */ (function () {
|
|
12
12
|
function QuickToolbar(parent, locator) {
|
|
13
|
+
this.debounceTimeout = 1000;
|
|
13
14
|
this.parent = parent;
|
|
14
15
|
this.locator = locator;
|
|
15
16
|
this.renderFactory = this.locator.getService('rendererFactory');
|
|
@@ -201,7 +202,7 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
201
202
|
clearTimeout(this.deBouncer);
|
|
202
203
|
this.deBouncer = window.setTimeout(function () {
|
|
203
204
|
_this.showInlineQTBar(x, y, target);
|
|
204
|
-
},
|
|
205
|
+
}, this.debounceTimeout);
|
|
205
206
|
};
|
|
206
207
|
QuickToolbar.prototype.mouseUpHandler = function (e) {
|
|
207
208
|
if (this.parent.inlineMode.enable && (!Browser.isDevice || isIDevice())) {
|
|
@@ -251,7 +252,7 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
251
252
|
this.offsetY = pageYOffset(args, this.parent.element, this.parent.iframeSettings.enable);
|
|
252
253
|
var range = this.parent.getRange();
|
|
253
254
|
if ((range.endContainer.parentElement.tagName === range.startContainer.parentElement.tagName && (range.startContainer.parentElement.tagName === 'A' && range.endContainer.parentElement.tagName === 'A')) ||
|
|
254
|
-
(target.tagName === 'IMG') || (target.tagName === 'VIDEO') || (target.tagName === 'AUDIO') || (target.childNodes[0] && target.childNodes[0].nodeType === 1 && target.childNodes[0].classList.contains('e-rte-audio')) ||
|
|
255
|
+
(target.tagName === 'IMG') || (target.tagName === 'VIDEO' || this.isEmbedVidElem(target)) || (target.tagName === 'AUDIO') || (target.childNodes[0] && target.childNodes[0].nodeType === 1 && target.childNodes[0].classList.contains('e-rte-audio')) ||
|
|
255
256
|
(this.parent.getRange().startOffset === this.parent.getRange().endOffset)) {
|
|
256
257
|
return;
|
|
257
258
|
}
|
|
@@ -259,8 +260,21 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
259
260
|
this.textQTBar.showPopup(this.offsetX, this.offsetY, target, 'text');
|
|
260
261
|
}
|
|
261
262
|
};
|
|
263
|
+
QuickToolbar.prototype.isEmbedVidElem = function (target) {
|
|
264
|
+
if ((target && target.nodeType !== 3 && target.nodeName !== 'BR' && (target.classList && target.classList.contains(CLS_VID_CLICK_ELEM))) ||
|
|
265
|
+
(target && target.nodeName === 'IFRAME')) {
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
262
272
|
QuickToolbar.prototype.keyDownHandler = function (e) {
|
|
263
273
|
var preventHide = e.args.altKey;
|
|
274
|
+
if (this.parent.inlineMode.enable && e.args.metaKey && e.args.keyCode === 65) {
|
|
275
|
+
this.showInlineQTBar(this.offsetX, this.offsetY, e.args.target);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
264
278
|
if (!preventHide) {
|
|
265
279
|
if ((this.parent.inlineMode.enable && (!Browser.isDevice || isIDevice()))
|
|
266
280
|
&& !isNullOrUndefined(select('.' + CLS_INLINE_POP, document))) {
|
|
@@ -310,7 +324,7 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
310
324
|
clearTimeout(this.deBouncer);
|
|
311
325
|
this.deBouncer = window.setTimeout(function () {
|
|
312
326
|
_this.onSelectionChange(e);
|
|
313
|
-
},
|
|
327
|
+
}, this.debounceTimeout);
|
|
314
328
|
};
|
|
315
329
|
QuickToolbar.prototype.onSelectionChange = function (e) {
|
|
316
330
|
if (!isNullOrUndefined(select('.' + CLS_INLINE_POP, document.body))) {
|
|
@@ -755,8 +755,8 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
755
755
|
!(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which == 67))) {
|
|
756
756
|
this.formatter.saveData();
|
|
757
757
|
}
|
|
758
|
-
|
|
759
|
-
|
|
758
|
+
var keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
|
|
759
|
+
if (keyboardEventAction.indexOf(e.action) === -1 &&
|
|
760
760
|
(!e.target || !(e.target.classList.contains('e-mention') && !isNOU(document.querySelector('#' + e.target.id + '_popup.e-popup-open')) && e.code === 'Tab')) &&
|
|
761
761
|
(e.action && e.action !== 'paste' && e.action !== 'space'
|
|
762
762
|
|| e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
|
|
@@ -2412,12 +2412,9 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
2412
2412
|
|
|
2413
2413
|
*/
|
|
2414
2414
|
RichTextEditor.prototype.autoResize = function () {
|
|
2415
|
-
var _this = this;
|
|
2416
2415
|
if (this.height === 'auto') {
|
|
2417
2416
|
if (this.editorMode === 'Markdown') {
|
|
2418
|
-
|
|
2419
|
-
_this.setAutoHeight(_this.inputElement);
|
|
2420
|
-
}, 0);
|
|
2417
|
+
this.setAutoHeight(this.inputElement);
|
|
2421
2418
|
}
|
|
2422
2419
|
else if (this.iframeSettings.enable) {
|
|
2423
2420
|
var iframeElement = this.element.querySelector('#' + this.getID() + '_rte-view');
|
|
@@ -2430,21 +2427,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
2430
2427
|
}
|
|
2431
2428
|
};
|
|
2432
2429
|
RichTextEditor.prototype.setAutoHeight = function (element) {
|
|
2433
|
-
if (!isNOU(element)
|
|
2430
|
+
if (!isNOU(element)) {
|
|
2434
2431
|
element.style.height = this.inputElement.scrollHeight + 'px';
|
|
2435
2432
|
element.style.overflow = 'hidden';
|
|
2436
2433
|
}
|
|
2437
|
-
else if (!isNOU(element) && !isNOU(element.parentElement) && this.iframeSettings.enable) {
|
|
2438
|
-
var newRange = this.getRange();
|
|
2439
|
-
element.style.height = 'auto';
|
|
2440
|
-
var newHeight = element.contentDocument.body.scrollHeight + 'px';
|
|
2441
|
-
element.style.height = newHeight;
|
|
2442
|
-
element.style.overflow = 'hidden';
|
|
2443
|
-
// 16 px added for padding doesn't affect the editor height
|
|
2444
|
-
if (newRange.startContainer.nodeName !== '#text' && newRange.startContainer.nodeName !== 'BODY' && window.innerHeight < newRange.startContainer.getBoundingClientRect().top + element.getBoundingClientRect().top + 16) {
|
|
2445
|
-
newRange.startContainer.scrollIntoView(false);
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
2434
|
};
|
|
2449
2435
|
RichTextEditor.prototype.wireEvents = function () {
|
|
2450
2436
|
this.element.addEventListener('focusin', this.onFocusHandler, true);
|
|
@@ -51,10 +51,6 @@ export declare function pageYOffset(e: MouseEvent | Touch, parentElement: HTMLEl
|
|
|
51
51
|
* @hidden
|
|
52
52
|
*/
|
|
53
53
|
export declare function getTooltipText(item: string, serviceLocator: ServiceLocator): string;
|
|
54
|
-
export declare function getTooltipTextDropdownItems(item: string, serviceLocator: ServiceLocator, localeItems: {
|
|
55
|
-
[ket: string]: string;
|
|
56
|
-
}[], rteObj?: IRichTextEditor): string;
|
|
57
|
-
export declare function getQuickToolbarTooltipText(item: string): string;
|
|
58
54
|
/**
|
|
59
55
|
* @param {ISetToolbarStatusArgs} e - specifies the e element
|
|
60
56
|
* @param {boolean} isPopToolbar - specifies the boolean value
|
|
@@ -6,7 +6,7 @@ import { Browser, detach, SanitizeHtmlHelper, extend } from '@syncfusion/ej2-bas
|
|
|
6
6
|
import * as classes from '../base/classes';
|
|
7
7
|
import * as CONSTANT from '../base/constant';
|
|
8
8
|
import * as model from '../models/items';
|
|
9
|
-
import { toolsLocale, fontNameLocale, formatsLocale, numberFormatListLocale, bulletFormatListLocale
|
|
9
|
+
import { toolsLocale, fontNameLocale, formatsLocale, numberFormatListLocale, bulletFormatListLocale } from '../models/default-locale';
|
|
10
10
|
var undoRedoItems = ['Undo', 'Redo'];
|
|
11
11
|
var inlineNode = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
12
12
|
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
@@ -134,40 +134,6 @@ export function getTooltipText(item, serviceLocator) {
|
|
|
134
134
|
var tooltipText = i10n.getConstant(itemLocale);
|
|
135
135
|
return tooltipText;
|
|
136
136
|
}
|
|
137
|
-
export function getTooltipTextDropdownItems(item, serviceLocator, localeItems, rteObj) {
|
|
138
|
-
if (localeItems) {
|
|
139
|
-
var i10n = serviceLocator.getService('rteLocale');
|
|
140
|
-
for (var i = 0; i < localeItems.length; i++) {
|
|
141
|
-
var itemLocale = localeItems[i].value.toLocaleLowerCase();
|
|
142
|
-
var numberValue = localeItems[i].locale;
|
|
143
|
-
var numberLocale = defaultLocale["" + numberValue].toLocaleLowerCase();
|
|
144
|
-
if (item === itemLocale || item === numberLocale) {
|
|
145
|
-
var tooltipText = localeItems[i].locale;
|
|
146
|
-
return i10n.getConstant(tooltipText);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
var fontsize = rteObj.fontSize.items;
|
|
152
|
-
for (var i = 0; i < fontsize.length; i++) {
|
|
153
|
-
if (item === rteObj.fontSize.items[i].value) {
|
|
154
|
-
var fontSize = rteObj.fontSize.items[i].text;
|
|
155
|
-
return fontSize;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return '';
|
|
160
|
-
}
|
|
161
|
-
export function getQuickToolbarTooltipText(item) {
|
|
162
|
-
var keys = Object.keys(defaultLocale);
|
|
163
|
-
for (var i = 0; i < keys.length; i++) {
|
|
164
|
-
var tooltipText = defaultLocale["" + keys[i]];
|
|
165
|
-
if (item === tooltipText) {
|
|
166
|
-
return tooltipText;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return '';
|
|
170
|
-
}
|
|
171
137
|
/**
|
|
172
138
|
* @param {ISetToolbarStatusArgs} e - specifies the e element
|
|
173
139
|
* @param {boolean} isPopToolbar - specifies the boolean value
|
|
@@ -133,7 +133,8 @@ var Formatter = /** @class */ (function () {
|
|
|
133
133
|
_this.saveData();
|
|
134
134
|
}
|
|
135
135
|
self.isBlur = false;
|
|
136
|
-
|
|
136
|
+
var quickToolbarAction = !isNOU(event) && !isNOU(event.target) && (!isNOU(closest(event.target, ".e-rte-elements.e-dropdown-popup.e-rte-dropdown-popup.e-quick-dropdown.e-popup-open")) || !isNOU(closest(event.target, ".e-rte-elements.e-rte-quick-popup.e-popup-open")));
|
|
137
|
+
if (isNOU(saveSelection) || (!quickToolbarAction && (isNOU(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption")) ? true : !(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption").getAttribute("contenteditable") == "false")))) {
|
|
137
138
|
self.contentModule.getEditPanel().focus();
|
|
138
139
|
}
|
|
139
140
|
if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
|
|
@@ -39,6 +39,7 @@ var Audio = /** @class */ (function () {
|
|
|
39
39
|
this.parent.on(events.editAreaClick, this.editAreaClickHandler, this);
|
|
40
40
|
this.parent.on(events.insertCompleted, this.showAudioQuickToolbar, this);
|
|
41
41
|
this.parent.on(events.destroy, this.removeEventListener, this);
|
|
42
|
+
this.parent.on(events.iframeMouseDown, this.closeDialog, this);
|
|
42
43
|
};
|
|
43
44
|
Audio.prototype.removeEventListener = function () {
|
|
44
45
|
if (this.parent.isDestroyed) {
|
|
@@ -57,6 +58,7 @@ var Audio = /** @class */ (function () {
|
|
|
57
58
|
this.parent.off(events.editAreaClick, this.editAreaClickHandler);
|
|
58
59
|
this.parent.off(events.insertCompleted, this.showAudioQuickToolbar);
|
|
59
60
|
this.parent.off(events.destroy, this.removeEventListener);
|
|
61
|
+
this.parent.off(events.iframeMouseDown, this.closeDialog);
|
|
60
62
|
if (!isNullOrUndefined(this.contentModule)) {
|
|
61
63
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
|
|
62
64
|
EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
|
|
@@ -305,7 +307,7 @@ var Audio = /** @class */ (function () {
|
|
|
305
307
|
this.parent.formatter.saveData();
|
|
306
308
|
}
|
|
307
309
|
e.selection.restore();
|
|
308
|
-
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
310
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
|
|
309
311
|
selectNode: e.selectNode,
|
|
310
312
|
subCommand: e.args.item.subCommand
|
|
311
313
|
});
|
|
@@ -401,6 +403,9 @@ var Audio = /** @class */ (function () {
|
|
|
401
403
|
this.prevSelectedAudEle.style.outline = '';
|
|
402
404
|
}
|
|
403
405
|
}
|
|
406
|
+
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
407
|
+
this.dialogObj.hide();
|
|
408
|
+
}
|
|
404
409
|
};
|
|
405
410
|
Audio.prototype.alignmentSelect = function (e) {
|
|
406
411
|
var item = e.item;
|
|
@@ -433,7 +438,7 @@ var Audio = /** @class */ (function () {
|
|
|
433
438
|
}
|
|
434
439
|
var subCommand = (e.args.item) ?
|
|
435
440
|
e.args.item.subCommand : 'Break';
|
|
436
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
441
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
437
442
|
};
|
|
438
443
|
Audio.prototype.inline = function (e) {
|
|
439
444
|
if (e.selectNode[0].nodeName !== 'AUDIO') {
|
|
@@ -441,7 +446,7 @@ var Audio = /** @class */ (function () {
|
|
|
441
446
|
}
|
|
442
447
|
var subCommand = (e.args.item) ?
|
|
443
448
|
e.args.item.subCommand : 'Inline';
|
|
444
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
449
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
445
450
|
};
|
|
446
451
|
Audio.prototype.editAreaClickHandler = function (e) {
|
|
447
452
|
if (this.parent.readonly) {
|
|
@@ -581,7 +586,7 @@ var Audio = /** @class */ (function () {
|
|
|
581
586
|
_this.uploadObj.removing();
|
|
582
587
|
}
|
|
583
588
|
_this.parent.isBlur = false;
|
|
584
|
-
if (event && event.event.returnValue) {
|
|
589
|
+
if (event && !isNOU(event.event) && event.event.returnValue) {
|
|
585
590
|
if (_this.parent.editorMode === 'HTML') {
|
|
586
591
|
selection.restore();
|
|
587
592
|
}
|
|
@@ -1399,7 +1399,7 @@ var Image = /** @class */ (function () {
|
|
|
1399
1399
|
_this.uploadObj.remove();
|
|
1400
1400
|
}
|
|
1401
1401
|
_this.parent.isBlur = false;
|
|
1402
|
-
if (event && event.event.returnValue) {
|
|
1402
|
+
if (event && !isNOU(event.event) && event.event.returnValue) {
|
|
1403
1403
|
if (_this.parent.editorMode === 'HTML') {
|
|
1404
1404
|
selection.restore();
|
|
1405
1405
|
}
|
|
@@ -1518,6 +1518,9 @@ var Image = /** @class */ (function () {
|
|
|
1518
1518
|
removeClass([items[i]], 'e-resize');
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
|
+
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
1522
|
+
this.dialogObj.hide();
|
|
1523
|
+
}
|
|
1521
1524
|
};
|
|
1522
1525
|
Image.prototype.removeResizeEle = function () {
|
|
1523
1526
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
@@ -643,13 +643,14 @@ var Table = /** @class */ (function () {
|
|
|
643
643
|
}
|
|
644
644
|
var target = e.target || e.targetTouches[0].target;
|
|
645
645
|
var closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
|
|
646
|
-
|
|
646
|
+
var isResizing = this.parent.contentModule.getEditPanel().querySelectorAll('.e-table-box.e-rbox-select, .e-table-rhelper.e-column-helper, .e-table-rhelper.e-row-helper').length > 0;
|
|
647
|
+
if (!isResizing && !isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable &&
|
|
647
648
|
this.parent.contentModule.getEditPanel().contains(closestTable)) {
|
|
648
649
|
this.removeResizeElement();
|
|
649
650
|
this.removeHelper(e);
|
|
650
651
|
this.cancelResizeAction();
|
|
651
652
|
}
|
|
652
|
-
if (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH') {
|
|
653
|
+
if (!isResizing && (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH')) {
|
|
653
654
|
this.curTable = (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable))
|
|
654
655
|
&& (target.nodeName === 'TD' || target.nodeName === 'TH') ?
|
|
655
656
|
closestTable : target;
|
|
@@ -795,7 +796,6 @@ var Table = /** @class */ (function () {
|
|
|
795
796
|
e.preventDefault();
|
|
796
797
|
this.parent.preventDefaultResize(e);
|
|
797
798
|
removeClass(this.curTable.querySelectorAll('td,th'), classes.CLS_TABLE_SEL);
|
|
798
|
-
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
799
799
|
this.pageX = this.getPointX(e);
|
|
800
800
|
this.pageY = this.getPointY(e);
|
|
801
801
|
this.resizeBtnInit();
|
|
@@ -1055,7 +1055,8 @@ var Table = /** @class */ (function () {
|
|
|
1055
1055
|
var width = parseFloat(_this.curTable.style.width);
|
|
1056
1056
|
currentMarginLeft = 100 - width;
|
|
1057
1057
|
}
|
|
1058
|
-
|
|
1058
|
+
// For table pasted from word, Margin left can be anything so we are avoiding the below process.
|
|
1059
|
+
if (!_this.curTable.classList.contains('e-rte-paste-table') && currentMarginLeft && currentMarginLeft < 1) {
|
|
1059
1060
|
_this.curTable.style.marginLeft = null;
|
|
1060
1061
|
_this.curTable.style.width = '100%';
|
|
1061
1062
|
return;
|
|
@@ -1221,7 +1222,13 @@ var Table = /** @class */ (function () {
|
|
|
1221
1222
|
tableTrPercentage[i] = percentage;
|
|
1222
1223
|
}
|
|
1223
1224
|
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1224
|
-
currentTableTrElement[i].
|
|
1225
|
+
if (currentTableTrElement[i].parentElement.nodeName === 'THEAD') {
|
|
1226
|
+
currentTableTrElement[i].parentElement.style.height = tableTrPercentage[i] + '%';
|
|
1227
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
1231
|
+
}
|
|
1225
1232
|
}
|
|
1226
1233
|
var args = { event: e, requestType: 'table' };
|
|
1227
1234
|
this.parent.trigger(events.resizeStop, args);
|
|
@@ -1371,6 +1378,9 @@ var Table = /** @class */ (function () {
|
|
|
1371
1378
|
if (this.popupObj) {
|
|
1372
1379
|
this.popupObj.hide();
|
|
1373
1380
|
}
|
|
1381
|
+
if (this.parent.inlineMode.enable && this.editdlgObj) {
|
|
1382
|
+
this.editdlgObj.hide();
|
|
1383
|
+
}
|
|
1374
1384
|
};
|
|
1375
1385
|
Table.prototype.docClick = function (e) {
|
|
1376
1386
|
var target = e.args.target;
|