@syncfusion/ej2-richtexteditor 26.2.7 → 26.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +72 -21
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +72 -22
- 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 +8 -8
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +25 -12
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +15 -1
- package/src/editor-manager/plugin/selection-commands.js +6 -0
- package/src/rich-text-editor/actions/html-editor.js +11 -2
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -0
- package/src/rich-text-editor/base/rich-text-editor.js +11 -7
- package/src/rich-text-editor/renderer/audio-module.js +1 -0
- package/src/rich-text-editor/renderer/image-module.js +1 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -0
- package/src/rich-text-editor/renderer/video-module.js +1 -0
- package/styles/fluent2.css +5 -1033
- package/styles/material3-dark.css +1 -54
- package/styles/material3.css +3 -110
- package/styles/rich-text-editor/fluent2.css +5 -1033
- package/styles/rich-text-editor/material3-dark.css +1 -54
- package/styles/rich-text-editor/material3.css +3 -110
|
@@ -5439,6 +5439,7 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
|
|
|
5439
5439
|
openDelay: 400,
|
|
5440
5440
|
opensOn: 'Hover',
|
|
5441
5441
|
beforeRender: this.tooltipBeforeRender.bind(this),
|
|
5442
|
+
beforeOpen: this.tooltipBeforeOpen.bind(this),
|
|
5442
5443
|
cssClass: this.parent.getCssClass(),
|
|
5443
5444
|
windowCollision: true,
|
|
5444
5445
|
position: 'BottomCenter'
|
|
@@ -6822,6 +6823,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
|
|
|
6822
6823
|
if (this.parent.insertImageSettings.resize) {
|
|
6823
6824
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
|
|
6824
6825
|
this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
|
|
6826
|
+
this.docClick = null;
|
|
6825
6827
|
EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
|
|
6826
6828
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
6827
6829
|
}
|
|
@@ -9188,6 +9190,7 @@ var Audio = /** @__PURE__ @class */ (function () {
|
|
|
9188
9190
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
|
|
9189
9191
|
EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
|
|
9190
9192
|
this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
|
|
9193
|
+
this.docClick = null;
|
|
9191
9194
|
}
|
|
9192
9195
|
};
|
|
9193
9196
|
Audio.prototype.afterRender = function () {
|
|
@@ -10090,6 +10093,7 @@ var Video = /** @__PURE__ @class */ (function () {
|
|
|
10090
10093
|
if (this.parent.insertVideoSettings.resize) {
|
|
10091
10094
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
|
|
10092
10095
|
this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
|
|
10096
|
+
this.docClick = null;
|
|
10093
10097
|
EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
|
|
10094
10098
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
10095
10099
|
}
|
|
@@ -21994,7 +21998,9 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
21994
21998
|
&& (!isNullOrUndefined(closest(startNode, 'ul')) || !isNullOrUndefined(closest(startNode, 'ol')))
|
|
21995
21999
|
&& (!isNullOrUndefined(closest(endNode, 'ul')) || !isNullOrUndefined(closest(endNode, 'ol')))
|
|
21996
22000
|
&& ((commonAncestor.lastElementChild === closest(endNode, 'li') && commonAncestor.lastChild !== endNode)) && !range.collapsed) {
|
|
21997
|
-
|
|
22001
|
+
if (this.areAllListItemsSelected(commonAncestor, range)) {
|
|
22002
|
+
detach(commonAncestor);
|
|
22003
|
+
}
|
|
21998
22004
|
}
|
|
21999
22005
|
this.removeList(range, e);
|
|
22000
22006
|
}
|
|
@@ -22665,6 +22671,18 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
22665
22671
|
this.domNode = null;
|
|
22666
22672
|
}
|
|
22667
22673
|
};
|
|
22674
|
+
Lists.prototype.areAllListItemsSelected = function (list, range) {
|
|
22675
|
+
var listItems = list.querySelectorAll('li');
|
|
22676
|
+
for (var i = 0; i < listItems.length; i++) {
|
|
22677
|
+
var listItem = listItems[i];
|
|
22678
|
+
var listItemRange = this.parent.currentDocument.createRange();
|
|
22679
|
+
listItemRange.selectNodeContents(listItem);
|
|
22680
|
+
if (!range.intersectsNode(listItem)) {
|
|
22681
|
+
return false;
|
|
22682
|
+
}
|
|
22683
|
+
}
|
|
22684
|
+
return true;
|
|
22685
|
+
};
|
|
22668
22686
|
return Lists;
|
|
22669
22687
|
}());
|
|
22670
22688
|
|
|
@@ -23667,7 +23685,6 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
23667
23685
|
return null;
|
|
23668
23686
|
};
|
|
23669
23687
|
InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
|
|
23670
|
-
var _this = this;
|
|
23671
23688
|
var isCursor = range.startOffset === range.endOffset &&
|
|
23672
23689
|
range.startContainer === range.endContainer;
|
|
23673
23690
|
if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
|
|
@@ -23746,6 +23763,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
23746
23763
|
var rangeElement = closest(nearestAnchor, 'span');
|
|
23747
23764
|
rangeElement.appendChild(tempSpan);
|
|
23748
23765
|
}
|
|
23766
|
+
else if (nodes[0].nodeName === '#text' && nodes[0].nodeValue.includes('\u200B') && !isNullOrUndefined(nodes[0].parentElement) && !isNullOrUndefined(nodes[0].parentElement.previousElementSibling) && nodes[0].parentElement.previousElementSibling.classList.contains('e-mention-chip')) {
|
|
23767
|
+
range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
|
|
23768
|
+
}
|
|
23749
23769
|
else {
|
|
23750
23770
|
range.insertNode(tempSpan);
|
|
23751
23771
|
}
|
|
@@ -23834,17 +23854,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
23834
23854
|
else {
|
|
23835
23855
|
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
23836
23856
|
}
|
|
23837
|
-
|
|
23838
|
-
if (spanAligns.length > 0) {
|
|
23839
|
-
spanAligns.forEach(function (spanAlign) {
|
|
23840
|
-
if (!isNullOrUndefined(spanAlign)) {
|
|
23841
|
-
var blockAlign = _this.getImmediateBlockNode(spanAlign, null);
|
|
23842
|
-
if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
|
|
23843
|
-
blockAlign.style.textAlign = spanAlign.style.textAlign;
|
|
23844
|
-
}
|
|
23845
|
-
}
|
|
23846
|
-
});
|
|
23847
|
-
}
|
|
23857
|
+
this.alignCheck(editNode);
|
|
23848
23858
|
};
|
|
23849
23859
|
InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
23850
23860
|
lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
|
|
@@ -24084,6 +24094,27 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24084
24094
|
}
|
|
24085
24095
|
insertNode.classList.add('ignore-table');
|
|
24086
24096
|
};
|
|
24097
|
+
InsertHtml.alignCheck = function (editNode) {
|
|
24098
|
+
var spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
|
|
24099
|
+
for (var i = 0; i < spanAligns.length; i++) {
|
|
24100
|
+
var spanAlign = spanAligns[i];
|
|
24101
|
+
if (spanAlign) {
|
|
24102
|
+
var blockAlign = this.getImmediateBlockNode(spanAlign, null);
|
|
24103
|
+
if (blockAlign) {
|
|
24104
|
+
var totalSpanText = '';
|
|
24105
|
+
for (var j = 0; j < spanAligns.length; j++) {
|
|
24106
|
+
var span = spanAligns[j];
|
|
24107
|
+
if (blockAlign.contains(span)) {
|
|
24108
|
+
totalSpanText += span.textContent;
|
|
24109
|
+
}
|
|
24110
|
+
}
|
|
24111
|
+
if (blockAlign.textContent.trim() === totalSpanText.trim()) {
|
|
24112
|
+
blockAlign.style.textAlign = spanAlign.style.textAlign;
|
|
24113
|
+
}
|
|
24114
|
+
}
|
|
24115
|
+
}
|
|
24116
|
+
}
|
|
24117
|
+
};
|
|
24087
24118
|
/**
|
|
24088
24119
|
* Insert method
|
|
24089
24120
|
*
|
|
@@ -26834,6 +26865,12 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
|
|
|
26834
26865
|
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNullOrUndefined(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
|
|
26835
26866
|
detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
|
|
26836
26867
|
}
|
|
26868
|
+
if (!isNullOrUndefined(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
26869
|
+
indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
|
|
26870
|
+
var element = this.GetFormatNode(format, value);
|
|
26871
|
+
this.applyStyles(cursorNodes, 0, element);
|
|
26872
|
+
return cursorNodes[0];
|
|
26873
|
+
}
|
|
26837
26874
|
cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
|
|
26838
26875
|
}
|
|
26839
26876
|
return cursorNode;
|
|
@@ -30904,7 +30941,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
30904
30941
|
};
|
|
30905
30942
|
HtmlEditor.prototype.onKeyUp = function (e) {
|
|
30906
30943
|
var args = e.args;
|
|
30907
|
-
var restrictKeys = [8, 9, 13,
|
|
30944
|
+
var restrictKeys = [8, 9, 13, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
|
|
30908
30945
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
|
|
30909
30946
|
var range = this.parent.getRange();
|
|
30910
30947
|
var regEx = new RegExp('\u200B', 'g');
|
|
@@ -30912,9 +30949,18 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
30912
30949
|
range.startOffset === 1 && range.startContainer.textContent.length === 1 &&
|
|
30913
30950
|
range.startContainer.textContent.charCodeAt(0) === 8203 &&
|
|
30914
30951
|
range.startContainer.textContent.replace(regEx, '').length === 0;
|
|
30952
|
+
var isMention = false;
|
|
30953
|
+
if (range.startContainer === range.endContainer &&
|
|
30954
|
+
range.startOffset === range.endOffset && (range.startContainer !== this.parent.inputElement && range.startOffset !== 0)) {
|
|
30955
|
+
var mentionStartNode = range.startContainer.nodeType === 3 ?
|
|
30956
|
+
range.startContainer : range.startContainer.childNodes[range.startOffset - 1];
|
|
30957
|
+
isMention = args.keyCode === 16 &&
|
|
30958
|
+
mentionStartNode.textContent.charCodeAt(0) === 8203 &&
|
|
30959
|
+
!isNullOrUndefined(mentionStartNode.previousSibling) && mentionStartNode.previousSibling.contentEditable === 'false';
|
|
30960
|
+
}
|
|
30915
30961
|
var pointer;
|
|
30916
30962
|
var isRootParent = false;
|
|
30917
|
-
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
|
|
30963
|
+
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode && !isMention) {
|
|
30918
30964
|
pointer = range.startOffset;
|
|
30919
30965
|
var container = range.startContainer;
|
|
30920
30966
|
// Check if the container is a text node and contains a zero-width space
|
|
@@ -36291,8 +36337,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
36291
36337
|
*/
|
|
36292
36338
|
RichTextEditor.prototype.preRender = function () {
|
|
36293
36339
|
this.initializeValue();
|
|
36294
|
-
this.onBlurHandler = this.blurHandler.bind(this);
|
|
36295
|
-
this.onFocusHandler = this.focusHandler.bind(this);
|
|
36296
36340
|
this.clickPoints = { clientX: 0, clientY: 0 };
|
|
36297
36341
|
this.initialValue = this.value;
|
|
36298
36342
|
this.serviceLocator = new ServiceLocator;
|
|
@@ -36932,7 +36976,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
36932
36976
|
this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
|
|
36933
36977
|
this.isSelectAll = false;
|
|
36934
36978
|
}
|
|
36935
|
-
if (selection.rangeCount > 0) {
|
|
36979
|
+
if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement) && range.startContainer.innerHTML === '<br>' && range.startContainer.textContent === '') {
|
|
36936
36980
|
selection.removeAllRanges();
|
|
36937
36981
|
selection.addRange(currentRange);
|
|
36938
36982
|
}
|
|
@@ -37195,6 +37239,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
37195
37239
|
clearInterval(this.timeInterval);
|
|
37196
37240
|
this.timeInterval = null;
|
|
37197
37241
|
}
|
|
37242
|
+
if (!isNullOrUndefined(this.autoSaveTimeOut)) {
|
|
37243
|
+
clearTimeout(this.autoSaveTimeOut);
|
|
37244
|
+
this.autoSaveTimeOut = null;
|
|
37245
|
+
}
|
|
37198
37246
|
if (!isNullOrUndefined(this.idleInterval)) {
|
|
37199
37247
|
clearTimeout(this.idleInterval);
|
|
37200
37248
|
this.idleInterval = null;
|
|
@@ -38229,7 +38277,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
38229
38277
|
}
|
|
38230
38278
|
this.preventDefaultResize(e);
|
|
38231
38279
|
this.trigger('focus', { event: e, isInteracted: Object.keys(e).length === 0 ? false : true });
|
|
38232
|
-
if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle) {
|
|
38280
|
+
if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle && isNullOrUndefined(this.timeInterval)) {
|
|
38233
38281
|
this.timeInterval = setInterval(this.updateValueOnIdle.bind(this), this.saveInterval);
|
|
38234
38282
|
}
|
|
38235
38283
|
EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
|
|
@@ -38398,8 +38446,8 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
38398
38446
|
RichTextEditor.prototype.contentChanged = function () {
|
|
38399
38447
|
if (this.autoSaveOnIdle) {
|
|
38400
38448
|
if (!isNullOrUndefined(this.saveInterval)) {
|
|
38401
|
-
clearTimeout(this.
|
|
38402
|
-
this.
|
|
38449
|
+
clearTimeout(this.autoSaveTimeOut);
|
|
38450
|
+
this.autoSaveTimeOut = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
|
|
38403
38451
|
}
|
|
38404
38452
|
}
|
|
38405
38453
|
};
|
|
@@ -38542,6 +38590,9 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
38542
38590
|
}
|
|
38543
38591
|
};
|
|
38544
38592
|
RichTextEditor.prototype.wireEvents = function () {
|
|
38593
|
+
this.onResizeHandler = this.resizeHandler.bind(this);
|
|
38594
|
+
this.onBlurHandler = this.blurHandler.bind(this);
|
|
38595
|
+
this.onFocusHandler = this.focusHandler.bind(this);
|
|
38545
38596
|
this.element.addEventListener('focusin', this.onFocusHandler, true);
|
|
38546
38597
|
this.element.addEventListener('focusout', this.onBlurHandler, true);
|
|
38547
38598
|
this.on(contentChanged, this.contentChanged, this);
|
|
@@ -38597,7 +38648,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
38597
38648
|
EventHandler.add(this.inputElement, 'input', this.inputHandler, this);
|
|
38598
38649
|
this.wireContextEvent();
|
|
38599
38650
|
this.formatter.editorManager.observer.on(KEY_DOWN_HANDLER, this.editorKeyDown, this);
|
|
38600
|
-
this.onResizeHandler = this.resizeHandler.bind(this);
|
|
38601
38651
|
this.element.ownerDocument.defaultView.addEventListener('resize', this.onResizeHandler, true);
|
|
38602
38652
|
if (this.iframeSettings.enable) {
|
|
38603
38653
|
EventHandler.add(this.inputElement, 'focusin', this.focusHandler, this);
|