@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
|
@@ -5432,6 +5432,7 @@ class ToolbarRenderer {
|
|
|
5432
5432
|
openDelay: 400,
|
|
5433
5433
|
opensOn: 'Hover',
|
|
5434
5434
|
beforeRender: this.tooltipBeforeRender.bind(this),
|
|
5435
|
+
beforeOpen: this.tooltipBeforeOpen.bind(this),
|
|
5435
5436
|
cssClass: this.parent.getCssClass(),
|
|
5436
5437
|
windowCollision: true,
|
|
5437
5438
|
position: 'BottomCenter'
|
|
@@ -6808,6 +6809,7 @@ class Image$1 {
|
|
|
6808
6809
|
if (this.parent.insertImageSettings.resize) {
|
|
6809
6810
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
|
|
6810
6811
|
this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
|
|
6812
|
+
this.docClick = null;
|
|
6811
6813
|
EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
|
|
6812
6814
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
6813
6815
|
}
|
|
@@ -9156,6 +9158,7 @@ class Audio {
|
|
|
9156
9158
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
|
|
9157
9159
|
EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
|
|
9158
9160
|
this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
|
|
9161
|
+
this.docClick = null;
|
|
9159
9162
|
}
|
|
9160
9163
|
}
|
|
9161
9164
|
afterRender() {
|
|
@@ -10053,6 +10056,7 @@ class Video {
|
|
|
10053
10056
|
if (this.parent.insertVideoSettings.resize) {
|
|
10054
10057
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
|
|
10055
10058
|
this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
|
|
10059
|
+
this.docClick = null;
|
|
10056
10060
|
EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
|
|
10057
10061
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
10058
10062
|
}
|
|
@@ -21946,7 +21950,9 @@ class Lists {
|
|
|
21946
21950
|
&& (!isNullOrUndefined(closest(startNode, 'ul')) || !isNullOrUndefined(closest(startNode, 'ol')))
|
|
21947
21951
|
&& (!isNullOrUndefined(closest(endNode, 'ul')) || !isNullOrUndefined(closest(endNode, 'ol')))
|
|
21948
21952
|
&& ((commonAncestor.lastElementChild === closest(endNode, 'li') && commonAncestor.lastChild !== endNode)) && !range.collapsed) {
|
|
21949
|
-
|
|
21953
|
+
if (this.areAllListItemsSelected(commonAncestor, range)) {
|
|
21954
|
+
detach(commonAncestor);
|
|
21955
|
+
}
|
|
21950
21956
|
}
|
|
21951
21957
|
this.removeList(range, e);
|
|
21952
21958
|
}
|
|
@@ -22617,6 +22623,18 @@ class Lists {
|
|
|
22617
22623
|
this.domNode = null;
|
|
22618
22624
|
}
|
|
22619
22625
|
}
|
|
22626
|
+
areAllListItemsSelected(list, range) {
|
|
22627
|
+
const listItems = list.querySelectorAll('li');
|
|
22628
|
+
for (let i = 0; i < listItems.length; i++) {
|
|
22629
|
+
const listItem = listItems[i];
|
|
22630
|
+
const listItemRange = this.parent.currentDocument.createRange();
|
|
22631
|
+
listItemRange.selectNodeContents(listItem);
|
|
22632
|
+
if (!range.intersectsNode(listItem)) {
|
|
22633
|
+
return false;
|
|
22634
|
+
}
|
|
22635
|
+
}
|
|
22636
|
+
return true;
|
|
22637
|
+
}
|
|
22620
22638
|
}
|
|
22621
22639
|
|
|
22622
22640
|
/**
|
|
@@ -23689,6 +23707,9 @@ class InsertHtml {
|
|
|
23689
23707
|
const rangeElement = closest(nearestAnchor, 'span');
|
|
23690
23708
|
rangeElement.appendChild(tempSpan);
|
|
23691
23709
|
}
|
|
23710
|
+
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')) {
|
|
23711
|
+
range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
|
|
23712
|
+
}
|
|
23692
23713
|
else {
|
|
23693
23714
|
range.insertNode(tempSpan);
|
|
23694
23715
|
}
|
|
@@ -23777,17 +23798,7 @@ class InsertHtml {
|
|
|
23777
23798
|
else {
|
|
23778
23799
|
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
23779
23800
|
}
|
|
23780
|
-
|
|
23781
|
-
if (spanAligns.length > 0) {
|
|
23782
|
-
spanAligns.forEach((spanAlign) => {
|
|
23783
|
-
if (!isNullOrUndefined(spanAlign)) {
|
|
23784
|
-
const blockAlign = this.getImmediateBlockNode(spanAlign, null);
|
|
23785
|
-
if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
|
|
23786
|
-
blockAlign.style.textAlign = spanAlign.style.textAlign;
|
|
23787
|
-
}
|
|
23788
|
-
}
|
|
23789
|
-
});
|
|
23790
|
-
}
|
|
23801
|
+
this.alignCheck(editNode);
|
|
23791
23802
|
}
|
|
23792
23803
|
static placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
23793
23804
|
lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
|
|
@@ -24027,6 +24038,27 @@ class InsertHtml {
|
|
|
24027
24038
|
}
|
|
24028
24039
|
insertNode.classList.add('ignore-table');
|
|
24029
24040
|
}
|
|
24041
|
+
static alignCheck(editNode) {
|
|
24042
|
+
const spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
|
|
24043
|
+
for (let i = 0; i < spanAligns.length; i++) {
|
|
24044
|
+
const spanAlign = spanAligns[i];
|
|
24045
|
+
if (spanAlign) {
|
|
24046
|
+
const blockAlign = this.getImmediateBlockNode(spanAlign, null);
|
|
24047
|
+
if (blockAlign) {
|
|
24048
|
+
let totalSpanText = '';
|
|
24049
|
+
for (let j = 0; j < spanAligns.length; j++) {
|
|
24050
|
+
const span = spanAligns[j];
|
|
24051
|
+
if (blockAlign.contains(span)) {
|
|
24052
|
+
totalSpanText += span.textContent;
|
|
24053
|
+
}
|
|
24054
|
+
}
|
|
24055
|
+
if (blockAlign.textContent.trim() === totalSpanText.trim()) {
|
|
24056
|
+
blockAlign.style.textAlign = spanAlign.style.textAlign;
|
|
24057
|
+
}
|
|
24058
|
+
}
|
|
24059
|
+
}
|
|
24060
|
+
}
|
|
24061
|
+
}
|
|
24030
24062
|
}
|
|
24031
24063
|
/**
|
|
24032
24064
|
* Insert method
|
|
@@ -26761,6 +26793,12 @@ class SelectionCommands {
|
|
|
26761
26793
|
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNullOrUndefined(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
|
|
26762
26794
|
detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
|
|
26763
26795
|
}
|
|
26796
|
+
if (!isNullOrUndefined(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
26797
|
+
indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
|
|
26798
|
+
const element = this.GetFormatNode(format, value);
|
|
26799
|
+
this.applyStyles(cursorNodes, 0, element);
|
|
26800
|
+
return cursorNodes[0];
|
|
26801
|
+
}
|
|
26764
26802
|
cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
|
|
26765
26803
|
}
|
|
26766
26804
|
return cursorNode;
|
|
@@ -30793,7 +30831,7 @@ class HtmlEditor {
|
|
|
30793
30831
|
}
|
|
30794
30832
|
onKeyUp(e) {
|
|
30795
30833
|
const args = e.args;
|
|
30796
|
-
const restrictKeys = [8, 9, 13,
|
|
30834
|
+
const restrictKeys = [8, 9, 13, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
|
|
30797
30835
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
|
|
30798
30836
|
const range = this.parent.getRange();
|
|
30799
30837
|
const regEx = new RegExp('\u200B', 'g');
|
|
@@ -30801,9 +30839,18 @@ class HtmlEditor {
|
|
|
30801
30839
|
range.startOffset === 1 && range.startContainer.textContent.length === 1 &&
|
|
30802
30840
|
range.startContainer.textContent.charCodeAt(0) === 8203 &&
|
|
30803
30841
|
range.startContainer.textContent.replace(regEx, '').length === 0;
|
|
30842
|
+
let isMention = false;
|
|
30843
|
+
if (range.startContainer === range.endContainer &&
|
|
30844
|
+
range.startOffset === range.endOffset && (range.startContainer !== this.parent.inputElement && range.startOffset !== 0)) {
|
|
30845
|
+
const mentionStartNode = range.startContainer.nodeType === 3 ?
|
|
30846
|
+
range.startContainer : range.startContainer.childNodes[range.startOffset - 1];
|
|
30847
|
+
isMention = args.keyCode === 16 &&
|
|
30848
|
+
mentionStartNode.textContent.charCodeAt(0) === 8203 &&
|
|
30849
|
+
!isNullOrUndefined(mentionStartNode.previousSibling) && mentionStartNode.previousSibling.contentEditable === 'false';
|
|
30850
|
+
}
|
|
30804
30851
|
let pointer;
|
|
30805
30852
|
let isRootParent = false;
|
|
30806
|
-
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
|
|
30853
|
+
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode && !isMention) {
|
|
30807
30854
|
pointer = range.startOffset;
|
|
30808
30855
|
const container = range.startContainer;
|
|
30809
30856
|
// Check if the container is a text node and contains a zero-width space
|
|
@@ -35981,8 +36028,6 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
35981
36028
|
*/
|
|
35982
36029
|
preRender() {
|
|
35983
36030
|
this.initializeValue();
|
|
35984
|
-
this.onBlurHandler = this.blurHandler.bind(this);
|
|
35985
|
-
this.onFocusHandler = this.focusHandler.bind(this);
|
|
35986
36031
|
this.clickPoints = { clientX: 0, clientY: 0 };
|
|
35987
36032
|
this.initialValue = this.value;
|
|
35988
36033
|
this.serviceLocator = new ServiceLocator;
|
|
@@ -36621,7 +36666,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
36621
36666
|
this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
|
|
36622
36667
|
this.isSelectAll = false;
|
|
36623
36668
|
}
|
|
36624
|
-
if (selection.rangeCount > 0) {
|
|
36669
|
+
if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement) && range.startContainer.innerHTML === '<br>' && range.startContainer.textContent === '') {
|
|
36625
36670
|
selection.removeAllRanges();
|
|
36626
36671
|
selection.addRange(currentRange);
|
|
36627
36672
|
}
|
|
@@ -36883,6 +36928,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
36883
36928
|
clearInterval(this.timeInterval);
|
|
36884
36929
|
this.timeInterval = null;
|
|
36885
36930
|
}
|
|
36931
|
+
if (!isNullOrUndefined(this.autoSaveTimeOut)) {
|
|
36932
|
+
clearTimeout(this.autoSaveTimeOut);
|
|
36933
|
+
this.autoSaveTimeOut = null;
|
|
36934
|
+
}
|
|
36886
36935
|
if (!isNullOrUndefined(this.idleInterval)) {
|
|
36887
36936
|
clearTimeout(this.idleInterval);
|
|
36888
36937
|
this.idleInterval = null;
|
|
@@ -37914,7 +37963,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
37914
37963
|
}
|
|
37915
37964
|
this.preventDefaultResize(e);
|
|
37916
37965
|
this.trigger('focus', { event: e, isInteracted: Object.keys(e).length === 0 ? false : true });
|
|
37917
|
-
if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle) {
|
|
37966
|
+
if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle && isNullOrUndefined(this.timeInterval)) {
|
|
37918
37967
|
this.timeInterval = setInterval(this.updateValueOnIdle.bind(this), this.saveInterval);
|
|
37919
37968
|
}
|
|
37920
37969
|
EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
|
|
@@ -38083,8 +38132,8 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
38083
38132
|
contentChanged() {
|
|
38084
38133
|
if (this.autoSaveOnIdle) {
|
|
38085
38134
|
if (!isNullOrUndefined(this.saveInterval)) {
|
|
38086
|
-
clearTimeout(this.
|
|
38087
|
-
this.
|
|
38135
|
+
clearTimeout(this.autoSaveTimeOut);
|
|
38136
|
+
this.autoSaveTimeOut = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
|
|
38088
38137
|
}
|
|
38089
38138
|
}
|
|
38090
38139
|
}
|
|
@@ -38225,6 +38274,9 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
38225
38274
|
}
|
|
38226
38275
|
}
|
|
38227
38276
|
wireEvents() {
|
|
38277
|
+
this.onResizeHandler = this.resizeHandler.bind(this);
|
|
38278
|
+
this.onBlurHandler = this.blurHandler.bind(this);
|
|
38279
|
+
this.onFocusHandler = this.focusHandler.bind(this);
|
|
38228
38280
|
this.element.addEventListener('focusin', this.onFocusHandler, true);
|
|
38229
38281
|
this.element.addEventListener('focusout', this.onBlurHandler, true);
|
|
38230
38282
|
this.on(contentChanged, this.contentChanged, this);
|
|
@@ -38280,7 +38332,6 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
38280
38332
|
EventHandler.add(this.inputElement, 'input', this.inputHandler, this);
|
|
38281
38333
|
this.wireContextEvent();
|
|
38282
38334
|
this.formatter.editorManager.observer.on(KEY_DOWN_HANDLER, this.editorKeyDown, this);
|
|
38283
|
-
this.onResizeHandler = this.resizeHandler.bind(this);
|
|
38284
38335
|
this.element.ownerDocument.defaultView.addEventListener('resize', this.onResizeHandler, true);
|
|
38285
38336
|
if (this.iframeSettings.enable) {
|
|
38286
38337
|
EventHandler.add(this.inputElement, 'focusin', this.focusHandler, this);
|