@syncfusion/ej2-richtexteditor 24.1.41-569421 → 24.1.41-581025
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 +0 -176
- package/dist/ej2-richtexteditor.umd.min.js +1 -1
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +7822 -9502
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +5674 -7355
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/package.json +12 -12
- package/src/common/config.d.ts +0 -7
- package/src/common/config.js +0 -11
- package/src/common/constant.d.ts +0 -6
- package/src/common/constant.js +0 -6
- package/src/common/interface.d.ts +0 -12
- package/src/common/types.d.ts +0 -6
- package/src/common/util.d.ts +0 -6
- package/src/common/util.js +20 -61
- package/src/editor-manager/base/constant.d.ts +0 -6
- package/src/editor-manager/base/constant.js +0 -6
- package/src/editor-manager/base/editor-manager.d.ts +0 -5
- package/src/editor-manager/base/editor-manager.js +0 -59
- package/src/editor-manager/base/interface.d.ts +0 -8
- package/src/editor-manager/plugin/dom-node.d.ts +1 -5
- package/src/editor-manager/plugin/dom-node.js +15 -169
- package/src/editor-manager/plugin/format-painter-actions.d.ts +0 -1
- package/src/editor-manager/plugin/format-painter-actions.js +1 -19
- package/src/editor-manager/plugin/formats.d.ts +0 -1
- package/src/editor-manager/plugin/formats.js +3 -38
- package/src/editor-manager/plugin/image.js +16 -12
- package/src/editor-manager/plugin/indents.js +1 -1
- package/src/editor-manager/plugin/inserthtml.d.ts +0 -1
- package/src/editor-manager/plugin/inserthtml.js +18 -78
- package/src/editor-manager/plugin/link.js +3 -8
- package/src/editor-manager/plugin/lists.js +70 -159
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +0 -3
- package/src/editor-manager/plugin/ms-word-clean-up.js +85 -212
- package/src/editor-manager/plugin/nodecutter.js +2 -5
- package/src/editor-manager/plugin/selection-commands.d.ts +0 -2
- package/src/editor-manager/plugin/selection-commands.js +4 -209
- package/src/editor-manager/plugin/table.d.ts +1 -4
- package/src/editor-manager/plugin/table.js +49 -95
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +10 -20
- package/src/editor-manager/plugin/undo.d.ts +0 -1
- package/src/editor-manager/plugin/undo.js +1 -21
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -4
- package/src/rich-text-editor/actions/base-quick-toolbar.js +10 -43
- package/src/rich-text-editor/actions/base-toolbar.js +34 -33
- package/src/rich-text-editor/actions/color-picker.d.ts +0 -1
- package/src/rich-text-editor/actions/color-picker.js +0 -10
- package/src/rich-text-editor/actions/count.js +1 -1
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +0 -1
- package/src/rich-text-editor/actions/dropdown-buttons.js +4 -8
- package/src/rich-text-editor/actions/emoji-picker.js +4 -4
- package/src/rich-text-editor/actions/enter-key.js +4 -8
- package/src/rich-text-editor/actions/format-painter.js +1 -4
- package/src/rich-text-editor/actions/full-screen.js +2 -3
- package/src/rich-text-editor/actions/html-editor.d.ts +2 -2
- package/src/rich-text-editor/actions/html-editor.js +42 -123
- package/src/rich-text-editor/actions/keyboard.js +1 -3
- package/src/rich-text-editor/actions/markdown-editor.js +1 -3
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +0 -3
- package/src/rich-text-editor/actions/paste-clean-up.js +14 -85
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +0 -8
- package/src/rich-text-editor/actions/quick-toolbar.js +9 -37
- package/src/rich-text-editor/actions/resize.js +1 -2
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +3 -2
- package/src/rich-text-editor/actions/toolbar.js +87 -18
- package/src/rich-text-editor/base/classes.d.ts +5 -0
- package/src/rich-text-editor/base/classes.js +5 -0
- package/src/rich-text-editor/base/constant.d.ts +0 -40
- package/src/rich-text-editor/base/constant.js +0 -209
- package/src/rich-text-editor/base/interface.d.ts +3 -37
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +3 -3
- package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -7
- package/src/rich-text-editor/base/rich-text-editor.js +132 -156
- package/src/rich-text-editor/base/util.js +2 -11
- package/src/rich-text-editor/formatter/formatter.js +4 -16
- package/src/rich-text-editor/models/default-locale.js +26 -30
- package/src/rich-text-editor/models/items.js +2 -2
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +1 -1
- package/src/rich-text-editor/renderer/audio-module.d.ts +0 -1
- package/src/rich-text-editor/renderer/audio-module.js +4 -22
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +0 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +1 -12
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -2
- package/src/rich-text-editor/renderer/image-module.d.ts +1 -9
- package/src/rich-text-editor/renderer/image-module.js +168 -203
- package/src/rich-text-editor/renderer/link-module.js +1 -10
- package/src/rich-text-editor/renderer/table-module.d.ts +1 -8
- package/src/rich-text-editor/renderer/table-module.js +139 -301
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -3
- package/src/rich-text-editor/renderer/toolbar-renderer.js +9 -94
- package/src/rich-text-editor/renderer/video-module.d.ts +0 -3
- package/src/rich-text-editor/renderer/video-module.js +41 -82
- package/src/rich-text-editor/renderer/view-source.d.ts +0 -1
- package/src/rich-text-editor/renderer/view-source.js +4 -12
- package/src/selection/selection.js +0 -3
- package/styles/bootstrap-dark.css +53 -161
- package/styles/bootstrap.css +61 -162
- package/styles/bootstrap4.css +46 -146
- package/styles/bootstrap5-dark.css +46 -151
- package/styles/bootstrap5.css +46 -151
- package/styles/fabric-dark.css +40 -140
- package/styles/fabric.css +41 -141
- package/styles/fluent-dark.css +47 -165
- package/styles/fluent.css +47 -165
- package/styles/highcontrast-light.css +40 -140
- package/styles/highcontrast.css +41 -144
- package/styles/material-dark.css +41 -145
- package/styles/material.css +41 -145
- package/styles/material3-dark.css +50 -156
- package/styles/material3.css +50 -156
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +13 -17
- package/styles/rich-text-editor/_bootstrap-definition.scss +19 -22
- package/styles/rich-text-editor/_bootstrap4-definition.scss +7 -11
- package/styles/rich-text-editor/_bootstrap5-definition.scss +3 -7
- package/styles/rich-text-editor/_fabric-dark-definition.scss +2 -6
- package/styles/rich-text-editor/_fabric-definition.scss +3 -7
- package/styles/rich-text-editor/_fluent-definition.scss +9 -13
- package/styles/rich-text-editor/_fusionnew-definition.scss +3 -7
- package/styles/rich-text-editor/_highcontrast-definition.scss +3 -7
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +2 -6
- package/styles/rich-text-editor/_layout.scss +31 -133
- package/styles/rich-text-editor/_material-dark-definition.scss +2 -6
- package/styles/rich-text-editor/_material-definition.scss +2 -6
- package/styles/rich-text-editor/_material3-definition.scss +12 -16
- package/styles/rich-text-editor/_tailwind-definition.scss +19 -23
- package/styles/rich-text-editor/_theme.scss +23 -112
- package/styles/rich-text-editor/bootstrap-dark.css +53 -161
- package/styles/rich-text-editor/bootstrap.css +61 -162
- package/styles/rich-text-editor/bootstrap4.css +46 -146
- package/styles/rich-text-editor/bootstrap5-dark.css +46 -151
- package/styles/rich-text-editor/bootstrap5.css +46 -151
- package/styles/rich-text-editor/fabric-dark.css +40 -140
- package/styles/rich-text-editor/fabric.css +41 -141
- package/styles/rich-text-editor/fluent-dark.css +47 -165
- package/styles/rich-text-editor/fluent.css +47 -165
- package/styles/rich-text-editor/highcontrast-light.css +40 -140
- package/styles/rich-text-editor/highcontrast.css +41 -144
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +2 -2
- package/styles/rich-text-editor/icons/_bootstrap.scss +2 -2
- package/styles/rich-text-editor/icons/_bootstrap4.scss +2 -2
- package/styles/rich-text-editor/icons/_bootstrap5.scss +2 -2
- package/styles/rich-text-editor/icons/_fabric-dark.scss +2 -2
- package/styles/rich-text-editor/icons/_fabric.scss +2 -2
- package/styles/rich-text-editor/icons/_fluent.scss +2 -2
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +2 -2
- package/styles/rich-text-editor/icons/_highcontrast.scss +2 -2
- package/styles/rich-text-editor/icons/_material-dark.scss +2 -2
- package/styles/rich-text-editor/icons/_material.scss +2 -2
- package/styles/rich-text-editor/icons/_material3.scss +2 -2
- package/styles/rich-text-editor/icons/_tailwind.scss +2 -2
- package/styles/rich-text-editor/material-dark.css +41 -145
- package/styles/rich-text-editor/material.css +41 -145
- package/styles/rich-text-editor/material3-dark.css +50 -156
- package/styles/rich-text-editor/material3.css +50 -156
- package/styles/rich-text-editor/tailwind-dark.css +63 -191
- package/styles/rich-text-editor/tailwind.css +63 -191
- package/styles/tailwind-dark.css +63 -191
- package/styles/tailwind.css +63 -191
- package/.eslintrc.json +0 -260
- package/src/global.d.ts +0 -1
- package/styles/rich-text-editor/_bds-definition.scss +0 -279
- package/styles/rich-text-editor/icons/_bds.scss +0 -348
|
@@ -38,45 +38,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
38
38
|
var nodeCutter = new NodeCutter();
|
|
39
39
|
var isFormatted = new IsFormatted();
|
|
40
40
|
var range = domSelection.getRange(docElement);
|
|
41
|
-
var currentAnchorNode = range.startContainer.parentElement;
|
|
42
|
-
if (range.collapsed && !isNOU(currentAnchorNode) &&
|
|
43
|
-
currentAnchorNode.tagName === 'A' &&
|
|
44
|
-
(range.startOffset === currentAnchorNode.textContent.length || range.startOffset === 0)) {
|
|
45
|
-
var emptyTextNode = document.createTextNode('');
|
|
46
|
-
if (range.startOffset === 0) {
|
|
47
|
-
currentAnchorNode.parentNode.insertBefore(emptyTextNode, currentAnchorNode);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
if (!isNOU(currentAnchorNode.nextSibling)) {
|
|
51
|
-
currentAnchorNode.parentElement.insertBefore(emptyTextNode, currentAnchorNode.nextSibling);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
currentAnchorNode.parentNode.appendChild(emptyTextNode);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Set the range to the empty text node
|
|
58
|
-
var newRange = docElement.createRange();
|
|
59
|
-
range.setStart(emptyTextNode, 0);
|
|
60
|
-
range.setEnd(emptyTextNode, 0);
|
|
61
|
-
range.collapse(true);
|
|
62
|
-
domSelection.setRange(docElement, newRange);
|
|
63
|
-
}
|
|
64
|
-
if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer === range.endContainer && !isNOU(endNode) && range.startContainer === endNode) {
|
|
65
|
-
var startChildNodes = range.startContainer.childNodes;
|
|
66
|
-
var startNode = ((startChildNodes[(range.startOffset > 0) ? (range.startOffset - 1) :
|
|
67
|
-
range.startOffset]) || range.startContainer);
|
|
68
|
-
var endNode_1 = (range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) :
|
|
69
|
-
range.endOffset] || range.endContainer);
|
|
70
|
-
var lastSelectionNode = (endNode_1.lastChild.nodeName === 'BR' ? (isNOU(endNode_1.lastChild.previousSibling) ? endNode_1
|
|
71
|
-
: endNode_1.lastChild.previousSibling) : endNode_1.firstChild);
|
|
72
|
-
while (!isNOU(lastSelectionNode) && lastSelectionNode.nodeName !== '#text' && lastSelectionNode.nodeName !== 'IMG' &&
|
|
73
|
-
lastSelectionNode.nodeName !== 'BR' && lastSelectionNode.nodeName !== 'HR') {
|
|
74
|
-
lastSelectionNode = lastSelectionNode.lastChild;
|
|
75
|
-
}
|
|
76
|
-
;
|
|
77
|
-
domSelection.setSelectionText(docElement, startNode, lastSelectionNode, 0, 0);
|
|
78
|
-
range = domSelection.getRange(docElement);
|
|
79
|
-
}
|
|
80
41
|
var save = domSelection.save(range, docElement);
|
|
81
42
|
var nodes = range.collapsed ? domSelection.getSelectionNodeCollection(range) :
|
|
82
43
|
domSelection.getSelectionNodeCollectionBr(range);
|
|
@@ -224,7 +185,8 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
224
185
|
cursorNodes[0].firstElementChild.tagName.toLowerCase() === 'br')) {
|
|
225
186
|
cursorNodes[0].innerHTML = '';
|
|
226
187
|
}
|
|
227
|
-
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' ||
|
|
188
|
+
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' ||
|
|
189
|
+
cursorNodes[0].nextSibling.nodeName === 'BR')) {
|
|
228
190
|
detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
|
|
229
191
|
}
|
|
230
192
|
cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
|
|
@@ -249,15 +211,11 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
249
211
|
&& range.endOffset === range.startContainer.length)) {
|
|
250
212
|
var nodeIndex = [];
|
|
251
213
|
var cloneNode = nodes[index];
|
|
252
|
-
var clonedElement = cloneNode;
|
|
253
214
|
do {
|
|
254
215
|
nodeIndex.push(domSelection.getIndex(cloneNode));
|
|
255
216
|
cloneNode = cloneNode.parentNode;
|
|
256
217
|
} while (cloneNode && (cloneNode !== formatNode));
|
|
257
218
|
if (nodes[index].nodeName !== 'BR') {
|
|
258
|
-
if (clonedElement.nodeName === '#text' && clonedElement.textContent.includes('\u200B')) {
|
|
259
|
-
clonedElement.remove();
|
|
260
|
-
}
|
|
261
219
|
cloneNode = splitNode = (isCursor && (formatNode.textContent.length - 1) === range.startOffset) ?
|
|
262
220
|
nodeCutter.SplitNode(range, formatNode, true)
|
|
263
221
|
: nodeCutter.GetSpliceNode(range, formatNode);
|
|
@@ -335,30 +293,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
335
293
|
formatNode.style.textDecoration = 'none';
|
|
336
294
|
child = [formatNode];
|
|
337
295
|
}
|
|
338
|
-
else if (IsFormatted.inlineTags.indexOf(formatNodeTagName.toLowerCase()) !== -1 && isFontStyle && formatNodeTagName.toLocaleLowerCase() !== 'span') {
|
|
339
|
-
var fontNodeStyle = formatNode.style;
|
|
340
|
-
if (fontNodeStyle.color && format === 'fontcolor') {
|
|
341
|
-
if (formatNode.nodeName === 'A') {
|
|
342
|
-
fontNodeStyle.color = value;
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
fontNodeStyle.color = '';
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
else if (fontNodeStyle.backgroundColor && format === 'backgroundcolor') {
|
|
349
|
-
fontNodeStyle.backgroundColor = '';
|
|
350
|
-
}
|
|
351
|
-
else if (fontNodeStyle.fontSize && format === 'fontsize') {
|
|
352
|
-
fontNodeStyle.fontSize = '';
|
|
353
|
-
}
|
|
354
|
-
else if (fontNodeStyle.fontFamily && format === 'fontname') {
|
|
355
|
-
fontNodeStyle.fontFamily = '';
|
|
356
|
-
}
|
|
357
|
-
if (formatNode.getAttribute("style") === '') {
|
|
358
|
-
formatNode.removeAttribute("style");
|
|
359
|
-
}
|
|
360
|
-
child = [formatNode];
|
|
361
|
-
}
|
|
362
296
|
else {
|
|
363
297
|
child = InsertMethods.unwrap(formatNode);
|
|
364
298
|
var liElement = nodes[index].parentElement;
|
|
@@ -374,10 +308,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
374
308
|
liElement.style.fontStyle = 'normal';
|
|
375
309
|
}
|
|
376
310
|
}
|
|
377
|
-
else if (!isNOU(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
378
|
-
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
379
|
-
SelectionCommands.conCatenateTextNode(liElement, format, '', 'normal');
|
|
380
|
-
}
|
|
381
311
|
}
|
|
382
312
|
if (child[0] && !isFontStyle) {
|
|
383
313
|
var nodeTraverse = child[index] ? child[index] : child[0];
|
|
@@ -436,10 +366,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
436
366
|
liElement.style.fontFamily = value;
|
|
437
367
|
}
|
|
438
368
|
}
|
|
439
|
-
if (!isNOU(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
440
|
-
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
441
|
-
SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
|
|
442
|
-
}
|
|
443
369
|
if (child[num].textContent === startText) {
|
|
444
370
|
if (num === 0) {
|
|
445
371
|
range.setStartBefore(child[num]);
|
|
@@ -472,10 +398,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
472
398
|
}
|
|
473
399
|
var num = index;
|
|
474
400
|
var liChildContent = '';
|
|
475
|
-
|
|
476
|
-
while (num >= 0 && !isNOU(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.contains(nodes[num]) &&
|
|
477
|
-
liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
|
|
478
|
-
/* eslint-enable security/detect-object-injection */
|
|
401
|
+
while (num >= 0 && !isNOU(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
|
|
479
402
|
liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
|
|
480
403
|
num--;
|
|
481
404
|
}
|
|
@@ -547,54 +470,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
547
470
|
parentElement = parentElement.parentElement;
|
|
548
471
|
liElement = parentElement;
|
|
549
472
|
}
|
|
550
|
-
if (format === 'fontcolor' || format === 'fontname' || format === 'fontsize') {
|
|
551
|
-
var parentElem = nodes[index].parentElement;
|
|
552
|
-
if (!isNOU(parentElem) && parentElem.childNodes) {
|
|
553
|
-
for (var i = 0; i < parentElem.childNodes.length; i++) {
|
|
554
|
-
if (this.concatenateTextExcludingList(nodes, index) === nodes[index].textContent) {
|
|
555
|
-
var liElement_1 = void 0;
|
|
556
|
-
if (parentElem.tagName === 'LI') {
|
|
557
|
-
liElement_1 = parentElem;
|
|
558
|
-
}
|
|
559
|
-
else if (parentElem.closest('li')) {
|
|
560
|
-
liElement_1 = parentElem.closest('li');
|
|
561
|
-
}
|
|
562
|
-
if (!isNOU(liElement_1)) {
|
|
563
|
-
switch (format) {
|
|
564
|
-
case 'fontcolor':
|
|
565
|
-
liElement_1.style.color = value;
|
|
566
|
-
break;
|
|
567
|
-
case 'fontname':
|
|
568
|
-
liElement_1.style.fontFamily = value;
|
|
569
|
-
break;
|
|
570
|
-
case 'fontsize':
|
|
571
|
-
liElement_1.style.fontSize = value;
|
|
572
|
-
break;
|
|
573
|
-
default:
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
// eslint-disable-next-line
|
|
579
|
-
var childElement = parentElem.childNodes[i];
|
|
580
|
-
if (childElement.tagName === 'OL' || childElement.tagName === 'UL') {
|
|
581
|
-
switch (format) {
|
|
582
|
-
case 'fontcolor':
|
|
583
|
-
childElement.style.color = 'initial';
|
|
584
|
-
break;
|
|
585
|
-
case 'fontname':
|
|
586
|
-
childElement.style.fontFamily = 'initial';
|
|
587
|
-
break;
|
|
588
|
-
case 'fontsize':
|
|
589
|
-
childElement.style.fontSize = 'initial';
|
|
590
|
-
break;
|
|
591
|
-
default:
|
|
592
|
-
break;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
473
|
if (!isNOU(liElement) && liElement.tagName.toLowerCase() === 'li' &&
|
|
599
474
|
liElement.textContent.trim() === nodes[index].textContent.trim()) {
|
|
600
475
|
if (format === 'fontsize') {
|
|
@@ -647,10 +522,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
647
522
|
}
|
|
648
523
|
nodeList[0] = currentFormatNode;
|
|
649
524
|
this.applyStyles(nodeList, 0, element);
|
|
650
|
-
if (!isNOU(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
651
|
-
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
652
|
-
SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
|
|
653
|
-
}
|
|
654
525
|
}
|
|
655
526
|
else {
|
|
656
527
|
nodes[index] = this.applyStyles(nodes, index, element);
|
|
@@ -671,10 +542,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
671
542
|
liElement.style.fontStyle = 'italic';
|
|
672
543
|
}
|
|
673
544
|
}
|
|
674
|
-
else if (!isNOU(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
675
|
-
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
676
|
-
SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format);
|
|
677
|
-
}
|
|
678
545
|
}
|
|
679
546
|
}
|
|
680
547
|
}
|
|
@@ -878,9 +745,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
878
745
|
}
|
|
879
746
|
var blockChildNodes = parent.parentElement.childNodes;
|
|
880
747
|
for (var k = 0; k < blockChildNodes.length; k++) {
|
|
881
|
-
if (
|
|
882
|
-
blockChildNodes[k].textContent.charCodeAt(0) !== 160) {
|
|
883
|
-
// 160 is the char code for
|
|
748
|
+
if (blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) {
|
|
884
749
|
detach(blockChildNodes[k]);
|
|
885
750
|
}
|
|
886
751
|
}
|
|
@@ -904,76 +769,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
904
769
|
}
|
|
905
770
|
}
|
|
906
771
|
};
|
|
907
|
-
SelectionCommands.concatenateTextExcludingList = function (nodes, index) {
|
|
908
|
-
var result = '';
|
|
909
|
-
var parentNode = nodes[index].parentElement;
|
|
910
|
-
for (var i = 0; i < parentNode.childNodes.length; i++) {
|
|
911
|
-
// eslint-disable-next-line
|
|
912
|
-
var childNode = parentNode.childNodes[i];
|
|
913
|
-
if ((childNode.nodeType === 3) || (childNode.nodeType === 1 && (childNode.tagName !== 'OL' && childNode.tagName !== 'UL'))) {
|
|
914
|
-
result += childNode.textContent;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
return result;
|
|
918
|
-
};
|
|
919
|
-
SelectionCommands.conCatenateTextNode = function (liElement, format, value, formatStr, constVal) {
|
|
920
|
-
var result = '';
|
|
921
|
-
switch (format) {
|
|
922
|
-
case 'bold':
|
|
923
|
-
liElement.querySelectorAll('strong').forEach(function (e) {
|
|
924
|
-
result = result + e.textContent;
|
|
925
|
-
});
|
|
926
|
-
if (result === value) {
|
|
927
|
-
liElement.style.fontWeight = formatStr;
|
|
928
|
-
}
|
|
929
|
-
break;
|
|
930
|
-
case 'italic':
|
|
931
|
-
liElement.querySelectorAll('em').forEach(function (e) {
|
|
932
|
-
result = result + e.textContent;
|
|
933
|
-
});
|
|
934
|
-
if (result === value) {
|
|
935
|
-
liElement.style.fontStyle = formatStr;
|
|
936
|
-
}
|
|
937
|
-
break;
|
|
938
|
-
case 'fontcolor':
|
|
939
|
-
var colorStyle_1 = '';
|
|
940
|
-
liElement.querySelectorAll('span').forEach(function (span) {
|
|
941
|
-
colorStyle_1 = span.style.color;
|
|
942
|
-
if (colorStyle_1 === constVal) {
|
|
943
|
-
result = result + span.textContent;
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
if (result === value) {
|
|
947
|
-
liElement.style.color = colorStyle_1;
|
|
948
|
-
liElement.style.textDecoration = 'inherit';
|
|
949
|
-
}
|
|
950
|
-
break;
|
|
951
|
-
case 'fontsize':
|
|
952
|
-
var fontSize_1 = '';
|
|
953
|
-
liElement.querySelectorAll('span').forEach(function (span) {
|
|
954
|
-
fontSize_1 = span.style.getPropertyValue('font-size');
|
|
955
|
-
if (fontSize_1 === constVal) {
|
|
956
|
-
result = result + span.textContent;
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
if (result === value) {
|
|
960
|
-
liElement.style.fontSize = fontSize_1;
|
|
961
|
-
}
|
|
962
|
-
break;
|
|
963
|
-
case 'fontname':
|
|
964
|
-
var fontFamily_1 = '';
|
|
965
|
-
liElement.querySelectorAll('span').forEach(function (span) {
|
|
966
|
-
fontFamily_1 = span.style.getPropertyValue('font-family');
|
|
967
|
-
if (fontFamily_1 === constVal) {
|
|
968
|
-
result = result + span.textContent;
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
if (result === value) {
|
|
972
|
-
liElement.style.fontFamily = fontFamily_1;
|
|
973
|
-
}
|
|
974
|
-
break;
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
772
|
SelectionCommands.enterAction = 'P';
|
|
978
773
|
return SelectionCommands;
|
|
979
774
|
}());
|
|
@@ -20,6 +20,7 @@ export declare class TableCommand {
|
|
|
20
20
|
private addEventListener;
|
|
21
21
|
private createTable;
|
|
22
22
|
private calculateStyleValue;
|
|
23
|
+
private removeEmptyNode;
|
|
23
24
|
private insertAfter;
|
|
24
25
|
private getSelectedCellMinMaxIndex;
|
|
25
26
|
private insertRow;
|
|
@@ -38,10 +39,6 @@ export declare class TableCommand {
|
|
|
38
39
|
private getSelectedMinMaxIndexes;
|
|
39
40
|
private HorizontalSplit;
|
|
40
41
|
private VerticalSplit;
|
|
41
|
-
private getSplitColWidth;
|
|
42
|
-
private getColSizes;
|
|
43
|
-
private getCellIndex;
|
|
44
|
-
private convertPixelToPercentage;
|
|
45
42
|
private getCorrespondingColumns;
|
|
46
43
|
private FindIndex;
|
|
47
44
|
private getCorrespondingIndex;
|
|
@@ -60,8 +60,9 @@ var TableCommand = /** @class */ (function () {
|
|
|
60
60
|
table.appendChild(tblBody);
|
|
61
61
|
e.item.selection.restore();
|
|
62
62
|
InsertHtml.Insert(this.parent.currentDocument, table, this.parent.editableElement);
|
|
63
|
+
this.removeEmptyNode();
|
|
63
64
|
e.item.selection.setSelectionText(this.parent.currentDocument, table.querySelector('td'), table.querySelector('td'), 0, 0);
|
|
64
|
-
if (table.nextElementSibling === null
|
|
65
|
+
if (table.nextElementSibling === null) {
|
|
65
66
|
var insertElem = void 0;
|
|
66
67
|
if (e.enterAction === 'DIV') {
|
|
67
68
|
insertElem = createElement('div');
|
|
@@ -76,9 +77,6 @@ var TableCommand = /** @class */ (function () {
|
|
|
76
77
|
}
|
|
77
78
|
this.insertAfter(insertElem, table);
|
|
78
79
|
}
|
|
79
|
-
if (table.classList.contains('ignore-table')) {
|
|
80
|
-
table.classList.remove('ignore-table');
|
|
81
|
-
}
|
|
82
80
|
table.querySelector('td').classList.add('e-cell-select');
|
|
83
81
|
if (e.callBack) {
|
|
84
82
|
e.callBack({
|
|
@@ -106,6 +104,24 @@ var TableCommand = /** @class */ (function () {
|
|
|
106
104
|
}
|
|
107
105
|
return styleValue;
|
|
108
106
|
};
|
|
107
|
+
TableCommand.prototype.removeEmptyNode = function () {
|
|
108
|
+
var emptyUl = this.parent.editableElement.querySelectorAll('ul:empty, ol:empty');
|
|
109
|
+
for (var i = 0; i < emptyUl.length; i++) {
|
|
110
|
+
detach(emptyUl[i]);
|
|
111
|
+
}
|
|
112
|
+
var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
113
|
+
for (var i = 0; i < emptyLiChild.length; i++) {
|
|
114
|
+
detach(emptyLiChild[i]);
|
|
115
|
+
if (emptyLiChild.length === i + 1) {
|
|
116
|
+
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
117
|
+
i = -1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
var emptyLi = this.parent.editableElement.querySelectorAll('li:empty');
|
|
121
|
+
for (var i = 0; i < emptyLi.length; i++) {
|
|
122
|
+
detach(emptyLi[i]);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
109
125
|
TableCommand.prototype.insertAfter = function (newNode, referenceNode) {
|
|
110
126
|
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
111
127
|
};
|
|
@@ -456,21 +472,14 @@ var TableCommand = /** @class */ (function () {
|
|
|
456
472
|
}
|
|
457
473
|
};
|
|
458
474
|
TableCommand.prototype.tableVerticalAlign = function (e) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
case 'AlignTop':
|
|
462
|
-
value = 'top';
|
|
463
|
-
break;
|
|
464
|
-
case 'AlignMiddle':
|
|
465
|
-
value = 'middle';
|
|
466
|
-
break;
|
|
467
|
-
case 'AlignBottom':
|
|
468
|
-
value = 'bottom';
|
|
469
|
-
break;
|
|
475
|
+
if (e.item.subCommand === 'AlignTop') {
|
|
476
|
+
e.item.tableCell.style.verticalAlign = 'top';
|
|
470
477
|
}
|
|
471
|
-
e.item.
|
|
472
|
-
|
|
473
|
-
|
|
478
|
+
else if (e.item.subCommand === 'AlignMiddle') {
|
|
479
|
+
e.item.tableCell.style.verticalAlign = 'middle';
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
e.item.tableCell.style.verticalAlign = 'bottom';
|
|
474
483
|
}
|
|
475
484
|
if (e.callBack) {
|
|
476
485
|
e.callBack({
|
|
@@ -501,22 +510,10 @@ var TableCommand = /** @class */ (function () {
|
|
|
501
510
|
firstCell.setAttribute('rowspan', (minMaxIndexes.endRow - minMaxIndexes.startRow + 1).toString());
|
|
502
511
|
}
|
|
503
512
|
var totalWidth = 0;
|
|
504
|
-
var unit;
|
|
505
513
|
for (var j = rowSelectedCells.length - 1; j >= 0; j--) {
|
|
506
|
-
|
|
507
|
-
&& rowSelectedCells[j].style.width !== '') {
|
|
508
|
-
if (!unit) {
|
|
509
|
-
var match = rowSelectedCells[j].style.width.match(/^([\d.]+)([a-z%]+)$/i);
|
|
510
|
-
unit = match ? match[2] : '%';
|
|
511
|
-
}
|
|
512
|
-
totalWidth = totalWidth + parseFloat(rowSelectedCells[j].style.width);
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
515
|
-
totalWidth = totalWidth + ((rowSelectedCells[j].offsetWidth / this.curTable.offsetWidth) * 100);
|
|
516
|
-
unit = '%';
|
|
517
|
-
}
|
|
514
|
+
totalWidth = totalWidth + parseFloat(rowSelectedCells[j].style.width);
|
|
518
515
|
}
|
|
519
|
-
firstCell.style.width = totalWidth +
|
|
516
|
+
firstCell.style.width = totalWidth + '%';
|
|
520
517
|
for (var i = 1; i <= selectedCells.length - 1; i++) {
|
|
521
518
|
detach(selectedCells[i]);
|
|
522
519
|
}
|
|
@@ -553,7 +550,7 @@ var TableCommand = /** @class */ (function () {
|
|
|
553
550
|
var eleArray = elements;
|
|
554
551
|
//eslint-disable-next-line
|
|
555
552
|
if (min < (max = Math.min(max, eleArray[0].length - 1))) {
|
|
556
|
-
for (colIndex
|
|
553
|
+
for (colIndex === min; colIndex <= max; colIndex++) {
|
|
557
554
|
// eslint-disable-next-line
|
|
558
555
|
if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < (index =
|
|
559
556
|
Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1)) &&
|
|
@@ -744,23 +741,28 @@ var TableCommand = /** @class */ (function () {
|
|
|
744
741
|
var newCell = this.activeCell.cloneNode(true);
|
|
745
742
|
newCell.removeAttribute('class');
|
|
746
743
|
newCell.innerHTML = '</br>';
|
|
744
|
+
var avgWidth = parseFloat(this.activeCell.style.width) / 2;
|
|
745
|
+
if (this.activeCell.tagName === 'TH' && isNaN(avgWidth)) {
|
|
746
|
+
var cellCount = this.curTable.querySelector('tr').childElementCount;
|
|
747
|
+
var colSpanCount = 0;
|
|
748
|
+
for (var i = 0; i < cellCount; i++) {
|
|
749
|
+
colSpanCount = colSpanCount + (parseInt(this.curTable.querySelector('tr').children[i].getAttribute('colspan'), 10) || 1);
|
|
750
|
+
}
|
|
751
|
+
avgWidth = parseFloat((((this.activeCell.offsetWidth / 2) / this.curTable.offsetWidth) * 100).toFixed(1));
|
|
752
|
+
}
|
|
747
753
|
var activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
|
|
748
754
|
var correspondingColumns = this.getCorrespondingColumns();
|
|
749
|
-
var activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10)
|
|
755
|
+
var activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10);
|
|
750
756
|
if (activeCellcolSpan > 1) {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
1 < activeCellcolSpan - colSpan ? newCell.setAttribute('colspan', (activeCellcolSpan - colSpan).toString()) : newCell.removeAttribute('colspan');
|
|
759
|
-
this.activeCell.style.width = activeCellUpdatedWidth + '%';
|
|
760
|
-
newCell.style.width = newCellWidth + '%';
|
|
757
|
+
// eslint-disable-next-line
|
|
758
|
+
1 < Math.ceil(activeCellcolSpan / 2) ? this.activeCell.setAttribute('colspan', (activeCellcolSpan / 2).toString())
|
|
759
|
+
: this.activeCell.removeAttribute('colspan');
|
|
760
|
+
// eslint-disable-next-line
|
|
761
|
+
1 < (activeCellcolSpan - activeCellcolSpan / 2) ? newCell.setAttribute('colspan',
|
|
762
|
+
// eslint-disable-next-line
|
|
763
|
+
(activeCellcolSpan - activeCellcolSpan / 2).toString()) : newCell.removeAttribute('colspan');
|
|
761
764
|
}
|
|
762
765
|
else {
|
|
763
|
-
var avgWidth = parseFloat(this.activeCell.style.width) / 2;
|
|
764
766
|
for (var i = 0; i <= allRows.length - 1; i++) {
|
|
765
767
|
if (0 === i || correspondingColumns[i][activeCellIndex[1]] !== correspondingColumns[i - 1][activeCellIndex[1]]) {
|
|
766
768
|
var currentCell = correspondingColumns[i][activeCellIndex[1]];
|
|
@@ -770,9 +772,9 @@ var TableCommand = /** @class */ (function () {
|
|
|
770
772
|
}
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
|
-
this.activeCell.style.width = avgWidth + '%';
|
|
774
|
-
newCell.style.width = avgWidth + '%';
|
|
775
775
|
}
|
|
776
|
+
this.activeCell.style.width = avgWidth + '%';
|
|
777
|
+
newCell.style.width = avgWidth + '%';
|
|
776
778
|
this.activeCell.parentNode.insertBefore(newCell, this.activeCell.nextSibling);
|
|
777
779
|
if (e.callBack) {
|
|
778
780
|
e.callBack({
|
|
@@ -784,54 +786,6 @@ var TableCommand = /** @class */ (function () {
|
|
|
784
786
|
});
|
|
785
787
|
}
|
|
786
788
|
};
|
|
787
|
-
TableCommand.prototype.getSplitColWidth = function (startIndex, endInex, sizes) {
|
|
788
|
-
var width = 0;
|
|
789
|
-
for (var i = startIndex; i <= endInex; i++) {
|
|
790
|
-
width += sizes[i];
|
|
791
|
-
}
|
|
792
|
-
return this.convertPixelToPercentage(width, this.curTable.offsetWidth);
|
|
793
|
-
};
|
|
794
|
-
TableCommand.prototype.getColSizes = function (curTable) {
|
|
795
|
-
var cellColl = curTable.rows[0].cells;
|
|
796
|
-
var cellCount = 0;
|
|
797
|
-
for (var cell = 0; cell < cellColl.length; cell++) {
|
|
798
|
-
cellCount = cellCount + cellColl[cell].colSpan;
|
|
799
|
-
}
|
|
800
|
-
var sizes = new Array(cellCount);
|
|
801
|
-
var rowSpanCells = new Map();
|
|
802
|
-
for (var i = 0; i < curTable.rows.length; i++) {
|
|
803
|
-
var currentColIndex = 0;
|
|
804
|
-
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
805
|
-
for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
|
|
806
|
-
var key = "" + (i + l) + currentColIndex;
|
|
807
|
-
rowSpanCells.set(key, curTable.rows[i].cells[k]);
|
|
808
|
-
}
|
|
809
|
-
var cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
810
|
-
if (cellIndex > currentColIndex) {
|
|
811
|
-
currentColIndex = cellIndex;
|
|
812
|
-
}
|
|
813
|
-
var width = curTable.rows[i].cells[k].offsetWidth;
|
|
814
|
-
if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
|
|
815
|
-
sizes[currentColIndex] = width;
|
|
816
|
-
}
|
|
817
|
-
currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
return sizes;
|
|
821
|
-
};
|
|
822
|
-
TableCommand.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
|
|
823
|
-
var cellKey = "" + rowIndex + colIndex;
|
|
824
|
-
var spannedCell = rowSpanCells.get(cellKey);
|
|
825
|
-
if (spannedCell) {
|
|
826
|
-
return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
|
|
827
|
-
}
|
|
828
|
-
else {
|
|
829
|
-
return colIndex;
|
|
830
|
-
}
|
|
831
|
-
};
|
|
832
|
-
TableCommand.prototype.convertPixelToPercentage = function (value, offsetValue) {
|
|
833
|
-
return (value / offsetValue) * 100;
|
|
834
|
-
};
|
|
835
789
|
TableCommand.prototype.getCorrespondingColumns = function () {
|
|
836
790
|
var elementArray = [];
|
|
837
791
|
// eslint-disable-next-line
|
|
@@ -11,7 +11,7 @@ export declare class ToolbarStatus {
|
|
|
11
11
|
* get method
|
|
12
12
|
*
|
|
13
13
|
* @param {Document} docElement - specifies the document element
|
|
14
|
-
* @param {Node}
|
|
14
|
+
* @param {Node} targetNode - specifies the target node
|
|
15
15
|
* @param {string[]} formatNode - specifies the format node
|
|
16
16
|
* @param {string[]} fontSize - specifies the font size
|
|
17
17
|
* @param {string[]} fontName - specifies the font name.
|
|
@@ -20,7 +20,7 @@ export declare class ToolbarStatus {
|
|
|
20
20
|
* @hidden
|
|
21
21
|
* @deprecated
|
|
22
22
|
*/
|
|
23
|
-
static get(docElement: Document,
|
|
23
|
+
static get(docElement: Document, targetNode: Node, formatNode?: string[], fontSize?: string[], fontName?: string[], documentNode?: Node): IToolbarStatus;
|
|
24
24
|
private static getImmediateBlockNode;
|
|
25
25
|
private static getFormatParent;
|
|
26
26
|
private static isFormattedNode;
|
|
@@ -2,7 +2,6 @@ import { IsFormatted } from './isformatted';
|
|
|
2
2
|
import * as CONSTANT from './../base/constant';
|
|
3
3
|
import { NodeSelection } from './../../selection/index';
|
|
4
4
|
import { getDefaultHtmlTbStatus } from './../../common/util';
|
|
5
|
-
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
6
5
|
/**
|
|
7
6
|
* Update Toolbar Status
|
|
8
7
|
*
|
|
@@ -17,7 +16,7 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
17
16
|
* get method
|
|
18
17
|
*
|
|
19
18
|
* @param {Document} docElement - specifies the document element
|
|
20
|
-
* @param {Node}
|
|
19
|
+
* @param {Node} targetNode - specifies the target node
|
|
21
20
|
* @param {string[]} formatNode - specifies the format node
|
|
22
21
|
* @param {string[]} fontSize - specifies the font size
|
|
23
22
|
* @param {string[]} fontName - specifies the font name.
|
|
@@ -26,7 +25,7 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
26
25
|
* @hidden
|
|
27
26
|
* @deprecated
|
|
28
27
|
*/
|
|
29
|
-
ToolbarStatus.get = function (docElement,
|
|
28
|
+
ToolbarStatus.get = function (docElement, targetNode, formatNode, fontSize, fontName, documentNode) {
|
|
30
29
|
var formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
31
30
|
var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
32
31
|
var nodeSelection = new NodeSelection();
|
|
@@ -56,7 +55,7 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
56
55
|
}
|
|
57
56
|
for (var index = 0; index < nodes.length; index++) {
|
|
58
57
|
// eslint-disable-next-line max-len
|
|
59
|
-
formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index],
|
|
58
|
+
formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
|
|
60
59
|
if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
|
|
61
60
|
nodeCollection.bold = formatCollection.bold;
|
|
62
61
|
}
|
|
@@ -131,24 +130,16 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
131
130
|
return node;
|
|
132
131
|
};
|
|
133
132
|
ToolbarStatus.getFormatParent = function (docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
|
|
134
|
-
var isListUpdated = false;
|
|
135
|
-
var isComplexListUpdated = false;
|
|
136
133
|
if (targetNode.contains(node) ||
|
|
137
134
|
(node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
|
|
138
135
|
do {
|
|
139
|
-
formatCollection = this.isFormattedNode(docElement, formatCollection, node,
|
|
140
|
-
if (formatCollection.orderedlist || formatCollection.unorderedlist) {
|
|
141
|
-
isListUpdated = true;
|
|
142
|
-
}
|
|
143
|
-
if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
|
|
144
|
-
isComplexListUpdated = true;
|
|
145
|
-
}
|
|
136
|
+
formatCollection = this.isFormattedNode(docElement, formatCollection, node, formatNode, fontSize, fontName);
|
|
146
137
|
node = node.parentNode;
|
|
147
138
|
} while (node && (node !== targetNode));
|
|
148
139
|
}
|
|
149
140
|
return formatCollection;
|
|
150
141
|
};
|
|
151
|
-
ToolbarStatus.isFormattedNode = function (docElement, formatCollection, node,
|
|
142
|
+
ToolbarStatus.isFormattedNode = function (docElement, formatCollection, node, formatNode, fontSize, fontName) {
|
|
152
143
|
if (!formatCollection.bold) {
|
|
153
144
|
formatCollection.bold = IsFormatted.isBold(node);
|
|
154
145
|
}
|
|
@@ -179,10 +170,10 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
179
170
|
if (!formatCollection.backgroundcolor) {
|
|
180
171
|
formatCollection.backgroundcolor = this.isBackgroundColor(node);
|
|
181
172
|
}
|
|
182
|
-
if (!formatCollection.orderedlist
|
|
173
|
+
if (!formatCollection.orderedlist) {
|
|
183
174
|
formatCollection.orderedlist = this.isOrderedList(node);
|
|
184
175
|
}
|
|
185
|
-
if (!formatCollection.unorderedlist
|
|
176
|
+
if (!formatCollection.unorderedlist) {
|
|
186
177
|
formatCollection.unorderedlist = this.isUnorderedList(node);
|
|
187
178
|
}
|
|
188
179
|
if (!formatCollection.alignments) {
|
|
@@ -197,10 +188,10 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
197
188
|
if (!formatCollection.createlink) {
|
|
198
189
|
formatCollection.createlink = this.isLink(node);
|
|
199
190
|
}
|
|
200
|
-
if (!formatCollection.numberFormatList
|
|
191
|
+
if (!formatCollection.numberFormatList) {
|
|
201
192
|
formatCollection.numberFormatList = this.isNumberFormatList(node);
|
|
202
193
|
}
|
|
203
|
-
if (!formatCollection.bulletFormatList
|
|
194
|
+
if (!formatCollection.bulletFormatList) {
|
|
204
195
|
formatCollection.bulletFormatList = this.isBulletFormatList(node);
|
|
205
196
|
}
|
|
206
197
|
return formatCollection;
|
|
@@ -259,8 +250,7 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
259
250
|
// eslint-disable-next-line
|
|
260
251
|
var pattern = new RegExp(name, 'i');
|
|
261
252
|
if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
|
|
262
|
-
(value.split(',')[0] &&
|
|
263
|
-
value.split(',')[0].trim() === value.split(',')[0].trim().match(pattern)[0])) {
|
|
253
|
+
(value.split(',')[0] && value.split(',')[0].search(pattern) > -1)) {
|
|
264
254
|
index = pos;
|
|
265
255
|
}
|
|
266
256
|
}) && (index !== null)))) {
|