@syncfusion/ej2-richtexteditor 23.2.7-52849 → 24.1.41-569781
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/.eslintrc.json +260 -0
- package/CHANGELOG.md +177 -1
- 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 +2919 -1147
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +2906 -1133
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/package.json +13 -13
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +12 -1
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/interface.d.ts +12 -0
- package/src/common/types.d.ts +6 -0
- package/src/common/util.d.ts +6 -0
- package/src/common/util.js +61 -20
- package/src/editor-manager/base/constant.d.ts +6 -0
- package/src/editor-manager/base/constant.js +6 -0
- package/src/editor-manager/base/editor-manager.d.ts +5 -0
- package/src/editor-manager/base/editor-manager.js +59 -0
- package/src/editor-manager/base/interface.d.ts +8 -0
- package/src/editor-manager/plugin/audio.js +13 -3
- package/src/editor-manager/plugin/dom-node.d.ts +5 -1
- package/src/editor-manager/plugin/dom-node.js +169 -28
- package/src/editor-manager/plugin/format-painter-actions.d.ts +1 -0
- package/src/editor-manager/plugin/format-painter-actions.js +19 -1
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +38 -3
- package/src/editor-manager/plugin/image.js +38 -15
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +67 -7
- package/src/editor-manager/plugin/link.js +4 -1
- package/src/editor-manager/plugin/lists.js +121 -65
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +3 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +215 -85
- package/src/editor-manager/plugin/nodecutter.js +2 -2
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +165 -3
- package/src/editor-manager/plugin/table.d.ts +0 -1
- package/src/editor-manager/plugin/table.js +33 -30
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +20 -10
- package/src/editor-manager/plugin/undo.d.ts +1 -0
- package/src/editor-manager/plugin/undo.js +21 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-quick-toolbar.js +66 -15
- package/src/rich-text-editor/actions/base-toolbar.js +32 -34
- package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
- package/src/rich-text-editor/actions/color-picker.js +13 -3
- package/src/rich-text-editor/actions/count.js +1 -1
- package/src/rich-text-editor/actions/dropdown-buttons.js +25 -4
- package/src/rich-text-editor/actions/emoji-picker.js +15 -6
- package/src/rich-text-editor/actions/enter-key.js +6 -4
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +1 -1
- package/src/rich-text-editor/actions/full-screen.js +5 -4
- package/src/rich-text-editor/actions/html-editor.d.ts +2 -0
- package/src/rich-text-editor/actions/html-editor.js +127 -17
- package/src/rich-text-editor/actions/keyboard.js +3 -1
- package/src/rich-text-editor/actions/markdown-editor.js +3 -1
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +5 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +156 -28
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +7 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +45 -11
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/toolbar.js +35 -96
- package/src/rich-text-editor/base/classes.d.ts +5 -5
- package/src/rich-text-editor/base/classes.js +5 -5
- package/src/rich-text-editor/base/constant.d.ts +46 -1
- package/src/rich-text-editor/base/constant.js +215 -1
- package/src/rich-text-editor/base/interface.d.ts +47 -3
- 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 +16 -4
- package/src/rich-text-editor/base/rich-text-editor.js +196 -100
- package/src/rich-text-editor/base/util.d.ts +4 -0
- package/src/rich-text-editor/base/util.js +57 -5
- package/src/rich-text-editor/formatter/formatter.js +15 -4
- package/src/rich-text-editor/models/default-locale.js +31 -25
- package/src/rich-text-editor/models/items.js +3 -3
- 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 +1 -0
- package/src/rich-text-editor/renderer/audio-module.js +13 -0
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +2 -0
- package/src/rich-text-editor/renderer/dialog-renderer.js +22 -2
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
- package/src/rich-text-editor/renderer/image-module.d.ts +9 -1
- package/src/rich-text-editor/renderer/image-module.js +244 -212
- package/src/rich-text-editor/renderer/link-module.js +53 -24
- package/src/rich-text-editor/renderer/table-module.d.ts +10 -1
- package/src/rich-text-editor/renderer/table-module.js +330 -165
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +4 -6
- package/src/rich-text-editor/renderer/toolbar-renderer.js +105 -106
- package/src/rich-text-editor/renderer/video-module.d.ts +3 -0
- package/src/rich-text-editor/renderer/video-module.js +61 -34
- package/src/rich-text-editor/renderer/view-source.d.ts +1 -0
- package/src/rich-text-editor/renderer/view-source.js +15 -5
- package/src/selection/selection.js +3 -0
- package/styles/bootstrap-dark.css +345 -99
- package/styles/bootstrap.css +353 -108
- package/styles/bootstrap4.css +337 -95
- package/styles/bootstrap5-dark.css +343 -96
- package/styles/bootstrap5.css +343 -96
- package/styles/fabric-dark.css +331 -89
- package/styles/fabric.css +332 -90
- package/styles/fluent-dark.css +342 -92
- package/styles/fluent.css +342 -92
- package/styles/highcontrast-light.css +331 -89
- package/styles/highcontrast.css +335 -90
- package/styles/material-dark.css +337 -90
- package/styles/material.css +337 -90
- package/styles/material3-dark.css +347 -99
- package/styles/material3.css +347 -99
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +14 -10
- package/styles/rich-text-editor/_bootstrap-definition.scss +20 -17
- package/styles/rich-text-editor/_bootstrap4-definition.scss +11 -7
- package/styles/rich-text-editor/_bootstrap5-definition.scss +8 -4
- package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -2
- package/styles/rich-text-editor/_fabric-definition.scss +7 -3
- package/styles/rich-text-editor/_fluent-definition.scss +9 -5
- package/styles/rich-text-editor/_fusionnew-definition.scss +7 -3
- package/styles/rich-text-editor/_highcontrast-definition.scss +7 -3
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -2
- package/styles/rich-text-editor/_layout.scss +208 -31
- package/styles/rich-text-editor/_material-dark-definition.scss +6 -2
- package/styles/rich-text-editor/_material-definition.scss +6 -2
- package/styles/rich-text-editor/_material3-definition.scss +16 -12
- package/styles/rich-text-editor/_tailwind-definition.scss +25 -21
- package/styles/rich-text-editor/_theme.scss +93 -24
- package/styles/rich-text-editor/bootstrap-dark.css +345 -99
- package/styles/rich-text-editor/bootstrap.css +353 -108
- package/styles/rich-text-editor/bootstrap4.css +337 -95
- package/styles/rich-text-editor/bootstrap5-dark.css +343 -96
- package/styles/rich-text-editor/bootstrap5.css +343 -96
- package/styles/rich-text-editor/fabric-dark.css +331 -89
- package/styles/rich-text-editor/fabric.css +332 -90
- package/styles/rich-text-editor/fluent-dark.css +342 -92
- package/styles/rich-text-editor/fluent.css +342 -92
- package/styles/rich-text-editor/highcontrast-light.css +331 -89
- package/styles/rich-text-editor/highcontrast.css +335 -90
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap4.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap5.scss +4 -4
- package/styles/rich-text-editor/icons/_fabric-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_fabric.scss +4 -4
- package/styles/rich-text-editor/icons/_fluent.scss +4 -4
- package/styles/rich-text-editor/icons/_fusionnew.scss +3 -3
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +4 -4
- package/styles/rich-text-editor/icons/_highcontrast.scss +4 -4
- package/styles/rich-text-editor/icons/_material-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_material.scss +4 -4
- package/styles/rich-text-editor/icons/_material3.scss +4 -4
- package/styles/rich-text-editor/icons/_tailwind.scss +4 -4
- package/styles/rich-text-editor/material-dark.css +337 -90
- package/styles/rich-text-editor/material.css +337 -90
- package/styles/rich-text-editor/material3-dark.css +347 -99
- package/styles/rich-text-editor/material3.css +347 -99
- package/styles/rich-text-editor/tailwind-dark.css +386 -116
- package/styles/rich-text-editor/tailwind.css +386 -116
- package/styles/tailwind-dark.css +386 -116
- package/styles/tailwind.css +386 -116
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
- package/src/global.d.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
|
|
1
|
+
import { createElement, detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
|
|
2
2
|
import { isNullOrUndefined, EventHandler, addClass, removeClass } from '@syncfusion/ej2-base';
|
|
3
3
|
import { Popup } from '@syncfusion/ej2-popups';
|
|
4
4
|
import { Button } from '@syncfusion/ej2-buttons';
|
|
@@ -17,7 +17,7 @@ var Table = /** @class */ (function () {
|
|
|
17
17
|
this.pageY = null;
|
|
18
18
|
this.moveEle = null;
|
|
19
19
|
this.currentColumnResize = '';
|
|
20
|
-
this.
|
|
20
|
+
this.resizeEndTime = 0;
|
|
21
21
|
this.parent = parent;
|
|
22
22
|
this.rteID = parent.element.id;
|
|
23
23
|
this.l10n = serviceLocator.getService('rteLocale');
|
|
@@ -35,6 +35,7 @@ var Table = /** @class */ (function () {
|
|
|
35
35
|
this.parent.on(events.showTableDialog, this.showDialog, this);
|
|
36
36
|
this.parent.on(events.closeTableDialog, this.closeDialog, this);
|
|
37
37
|
this.parent.on(events.docClick, this.docClick, this);
|
|
38
|
+
this.parent.on(events.iframeMouseDown, this.onIframeMouseDown, this);
|
|
38
39
|
this.parent.on(events.editAreaClick, this.editAreaClickHandler, this);
|
|
39
40
|
this.parent.on(events.clearDialogObj, this.clearDialogObj, this);
|
|
40
41
|
this.parent.on(events.tableToolbarAction, this.onToolbarAction, this);
|
|
@@ -46,6 +47,7 @@ var Table = /** @class */ (function () {
|
|
|
46
47
|
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
47
48
|
this.parent.on(events.destroy, this.destroy, this);
|
|
48
49
|
this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
|
|
50
|
+
this.parent.on(events.afterKeyDown, this.afterKeyDown, this);
|
|
49
51
|
};
|
|
50
52
|
Table.prototype.removeEventListener = function () {
|
|
51
53
|
if (this.parent.isDestroyed) {
|
|
@@ -55,6 +57,7 @@ var Table = /** @class */ (function () {
|
|
|
55
57
|
this.parent.off(events.initialEnd, this.afterRender);
|
|
56
58
|
this.parent.off(events.dynamicModule, this.afterRender);
|
|
57
59
|
this.parent.off(events.docClick, this.docClick);
|
|
60
|
+
this.parent.off(events.iframeMouseDown, this.onIframeMouseDown);
|
|
58
61
|
this.parent.off(events.showTableDialog, this.showDialog);
|
|
59
62
|
this.parent.off(events.closeTableDialog, this.closeDialog);
|
|
60
63
|
this.parent.off(events.editAreaClick, this.editAreaClickHandler);
|
|
@@ -63,13 +66,14 @@ var Table = /** @class */ (function () {
|
|
|
63
66
|
this.parent.off(events.dropDownSelect, this.dropdownSelect);
|
|
64
67
|
this.parent.off(events.mouseDown, this.cellSelect);
|
|
65
68
|
this.parent.off(events.tableColorPickerChanged, this.setBGColor);
|
|
66
|
-
this.parent.off(events.keyUp, this.keyUp);
|
|
67
69
|
this.parent.off(events.keyDown, this.keyDown);
|
|
70
|
+
this.parent.off(events.keyUp, this.keyUp);
|
|
68
71
|
this.parent.off(events.mouseUp, this.selectionTable);
|
|
69
72
|
this.parent.off(events.tableModulekeyUp, this.tableModulekeyUp);
|
|
70
73
|
this.parent.off(events.bindCssClass, this.setCssClass);
|
|
71
74
|
this.parent.off(events.destroy, this.destroy);
|
|
72
75
|
this.parent.off(events.moduleDestroy, this.moduleDestroy);
|
|
76
|
+
this.parent.off(events.afterKeyDown, this.afterKeyDown);
|
|
73
77
|
if (!Browser.isDevice && this.parent.tableSettings.resize) {
|
|
74
78
|
EventHandler.remove(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper);
|
|
75
79
|
}
|
|
@@ -171,7 +175,15 @@ var Table = /** @class */ (function () {
|
|
|
171
175
|
Table.prototype.keyUp = function (e) {
|
|
172
176
|
var target = e.args.target;
|
|
173
177
|
if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + "'" + this.popupObj.element.id + "'" + ']')) && this.popupObj) {
|
|
178
|
+
var createTableToolbarBtn = this.popupObj.relateTo;
|
|
179
|
+
if (createTableToolbarBtn.nodeName !== 'BUTTON') {
|
|
180
|
+
createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
|
|
181
|
+
createTableToolbarBtn = createTableToolbarBtn.parentElement;
|
|
182
|
+
}
|
|
174
183
|
this.popupObj.hide();
|
|
184
|
+
if (createTableToolbarBtn) {
|
|
185
|
+
createTableToolbarBtn.focus();
|
|
186
|
+
}
|
|
175
187
|
}
|
|
176
188
|
};
|
|
177
189
|
Table.prototype.keyDown = function (e) {
|
|
@@ -227,6 +239,14 @@ var Table = /** @class */ (function () {
|
|
|
227
239
|
}
|
|
228
240
|
}
|
|
229
241
|
}
|
|
242
|
+
if (event.ctrlKey && event.key === 'a') {
|
|
243
|
+
this.handleSelectAll();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
Table.prototype.handleSelectAll = function () {
|
|
247
|
+
this.cancelResizeAction();
|
|
248
|
+
var selectedCells = this.parent.inputElement.querySelectorAll('.' + classes.CLS_TABLE_SEL);
|
|
249
|
+
removeClass(selectedCells, classes.CLS_TABLE_SEL);
|
|
230
250
|
};
|
|
231
251
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
232
252
|
Table.prototype.tableModulekeyUp = function (e) {
|
|
@@ -264,7 +284,7 @@ var Table = /** @class */ (function () {
|
|
|
264
284
|
};
|
|
265
285
|
Table.prototype.showDialog = function () {
|
|
266
286
|
this.openDialog(false);
|
|
267
|
-
this.setCssClass({ cssClass: this.parent.
|
|
287
|
+
this.setCssClass({ cssClass: this.parent.getCssClass() });
|
|
268
288
|
};
|
|
269
289
|
Table.prototype.closeDialog = function () {
|
|
270
290
|
if (this.editdlgObj) {
|
|
@@ -343,7 +363,20 @@ var Table = /** @class */ (function () {
|
|
|
343
363
|
return false;
|
|
344
364
|
}
|
|
345
365
|
};
|
|
366
|
+
Table.prototype.removeEmptyTextNodes = function (element) {
|
|
367
|
+
var children = element.childNodes;
|
|
368
|
+
for (var i = children.length - 1; i >= 0; i--) {
|
|
369
|
+
var node = children[i];
|
|
370
|
+
if (node.nodeType === Node.TEXT_NODE && node.nodeValue.trim() === '') {
|
|
371
|
+
element.removeChild(node);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
346
375
|
Table.prototype.tabSelection = function (event, selection, ele) {
|
|
376
|
+
var allHeadBodyTRElements = ele.closest('table').querySelectorAll('thead, tbody, tr');
|
|
377
|
+
for (var i = 0; i < allHeadBodyTRElements.length; i++) {
|
|
378
|
+
this.removeEmptyTextNodes(allHeadBodyTRElements[i]);
|
|
379
|
+
}
|
|
347
380
|
this.previousTableElement = ele;
|
|
348
381
|
var insideList = this.insideList(selection.range);
|
|
349
382
|
if ((event.keyCode === 37 || event.keyCode === 39) && selection.range.startContainer.nodeType === 3 ||
|
|
@@ -454,6 +487,10 @@ var Table = /** @class */ (function () {
|
|
|
454
487
|
Table.prototype.tableHeader = function (selection, e) {
|
|
455
488
|
this.parent.formatter.process(this.parent, e, e.originalEvent, { selection: selection, subCommand: e.item.subCommand });
|
|
456
489
|
};
|
|
490
|
+
Table.prototype.getAnchorNode = function (element) {
|
|
491
|
+
var selectParent = closest(element, 'a');
|
|
492
|
+
return (selectParent ? selectParent : element);
|
|
493
|
+
};
|
|
457
494
|
Table.prototype.editAreaClickHandler = function (e) {
|
|
458
495
|
if (this.parent.readonly || !isNOU(closest(e.args.target, '.e-img-caption'))) {
|
|
459
496
|
return;
|
|
@@ -475,10 +512,13 @@ var Table = /** @class */ (function () {
|
|
|
475
512
|
var closestTable = closest(target, 'table');
|
|
476
513
|
var startNode = this.parent.getRange().startContainer.parentElement;
|
|
477
514
|
var endNode = this.parent.getRange().endContainer.parentElement;
|
|
478
|
-
|
|
515
|
+
var isAnchorEle = this.getAnchorNode(target);
|
|
516
|
+
var currentTime = new Date().getTime();
|
|
517
|
+
if (target && target.nodeName !== 'A' && isAnchorEle.nodeName !== 'A' && target.nodeName !== 'IMG' && target.nodeName !== 'VIDEO' && !target.classList.contains(classes.CLS_CLICKELEM) &&
|
|
479
518
|
target.nodeName !== 'AUDIO' && startNode === endNode && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
|
|
480
519
|
target.nodeName === 'TABLE' || (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable)))
|
|
481
|
-
&& !(range.startContainer.nodeType === 3 && !range.collapsed)
|
|
520
|
+
&& !(range.startContainer.nodeType === 3 && !range.collapsed) &&
|
|
521
|
+
currentTime - this.resizeEndTime > 100) {
|
|
482
522
|
var range_1 = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
|
|
483
523
|
this.parent.formatter.editorManager.nodeSelection.save(range_1, this.contentModule.getDocument());
|
|
484
524
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
@@ -574,7 +614,10 @@ var Table = /** @class */ (function () {
|
|
|
574
614
|
var tdNode = closest(target, 'td,th');
|
|
575
615
|
target = (target.nodeName !== 'TD' && tdNode && this.parent.contentModule.getEditPanel().contains(tdNode)) ?
|
|
576
616
|
tdNode : target;
|
|
577
|
-
|
|
617
|
+
if (!(this.parent.quickToolbarSettings.showOnRightClick && e.args.which === 3 &&
|
|
618
|
+
target.classList.contains(classes.CLS_TABLE_SEL))) {
|
|
619
|
+
removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), classes.CLS_TABLE_SEL);
|
|
620
|
+
}
|
|
578
621
|
if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
|
|
579
622
|
addClass([target], classes.CLS_TABLE_SEL);
|
|
580
623
|
this.activeCell = target;
|
|
@@ -599,7 +642,7 @@ var Table = /** @class */ (function () {
|
|
|
599
642
|
return;
|
|
600
643
|
}
|
|
601
644
|
var target = e.target || e.targetTouches[0].target;
|
|
602
|
-
var closestTable = closest(target, 'table.e-rte-table');
|
|
645
|
+
var closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
|
|
603
646
|
if (!isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable &&
|
|
604
647
|
this.parent.contentModule.getEditPanel().contains(closestTable)) {
|
|
605
648
|
this.removeResizeElement();
|
|
@@ -616,7 +659,7 @@ var Table = /** @class */ (function () {
|
|
|
616
659
|
};
|
|
617
660
|
Table.prototype.tableResizeEleCreation = function (table, e) {
|
|
618
661
|
this.parent.preventDefaultResize(e);
|
|
619
|
-
var columns =
|
|
662
|
+
var columns = this.calMaxCol(this.curTable);
|
|
620
663
|
var rows = [];
|
|
621
664
|
for (var i = 0; i < table.rows.length; i++) {
|
|
622
665
|
for (var j = 0; j < table.rows[i].cells.length; j++) {
|
|
@@ -638,11 +681,11 @@ var Table = /** @class */ (function () {
|
|
|
638
681
|
colReEle.classList.add(classes.CLS_RTE_TABLE_RESIZE, classes.CLS_TB_COL_RES);
|
|
639
682
|
if (columns.length === i) {
|
|
640
683
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
641
|
-
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
|
|
684
|
+
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
|
|
642
685
|
}
|
|
643
686
|
else {
|
|
644
687
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
645
|
-
'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
|
|
688
|
+
'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
|
|
646
689
|
}
|
|
647
690
|
this.contentModule.getEditPanel().appendChild(colReEle);
|
|
648
691
|
}
|
|
@@ -661,7 +704,7 @@ var Table = /** @class */ (function () {
|
|
|
661
704
|
this.contentModule.getEditPanel().appendChild(rowReEle);
|
|
662
705
|
}
|
|
663
706
|
var tableReBox = this.parent.createElement('span', {
|
|
664
|
-
className: classes.CLS_TB_BOX_RES +
|
|
707
|
+
className: classes.CLS_TB_BOX_RES + this.parent.getCssClass(true), attrs: {
|
|
665
708
|
'data-col': columns.length.toString(), 'unselectable': 'on', 'contenteditable': 'false'
|
|
666
709
|
}
|
|
667
710
|
});
|
|
@@ -674,7 +717,7 @@ var Table = /** @class */ (function () {
|
|
|
674
717
|
};
|
|
675
718
|
Table.prototype.removeResizeElement = function () {
|
|
676
719
|
var item = this.parent.contentModule.getEditPanel().
|
|
677
|
-
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box
|
|
720
|
+
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
|
|
678
721
|
if (item.length > 0) {
|
|
679
722
|
for (var i = 0; i < item.length; i++) {
|
|
680
723
|
detach(item[i]);
|
|
@@ -748,6 +791,7 @@ var Table = /** @class */ (function () {
|
|
|
748
791
|
if (target.classList.contains(classes.CLS_TB_COL_RES) ||
|
|
749
792
|
target.classList.contains(classes.CLS_TB_ROW_RES) ||
|
|
750
793
|
target.classList.contains(classes.CLS_TB_BOX_RES)) {
|
|
794
|
+
this.resetResizeHelper(this.curTable);
|
|
751
795
|
e.preventDefault();
|
|
752
796
|
this.parent.preventDefaultResize(e);
|
|
753
797
|
removeClass(this.curTable.querySelectorAll('td,th'), classes.CLS_TABLE_SEL);
|
|
@@ -758,9 +802,10 @@ var Table = /** @class */ (function () {
|
|
|
758
802
|
this.hideTableQuickToolbar();
|
|
759
803
|
if (target.classList.contains(classes.CLS_TB_COL_RES)) {
|
|
760
804
|
this.resizeBtnStat.column = true;
|
|
761
|
-
if (parseInt(target.getAttribute('data-col'), 10) === this.
|
|
805
|
+
if (parseInt(target.getAttribute('data-col'), 10) === this.calMaxCol(this.curTable).length) {
|
|
762
806
|
this.currentColumnResize = 'last';
|
|
763
|
-
this.
|
|
807
|
+
this.colIndex = parseInt(target.getAttribute('data-col'), 10) - 1;
|
|
808
|
+
this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
|
|
764
809
|
}
|
|
765
810
|
else {
|
|
766
811
|
if (parseInt(target.getAttribute('data-col'), 10) === 0) {
|
|
@@ -768,10 +813,48 @@ var Table = /** @class */ (function () {
|
|
|
768
813
|
}
|
|
769
814
|
else {
|
|
770
815
|
this.currentColumnResize = 'middle';
|
|
816
|
+
var cellColl = this.curTable.rows[0].cells;
|
|
817
|
+
var cellCount = 0;
|
|
818
|
+
for (var cell = 0; cell < cellColl.length; cell++) {
|
|
819
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
820
|
+
}
|
|
821
|
+
var sizes = new Array(cellCount);
|
|
822
|
+
var colGroupEle = createElement('colgroup');
|
|
823
|
+
var rowSpanCells = new Map();
|
|
824
|
+
for (var i = 0; i < this.curTable.rows.length; i++) {
|
|
825
|
+
var currentColIndex = 0;
|
|
826
|
+
for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
827
|
+
for (var l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
|
|
828
|
+
var key = "" + (i + l) + currentColIndex;
|
|
829
|
+
rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
|
|
830
|
+
}
|
|
831
|
+
var cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
832
|
+
if (cellIndex > currentColIndex) {
|
|
833
|
+
currentColIndex = cellIndex;
|
|
834
|
+
}
|
|
835
|
+
var width = this.curTable.rows[i].cells[k].offsetWidth;
|
|
836
|
+
if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
|
|
837
|
+
sizes[currentColIndex] = width;
|
|
838
|
+
}
|
|
839
|
+
currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
for (var size = 0; size < sizes.length; size++) {
|
|
843
|
+
var cell = createElement('col');
|
|
844
|
+
cell.appendChild(createElement('br'));
|
|
845
|
+
cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
|
|
846
|
+
colGroupEle.appendChild(cell);
|
|
847
|
+
}
|
|
848
|
+
this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
|
|
849
|
+
for (var i = 0; i < this.curTable.rows.length; i++) {
|
|
850
|
+
for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
851
|
+
this.curTable.rows[i].cells[k].style.width = '';
|
|
852
|
+
}
|
|
853
|
+
}
|
|
771
854
|
}
|
|
772
|
-
this.
|
|
855
|
+
this.colIndex = parseInt(target.getAttribute('data-col'), 10);
|
|
856
|
+
this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
|
|
773
857
|
}
|
|
774
|
-
this.colIndex = this.columnEle.cellIndex;
|
|
775
858
|
this.moveEle = e.target;
|
|
776
859
|
this.appendHelper();
|
|
777
860
|
}
|
|
@@ -800,6 +883,16 @@ var Table = /** @class */ (function () {
|
|
|
800
883
|
EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
|
|
801
884
|
}
|
|
802
885
|
};
|
|
886
|
+
Table.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
|
|
887
|
+
var cellKey = "" + rowIndex + colIndex;
|
|
888
|
+
var spannedCell = rowSpanCells.get(cellKey);
|
|
889
|
+
if (spannedCell) {
|
|
890
|
+
return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
return colIndex;
|
|
894
|
+
}
|
|
895
|
+
};
|
|
803
896
|
Table.prototype.removeHelper = function (e) {
|
|
804
897
|
var cls = e.target.classList;
|
|
805
898
|
if (!(cls.contains('e-reicon')) && this.helper) {
|
|
@@ -814,7 +907,7 @@ var Table = /** @class */ (function () {
|
|
|
814
907
|
};
|
|
815
908
|
Table.prototype.appendHelper = function () {
|
|
816
909
|
this.helper = this.parent.createElement('div', {
|
|
817
|
-
className: 'e-table-rhelper' +
|
|
910
|
+
className: 'e-table-rhelper' + this.parent.getCssClass(true)
|
|
818
911
|
});
|
|
819
912
|
if (Browser.isDevice) {
|
|
820
913
|
this.helper.classList.add('e-reicon');
|
|
@@ -828,12 +921,12 @@ var Table = /** @class */ (function () {
|
|
|
828
921
|
this.helper.classList.add('e-column-helper');
|
|
829
922
|
this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
|
|
830
923
|
pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
|
|
831
|
-
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth
|
|
924
|
+
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
|
|
832
925
|
}
|
|
833
926
|
else {
|
|
834
927
|
this.helper.classList.add('e-row-helper');
|
|
835
928
|
this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
|
|
836
|
-
(this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
|
|
929
|
+
(this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
|
|
837
930
|
'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
|
|
838
931
|
}
|
|
839
932
|
};
|
|
@@ -841,24 +934,42 @@ var Table = /** @class */ (function () {
|
|
|
841
934
|
var pos = this.calcPos(this.curTable);
|
|
842
935
|
if (this.resizeBtnStat.column) {
|
|
843
936
|
var left = (pos.left + this.calcPos(this.columnEle).left) +
|
|
844
|
-
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth
|
|
937
|
+
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
|
|
845
938
|
this.helper.style.left = left + 'px';
|
|
939
|
+
this.helper.style.height = this.curTable.offsetHeight + 'px';
|
|
846
940
|
}
|
|
847
941
|
else {
|
|
848
|
-
var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
|
|
942
|
+
var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
|
|
849
943
|
this.helper.style.top = top_1 + 'px';
|
|
850
944
|
}
|
|
851
945
|
};
|
|
852
|
-
Table.prototype.calMaxCol = function (
|
|
853
|
-
var
|
|
854
|
-
var
|
|
855
|
-
for (var
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
946
|
+
Table.prototype.calMaxCol = function (curTable) {
|
|
947
|
+
var cellColl = curTable.rows[0].cells;
|
|
948
|
+
var cellCount = 0;
|
|
949
|
+
for (var cell = 0; cell < cellColl.length; cell++) {
|
|
950
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
951
|
+
}
|
|
952
|
+
var cells = new Array(cellCount);
|
|
953
|
+
var rowSpanCells = new Map();
|
|
954
|
+
for (var i = 0; i < curTable.rows.length; i++) {
|
|
955
|
+
var currentColIndex = 0;
|
|
956
|
+
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
957
|
+
for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
|
|
958
|
+
var key = "" + (i + l) + currentColIndex;
|
|
959
|
+
rowSpanCells.set(key, curTable.rows[i].cells[k]);
|
|
960
|
+
}
|
|
961
|
+
var cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
962
|
+
if (cellIndex > currentColIndex) {
|
|
963
|
+
currentColIndex = cellIndex;
|
|
964
|
+
}
|
|
965
|
+
var width = curTable.rows[i].cells[k].offsetWidth;
|
|
966
|
+
if (!cells[currentColIndex] || width < cells[currentColIndex].offsetWidth) {
|
|
967
|
+
cells[currentColIndex] = curTable.rows[i].cells[k];
|
|
968
|
+
}
|
|
969
|
+
currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
|
|
859
970
|
}
|
|
860
971
|
}
|
|
861
|
-
return
|
|
972
|
+
return cells;
|
|
862
973
|
};
|
|
863
974
|
Table.prototype.resizing = function (e) {
|
|
864
975
|
var _this = this;
|
|
@@ -871,10 +982,6 @@ var Table = /** @class */ (function () {
|
|
|
871
982
|
var maxiumWidth;
|
|
872
983
|
var currentTdElement = this.curTable.closest('td');
|
|
873
984
|
var args = { event: e, requestType: 'table' };
|
|
874
|
-
var isRowCellsMerged = false;
|
|
875
|
-
var isColCellsMerged = false;
|
|
876
|
-
var mergedCellIndex;
|
|
877
|
-
var mergedElement;
|
|
878
985
|
this.parent.trigger(events.onResize, args, function (resizingArgs) {
|
|
879
986
|
if (resizingArgs.cancel) {
|
|
880
987
|
_this.cancelResizeAction();
|
|
@@ -899,8 +1006,10 @@ var Table = /** @class */ (function () {
|
|
|
899
1006
|
widthCompare = rteWidth;
|
|
900
1007
|
}
|
|
901
1008
|
if (_this.resizeBtnStat.column) {
|
|
902
|
-
|
|
903
|
-
|
|
1009
|
+
if (_this.curTable.closest('li')) {
|
|
1010
|
+
widthCompare = _this.curTable.closest('li').offsetWidth;
|
|
1011
|
+
}
|
|
1012
|
+
var colGroup = _this.curTable.querySelectorAll('colgroup > col');
|
|
904
1013
|
var currentTableWidth = void 0;
|
|
905
1014
|
if (_this.curTable.style.width !== '' && _this.curTable.style.width.includes('%')) {
|
|
906
1015
|
currentTableWidth = parseFloat(_this.curTable.style.width.split('%')[0]);
|
|
@@ -908,7 +1017,8 @@ var Table = /** @class */ (function () {
|
|
|
908
1017
|
else {
|
|
909
1018
|
currentTableWidth = _this.getCurrentTableWidth(_this.curTable.offsetWidth, _this.parent.inputElement.offsetWidth);
|
|
910
1019
|
}
|
|
911
|
-
var
|
|
1020
|
+
var currentCol = _this.calMaxCol(_this.curTable)[_this.colIndex];
|
|
1021
|
+
var currentColResizableWidth = _this.getCurrentColWidth(currentCol, tableWidth);
|
|
912
1022
|
if (_this.currentColumnResize === 'first') {
|
|
913
1023
|
mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
|
|
914
1024
|
_this.removeResizeElement();
|
|
@@ -917,16 +1027,43 @@ var Table = /** @class */ (function () {
|
|
|
917
1027
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
918
1028
|
}
|
|
919
1029
|
// Below the value '100' is the 100% width of the parent element.
|
|
920
|
-
if (((mouseX !== 0 && 5 <
|
|
1030
|
+
if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX < 0) && currentTableWidth <= 100 &&
|
|
921
1031
|
_this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) <= 100) {
|
|
922
1032
|
var firstColumnsCell = _this.findFirstLastColCells(_this.curTable, true);
|
|
923
1033
|
_this.curTable.style.width = _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) > 100 ? (100 + '%') :
|
|
924
1034
|
(_this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) + '%');
|
|
925
1035
|
var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare);
|
|
926
|
-
|
|
927
|
-
|
|
1036
|
+
var preMarginLeft = 0;
|
|
1037
|
+
var widthType = _this.curTable.style.width.indexOf('%') > -1;
|
|
1038
|
+
if (!widthType && _this.curTable.offsetWidth > _this.contentModule.getEditPanel().offsetWidth) {
|
|
1039
|
+
_this.curTable.style.width = rteWidth + 'px';
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
if (widthType && parseFloat(_this.curTable.style.width.split('%')[0]) > 100) {
|
|
1043
|
+
_this.curTable.style.width = '100%';
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
if (!isNOU(_this.curTable.style.marginLeft) && _this.curTable.style.marginLeft !== '') {
|
|
1047
|
+
var regex = /[-+]?\d*\.\d+|\d+/;
|
|
1048
|
+
var value = _this.curTable.style.marginLeft.match(regex);
|
|
1049
|
+
if (!isNOU(value)) {
|
|
1050
|
+
preMarginLeft = parseFloat(value[0]);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
var currentMarginLeft = preMarginLeft + differenceWidth;
|
|
1054
|
+
if (currentMarginLeft && currentMarginLeft > 100) {
|
|
1055
|
+
var width = parseFloat(_this.curTable.style.width);
|
|
1056
|
+
currentMarginLeft = 100 - width;
|
|
1057
|
+
}
|
|
1058
|
+
if (currentMarginLeft && currentMarginLeft < 1) {
|
|
1059
|
+
_this.curTable.style.marginLeft = null;
|
|
1060
|
+
_this.curTable.style.width = '100%';
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
_this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : currentMarginLeft) + '%)';
|
|
928
1064
|
for (var i = 0; i < firstColumnsCell.length; i++) {
|
|
929
|
-
_this.
|
|
1065
|
+
var currentColumnCellWidth = _this.getCurrentColWidth(firstColumnsCell[i], tableWidth);
|
|
1066
|
+
firstColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
930
1067
|
}
|
|
931
1068
|
}
|
|
932
1069
|
}
|
|
@@ -938,112 +1075,48 @@ var Table = /** @class */ (function () {
|
|
|
938
1075
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
939
1076
|
}
|
|
940
1077
|
// Below the value '100' is the 100% width of the parent element.
|
|
941
|
-
if (((mouseX !== 0 && 5 <
|
|
1078
|
+
if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX > 0) &&
|
|
942
1079
|
currentTableWidth <= 100 && _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
|
|
943
1080
|
var lastColumnsCell = _this.findFirstLastColCells(_this.curTable, false);
|
|
944
1081
|
_this.curTable.style.width = _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) > 100 ? (100 + '%') : (_this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%');
|
|
945
1082
|
var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
|
|
946
1083
|
for (var i = 0; i < lastColumnsCell.length; i++) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
_this.colIndex - 1 : _this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
950
|
-
}
|
|
1084
|
+
var currentColumnCellWidth = _this.getCurrentColWidth(lastColumnsCell[i], tableWidth);
|
|
1085
|
+
lastColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
951
1086
|
}
|
|
952
1087
|
}
|
|
953
1088
|
}
|
|
954
1089
|
else {
|
|
955
|
-
var
|
|
956
|
-
|
|
957
|
-
var totalwid =
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
var
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
var rightColWidth = actualwid;
|
|
964
|
-
var index = void 0;
|
|
965
|
-
var isMergedEleResize = false;
|
|
966
|
-
var leftTableCell = void 0;
|
|
967
|
-
var rightTableCell = void 0;
|
|
968
|
-
isColCellsMerged = false;
|
|
969
|
-
isRowCellsMerged = false;
|
|
970
|
-
/* eslint-disable */
|
|
971
|
-
for (var j = 0; j < currentRow.cells.length; j++) {
|
|
972
|
-
if (currentRow.cells[j].hasAttribute('rowspan') && j <= _this.colIndex) {
|
|
973
|
-
isRowCellsMerged = true;
|
|
974
|
-
mergedCellIndex = i;
|
|
975
|
-
mergedElement = currentRow.cells[j];
|
|
976
|
-
}
|
|
977
|
-
else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
|
|
978
|
-
isColCellsMerged = true;
|
|
979
|
-
mergedCellIndex = i;
|
|
980
|
-
mergedElement = currentRow.cells[j];
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
if (!isNOU(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
|
|
984
|
-
index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
|
|
985
|
-
}
|
|
986
|
-
else {
|
|
987
|
-
index = _this.colIndex;
|
|
988
|
-
}
|
|
989
|
-
if (isRowCellsMerged || isColCellsMerged) {
|
|
990
|
-
var currentResizeRow = void 0;
|
|
991
|
-
if (currentRow.cells.length < cellColl.length) {
|
|
992
|
-
index = currentRow.cells.length === _this.colIndex || currentRow === _this.curTable.rows[_this.curTable.rows.length - 1] ?
|
|
993
|
-
_this.colIndex - 1 : _this.colIndex;
|
|
994
|
-
currentResizeRow = _this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
|
|
995
|
-
mergedCellIndex : _this.colIndex - 1];
|
|
996
|
-
if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[_this.colIndex - 1] === mergedElement ||
|
|
997
|
-
currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
|
|
998
|
-
isMergedEleResize = true;
|
|
999
|
-
}
|
|
1000
|
-
else {
|
|
1001
|
-
isMergedEleResize = false;
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
else {
|
|
1005
|
-
index = _this.colIndex;
|
|
1006
|
-
}
|
|
1007
|
-
leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
|
|
1008
|
-
currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
|
|
1009
|
-
currentResizeRow.cells[_this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
|
|
1010
|
-
rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
|
|
1011
|
-
currentResizeRow.cells[_this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
|
|
1012
|
-
currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
|
|
1013
|
-
}
|
|
1014
|
-
if (!isNOU(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
|
|
1015
|
-
currentRow.cells[index - 1].style.width =
|
|
1016
|
-
_this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1017
|
-
}
|
|
1018
|
-
else {
|
|
1019
|
-
if (leftTableCell) {
|
|
1020
|
-
leftTableCell.style.width =
|
|
1021
|
-
_this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
if (!isNOU(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
|
|
1025
|
-
currentRow.cells[index].style.width =
|
|
1026
|
-
_this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1027
|
-
}
|
|
1028
|
-
else {
|
|
1029
|
-
if (rightTableCell) {
|
|
1030
|
-
rightTableCell.style.width =
|
|
1031
|
-
_this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
/* eslint-enable */
|
|
1035
|
-
}
|
|
1090
|
+
var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
|
|
1091
|
+
// eslint-disable-next-line
|
|
1092
|
+
var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
|
|
1093
|
+
if ((totalwid - actualwid) > 20 && actualwid > 20) {
|
|
1094
|
+
var leftColumnWidth = totalwid - actualwid;
|
|
1095
|
+
var rightColWidth = actualwid;
|
|
1096
|
+
colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1097
|
+
colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1036
1098
|
}
|
|
1037
1099
|
}
|
|
1038
1100
|
_this.updateHelper();
|
|
1039
1101
|
}
|
|
1040
1102
|
else if (_this.resizeBtnStat.row) {
|
|
1041
1103
|
_this.parent.preventDefaultResize(e);
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
|
|
1104
|
+
var tableTrElementPixel = [];
|
|
1105
|
+
var currentTableTrElement = _this.curTable.querySelectorAll('tr');
|
|
1106
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1107
|
+
if (_this.rowEle !== currentTableTrElement[i]) {
|
|
1108
|
+
tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
_this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + ((mouseY > 0) ? 0 : mouseY)) + 'px';
|
|
1112
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1113
|
+
if (_this.rowEle === currentTableTrElement[i]) {
|
|
1114
|
+
currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
|
|
1115
|
+
}
|
|
1116
|
+
else {
|
|
1117
|
+
currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
|
|
1118
|
+
}
|
|
1045
1119
|
}
|
|
1046
|
-
_this.curTable.style.height = '';
|
|
1047
1120
|
if (!isNOU(tableReBox)) {
|
|
1048
1121
|
tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
|
|
1049
1122
|
'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
|
|
@@ -1057,19 +1130,40 @@ var Table = /** @class */ (function () {
|
|
|
1057
1130
|
maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
|
|
1058
1131
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
1059
1132
|
}
|
|
1060
|
-
var widthType = _this.curTable.style.width.indexOf('%') > -1;
|
|
1061
|
-
_this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
|
|
1062
|
-
: tableWidth + mouseX + 'px';
|
|
1063
1133
|
_this.curTable.style.height = tableHeight + mouseY + 'px';
|
|
1064
1134
|
if (!isNOU(tableReBox)) {
|
|
1065
1135
|
tableReBox.classList.add('e-rbox-select');
|
|
1066
1136
|
tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
|
|
1067
1137
|
'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
|
|
1068
1138
|
}
|
|
1139
|
+
if (_this.curTable.closest('li')) {
|
|
1140
|
+
widthCompare = _this.curTable.closest('li').offsetWidth;
|
|
1141
|
+
}
|
|
1142
|
+
var widthType = _this.curTable.style.width.indexOf('%') > -1;
|
|
1143
|
+
if (widthType && parseFloat(_this.curTable.style.width.split('%')[0]) > 100) {
|
|
1144
|
+
_this.curTable.style.width = '100%';
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
if (!widthType && _this.curTable.offsetWidth > _this.contentModule.getEditPanel().offsetWidth) {
|
|
1148
|
+
_this.curTable.style.width = rteWidth + 'px';
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
_this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
|
|
1152
|
+
: tableWidth + mouseX + 'px';
|
|
1069
1153
|
}
|
|
1070
1154
|
}
|
|
1071
1155
|
});
|
|
1072
1156
|
};
|
|
1157
|
+
Table.prototype.getCurrentColWidth = function (col, tableWidth) {
|
|
1158
|
+
var currentColWidth = 0;
|
|
1159
|
+
if (col.style.width !== '' && col.style.width.includes('%')) {
|
|
1160
|
+
currentColWidth = parseFloat(col.style.width.split('%')[0]);
|
|
1161
|
+
}
|
|
1162
|
+
else {
|
|
1163
|
+
currentColWidth = this.convertPixelToPercentage(col.offsetWidth, tableWidth);
|
|
1164
|
+
}
|
|
1165
|
+
return currentColWidth;
|
|
1166
|
+
};
|
|
1073
1167
|
Table.prototype.getCurrentTableWidth = function (tableWidth, parentWidth) {
|
|
1074
1168
|
var currentTableWidth = 0;
|
|
1075
1169
|
currentTableWidth = tableWidth / parentWidth * 100;
|
|
@@ -1077,12 +1171,22 @@ var Table = /** @class */ (function () {
|
|
|
1077
1171
|
};
|
|
1078
1172
|
Table.prototype.findFirstLastColCells = function (table, isFirst) {
|
|
1079
1173
|
var resultColumns = [];
|
|
1080
|
-
var rows = table.
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1174
|
+
var rows = table.rows;
|
|
1175
|
+
var rowSpanCellIndexs = new Array();
|
|
1176
|
+
var _loop_1 = function (i) {
|
|
1177
|
+
var cellIndex = isFirst ? 0 : rows[i].cells.length - 1;
|
|
1178
|
+
var column = rows[i].cells[cellIndex];
|
|
1179
|
+
for (var rowSpan = 1; rowSpan < column.rowSpan; rowSpan++) {
|
|
1180
|
+
var key = i + rowSpan + "-" + cellIndex;
|
|
1181
|
+
rowSpanCellIndexs.push(key);
|
|
1182
|
+
}
|
|
1183
|
+
var spannedCellKey = i + "-" + cellIndex;
|
|
1184
|
+
if (rowSpanCellIndexs.length === 0 || (isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1) || (!isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1 && rowSpanCellIndexs.every(function (key) { return key.split('-')[0] !== i.toString(); }))) {
|
|
1185
|
+
resultColumns.push(column);
|
|
1085
1186
|
}
|
|
1187
|
+
};
|
|
1188
|
+
for (var i = 0; i < rows.length; i++) {
|
|
1189
|
+
_loop_1(i);
|
|
1086
1190
|
}
|
|
1087
1191
|
return resultColumns;
|
|
1088
1192
|
};
|
|
@@ -1106,12 +1210,50 @@ var Table = /** @class */ (function () {
|
|
|
1106
1210
|
detach(this.helper);
|
|
1107
1211
|
this.helper = null;
|
|
1108
1212
|
}
|
|
1213
|
+
this.resetResizeHelper(this.curTable);
|
|
1109
1214
|
this.pageX = null;
|
|
1110
1215
|
this.pageY = null;
|
|
1111
1216
|
this.moveEle = null;
|
|
1217
|
+
var currentTableTrElement = this.curTable.querySelectorAll("tr");
|
|
1218
|
+
var tableTrPercentage = [];
|
|
1219
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1220
|
+
var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
|
|
1221
|
+
tableTrPercentage[i] = percentage;
|
|
1222
|
+
}
|
|
1223
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1224
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
1225
|
+
}
|
|
1112
1226
|
var args = { event: e, requestType: 'table' };
|
|
1113
1227
|
this.parent.trigger(events.resizeStop, args);
|
|
1114
1228
|
this.parent.formatter.saveData();
|
|
1229
|
+
this.resizeEndTime = new Date().getTime();
|
|
1230
|
+
};
|
|
1231
|
+
Table.prototype.resetResizeHelper = function (curTable) {
|
|
1232
|
+
var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
|
|
1233
|
+
Array.from(colHelper).forEach(function (element) {
|
|
1234
|
+
if (element.parentNode) {
|
|
1235
|
+
element.parentNode.removeChild(element);
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
var rowHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-row-helper');
|
|
1239
|
+
Array.from(rowHelper).forEach(function (element) {
|
|
1240
|
+
if (element.parentNode) {
|
|
1241
|
+
element.parentNode.removeChild(element);
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
if (!curTable.style.width) {
|
|
1245
|
+
curTable.style.width = curTable.offsetWidth + 'px';
|
|
1246
|
+
}
|
|
1247
|
+
var colGroup = curTable.querySelector('colgroup');
|
|
1248
|
+
if (colGroup) {
|
|
1249
|
+
for (var i = 0; i < curTable.rows.length; i++) {
|
|
1250
|
+
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
1251
|
+
var width = this.convertPixelToPercentage(curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(curTable).width, 10)) + '%';
|
|
1252
|
+
curTable.rows[i].cells[k].style.width = width;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
curTable.removeChild(colGroup);
|
|
1256
|
+
}
|
|
1115
1257
|
};
|
|
1116
1258
|
Table.prototype.resizeBtnInit = function () {
|
|
1117
1259
|
return this.resizeBtnStat = { column: false, row: false, tableBox: false };
|
|
@@ -1175,16 +1317,16 @@ var Table = /** @class */ (function () {
|
|
|
1175
1317
|
this.hideTableQuickToolbar();
|
|
1176
1318
|
var header = '1X1';
|
|
1177
1319
|
var insertbtn = this.l10n.getConstant('inserttablebtn');
|
|
1178
|
-
this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' +
|
|
1179
|
-
this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' +
|
|
1320
|
+
this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
|
|
1321
|
+
this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
|
|
1180
1322
|
this.tblHeader.innerHTML = header;
|
|
1181
1323
|
this.dlgDiv.appendChild(this.tblHeader);
|
|
1182
|
-
var tableDiv = this.parent.createElement('div', { className: 'e-rte-table-span' +
|
|
1324
|
+
var tableDiv = this.parent.createElement('div', { className: 'e-rte-table-span' + this.parent.getCssClass(true) });
|
|
1183
1325
|
this.drawTable(tableDiv, args);
|
|
1184
1326
|
this.dlgDiv.appendChild(tableDiv);
|
|
1185
|
-
this.dlgDiv.appendChild(this.parent.createElement('span', { className: 'e-span-border' +
|
|
1327
|
+
this.dlgDiv.appendChild(this.parent.createElement('span', { className: 'e-span-border' + this.parent.getCssClass(true) }));
|
|
1186
1328
|
var btnEle = this.parent.createElement('button', {
|
|
1187
|
-
className: 'e-insert-table-btn' +
|
|
1329
|
+
className: 'e-insert-table-btn' + this.parent.getCssClass(true), id: this.rteID + '_insertTable',
|
|
1188
1330
|
attrs: { type: 'button', tabindex: '0' }
|
|
1189
1331
|
});
|
|
1190
1332
|
if (!isNOU(this.parent.getToolbarElement().querySelector('.e-expended-nav'))) {
|
|
@@ -1192,13 +1334,13 @@ var Table = /** @class */ (function () {
|
|
|
1192
1334
|
}
|
|
1193
1335
|
this.dlgDiv.appendChild(btnEle);
|
|
1194
1336
|
this.createTableButton = new Button({
|
|
1195
|
-
iconCss: 'e-icons e-create-table', content: insertbtn, cssClass: 'e-flat' +
|
|
1337
|
+
iconCss: 'e-icons e-create-table', content: insertbtn, cssClass: 'e-flat' + this.parent.getCssClass(true),
|
|
1196
1338
|
enableRtl: this.parent.enableRtl, locale: this.parent.locale
|
|
1197
1339
|
});
|
|
1198
1340
|
this.createTableButton.isStringTemplate = true;
|
|
1199
1341
|
this.createTableButton.appendTo(btnEle);
|
|
1200
1342
|
EventHandler.add(btnEle, 'click', this.insertTableDialog, { self: this, args: args.args, selection: args.selection });
|
|
1201
|
-
this.parent.getToolbar().appendChild(this.dlgDiv);
|
|
1343
|
+
this.parent.getToolbar().parentElement.appendChild(this.dlgDiv);
|
|
1202
1344
|
var target = args.args.originalEvent.target;
|
|
1203
1345
|
target = target.classList.contains('e-toolbar-item') ? target.firstChild : target.parentElement;
|
|
1204
1346
|
this.popupObj = new Popup(this.dlgDiv, {
|
|
@@ -1220,10 +1362,16 @@ var Table = /** @class */ (function () {
|
|
|
1220
1362
|
});
|
|
1221
1363
|
addClass([this.popupObj.element], 'e-popup-open');
|
|
1222
1364
|
if (!isNOU(this.parent.cssClass)) {
|
|
1223
|
-
addClass([this.popupObj.element], this.parent.
|
|
1365
|
+
addClass([this.popupObj.element], this.parent.getCssClass());
|
|
1224
1366
|
}
|
|
1367
|
+
btnEle.focus();
|
|
1225
1368
|
this.popupObj.refreshPosition(target);
|
|
1226
1369
|
};
|
|
1370
|
+
Table.prototype.onIframeMouseDown = function () {
|
|
1371
|
+
if (this.popupObj) {
|
|
1372
|
+
this.popupObj.hide();
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1227
1375
|
Table.prototype.docClick = function (e) {
|
|
1228
1376
|
var target = e.args.target;
|
|
1229
1377
|
// eslint-disable-next-line
|
|
@@ -1234,6 +1382,7 @@ var Table = /** @class */ (function () {
|
|
|
1234
1382
|
this.popupObj.hide();
|
|
1235
1383
|
}
|
|
1236
1384
|
if (this.editdlgObj) {
|
|
1385
|
+
this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
|
|
1237
1386
|
this.editdlgObj.hide();
|
|
1238
1387
|
}
|
|
1239
1388
|
this.parent.isBlur = true;
|
|
@@ -1260,10 +1409,10 @@ var Table = /** @class */ (function () {
|
|
|
1260
1409
|
var rowDiv;
|
|
1261
1410
|
var tableCell;
|
|
1262
1411
|
for (var row = 0; row < 3; row++) {
|
|
1263
|
-
rowDiv = this.parent.createElement('div', { className: 'e-rte-table-row' +
|
|
1412
|
+
rowDiv = this.parent.createElement('div', { className: 'e-rte-table-row' + this.parent.getCssClass(true), attrs: { 'data-column': '' + row } });
|
|
1264
1413
|
for (var col = 0; col < 10; col++) {
|
|
1265
1414
|
var display = (row > 2) ? 'none' : 'inline-block';
|
|
1266
|
-
tableCell = this.parent.createElement('div', { className: 'e-rte-tablecell e-default' +
|
|
1415
|
+
tableCell = this.parent.createElement('div', { className: 'e-rte-tablecell e-default' + this.parent.getCssClass(true), attrs: { 'data-cell': '' + col } });
|
|
1267
1416
|
rowDiv.appendChild(tableCell);
|
|
1268
1417
|
tableCell.style.display = display;
|
|
1269
1418
|
if (col === 0 && row === 0) {
|
|
@@ -1287,13 +1436,13 @@ var Table = /** @class */ (function () {
|
|
|
1287
1436
|
height: 'initial', width: '290px', content: editContent, header: editHeader,
|
|
1288
1437
|
buttons: [{
|
|
1289
1438
|
click: this.applyProperties.bind(this, args),
|
|
1290
|
-
buttonModel: { content: update, cssClass: 'e-flat e-size-update' +
|
|
1439
|
+
buttonModel: { content: update, cssClass: 'e-flat e-size-update' + this.parent.getCssClass(true), isPrimary: true }
|
|
1291
1440
|
},
|
|
1292
1441
|
{
|
|
1293
1442
|
click: function (e) {
|
|
1294
1443
|
_this.cancelDialog(e);
|
|
1295
1444
|
},
|
|
1296
|
-
buttonModel: { cssClass: 'e-flat e-cancel' +
|
|
1445
|
+
buttonModel: { cssClass: 'e-flat e-cancel' + this.parent.getCssClass(true), content: cancel }
|
|
1297
1446
|
}],
|
|
1298
1447
|
cssClass: this.editdlgObj.cssClass + ' e-rte-edit-table-prop-dialog'
|
|
1299
1448
|
});
|
|
@@ -1335,10 +1484,10 @@ var Table = /** @class */ (function () {
|
|
|
1335
1484
|
Table.prototype.tableCellDlgContent = function () {
|
|
1336
1485
|
var tableColumn = this.l10n.getConstant('columns');
|
|
1337
1486
|
var tableRow = this.l10n.getConstant('rows');
|
|
1338
|
-
var tableWrap = this.parent.createElement('div', { className: 'e-cell-wrap' +
|
|
1339
|
-
var content = '<div class="e-rte-field' +
|
|
1340
|
-
+ ' data-role ="none" id="tableColumn" class="e-table-column' +
|
|
1341
|
-
+ '<div class="e-rte-field' +
|
|
1487
|
+
var tableWrap = this.parent.createElement('div', { className: 'e-cell-wrap' + this.parent.getCssClass(true) });
|
|
1488
|
+
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" '
|
|
1489
|
+
+ ' data-role ="none" id="tableColumn" class="e-table-column' + this.parent.getCssClass(true) + '"/></div>'
|
|
1490
|
+
+ '<div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" data-role ="none" id="tableRow" class="e-table-row' + this.parent.getCssClass(true) + '" /></div>';
|
|
1342
1491
|
var contentElem = parseHtml(content);
|
|
1343
1492
|
tableWrap.appendChild(contentElem);
|
|
1344
1493
|
this.columnTextBox = new NumericTextBox({
|
|
@@ -1349,7 +1498,7 @@ var Table = /** @class */ (function () {
|
|
|
1349
1498
|
floatLabelType: 'Auto',
|
|
1350
1499
|
max: 50,
|
|
1351
1500
|
enableRtl: this.parent.enableRtl, locale: this.parent.locale,
|
|
1352
|
-
cssClass: this.parent.
|
|
1501
|
+
cssClass: this.parent.getCssClass()
|
|
1353
1502
|
});
|
|
1354
1503
|
this.columnTextBox.isStringTemplate = true;
|
|
1355
1504
|
this.columnTextBox.appendTo(tableWrap.querySelector('#tableColumn'));
|
|
@@ -1361,7 +1510,7 @@ var Table = /** @class */ (function () {
|
|
|
1361
1510
|
floatLabelType: 'Auto',
|
|
1362
1511
|
max: 1000,
|
|
1363
1512
|
enableRtl: this.parent.enableRtl, locale: this.parent.locale,
|
|
1364
|
-
cssClass: this.parent.
|
|
1513
|
+
cssClass: this.parent.getCssClass()
|
|
1365
1514
|
});
|
|
1366
1515
|
this.rowTextBox.isStringTemplate = true;
|
|
1367
1516
|
this.rowTextBox.appendTo(tableWrap.querySelector('#tableRow'));
|
|
@@ -1382,7 +1531,7 @@ var Table = /** @class */ (function () {
|
|
|
1382
1531
|
return;
|
|
1383
1532
|
}
|
|
1384
1533
|
var tableDialog = this.parent.createElement('div', {
|
|
1385
|
-
className: 'e-rte-edit-table' +
|
|
1534
|
+
className: 'e-rte-edit-table' + this.parent.getCssClass(true), id: this.rteID + '_tabledialog'
|
|
1386
1535
|
});
|
|
1387
1536
|
this.parent.element.appendChild(tableDialog);
|
|
1388
1537
|
var insert = this.l10n.getConstant('dialogInsert');
|
|
@@ -1390,20 +1539,20 @@ var Table = /** @class */ (function () {
|
|
|
1390
1539
|
var header = this.l10n.getConstant('tabledialogHeader');
|
|
1391
1540
|
var dialogModel = {
|
|
1392
1541
|
header: header,
|
|
1393
|
-
cssClass: classes.CLS_RTE_ELEMENTS +
|
|
1542
|
+
cssClass: classes.CLS_RTE_ELEMENTS + this.parent.getCssClass(true),
|
|
1394
1543
|
enableRtl: this.parent.enableRtl,
|
|
1395
1544
|
locale: this.parent.locale,
|
|
1396
1545
|
showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'initial',
|
|
1397
1546
|
position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
|
|
1398
1547
|
isModal: Browser.isDevice,
|
|
1399
1548
|
buttons: [{
|
|
1400
|
-
buttonModel: { content: insert, cssClass: 'e-flat e-insert-table' +
|
|
1549
|
+
buttonModel: { content: insert, cssClass: 'e-flat e-insert-table' + this.parent.getCssClass(true), isPrimary: true }
|
|
1401
1550
|
},
|
|
1402
1551
|
{
|
|
1403
1552
|
click: function (e) {
|
|
1404
1553
|
_this.cancelDialog(e);
|
|
1405
1554
|
},
|
|
1406
|
-
buttonModel: { cssClass: 'e-flat e-cancel' +
|
|
1555
|
+
buttonModel: { cssClass: 'e-flat e-cancel' + this.parent.getCssClass(true), content: cancel }
|
|
1407
1556
|
}],
|
|
1408
1557
|
target: (Browser.isDevice) ? document.body : this.parent.element,
|
|
1409
1558
|
animationSettings: { effect: 'None' },
|
|
@@ -1476,13 +1625,13 @@ var Table = /** @class */ (function () {
|
|
|
1476
1625
|
var tableWidth = this.l10n.getConstant('tableWidth');
|
|
1477
1626
|
var cellPadding = this.l10n.getConstant('cellpadding');
|
|
1478
1627
|
var cellSpacing = this.l10n.getConstant('cellspacing');
|
|
1479
|
-
var tableWrap = this.parent.createElement('div', { className: 'e-table-sizewrap' +
|
|
1628
|
+
var tableWrap = this.parent.createElement('div', { className: 'e-table-sizewrap' + this.parent.getCssClass(true) });
|
|
1480
1629
|
var widthVal = closest(selectNode, 'table').getClientRects()[0].width;
|
|
1481
1630
|
var padVal = closest(selectNode, 'td').style.padding;
|
|
1482
1631
|
var brdSpcVal = closest(selectNode, 'table').getAttribute('cellspacing');
|
|
1483
|
-
var content = '<div class="e-rte-field' +
|
|
1484
|
-
+ ' /></div>' + '<div class="e-rte-field' +
|
|
1485
|
-
+ ' </div><div class="e-rte-field' +
|
|
1632
|
+
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" data-role ="none" id="tableWidth" class="e-table-width' + this.parent.getCssClass(true) + '" '
|
|
1633
|
+
+ ' /></div>' + '<div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" data-role ="none" id="cellPadding" class="e-cell-padding' + this.parent.getCssClass(true) + '" />'
|
|
1634
|
+
+ ' </div><div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" data-role ="none" id="cellSpacing" class="e-cell-spacing' + this.parent.getCssClass(true) + '" /></div>';
|
|
1486
1635
|
var contentElem = parseHtml(content);
|
|
1487
1636
|
tableWrap.appendChild(contentElem);
|
|
1488
1637
|
this.tableWidthNum = new NumericTextBox({
|
|
@@ -1544,6 +1693,22 @@ var Table = /** @class */ (function () {
|
|
|
1544
1693
|
Table.prototype.getModuleName = function () {
|
|
1545
1694
|
return 'table';
|
|
1546
1695
|
};
|
|
1696
|
+
Table.prototype.afterKeyDown = function (e) {
|
|
1697
|
+
var _this = this;
|
|
1698
|
+
if (this.curTable) {
|
|
1699
|
+
setTimeout(function () {
|
|
1700
|
+
_this.updateResizeIconPosition();
|
|
1701
|
+
}, 1);
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
Table.prototype.updateResizeIconPosition = function () {
|
|
1705
|
+
var tableReBox = this.parent.contentModule.getEditPanel().querySelector('.e-table-box');
|
|
1706
|
+
if (!isNOU(tableReBox)) {
|
|
1707
|
+
var tablePosition = this.calcPos(this.curTable);
|
|
1708
|
+
tableReBox.style.cssText = 'top: ' + (tablePosition.top + parseInt(getComputedStyle(this.curTable).height, 10) - 4) +
|
|
1709
|
+
'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1547
1712
|
return Table;
|
|
1548
1713
|
}());
|
|
1549
1714
|
export { Table };
|