@syncfusion/ej2-richtexteditor 23.2.7 → 24.1.41-569421
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 +259 -259
- package/CHANGELOG.md +1953 -1749
- package/README.md +76 -76
- package/dist/ej2-richtexteditor.umd.min.js +1 -10
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +9971 -8025
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +8445 -6498
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/helpers/e2e/index.js +3 -3
- package/helpers/e2e/rte-helper.js +13 -13
- package/license +9 -9
- package/package.json +74 -74
- 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 +19 -7
- 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/classes.d.ts +1 -1
- package/src/editor-manager/base/classes.js +1 -1
- 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 +8 -3
- package/src/editor-manager/base/editor-manager.js +62 -3
- package/src/editor-manager/base/enum.d.ts +2 -2
- package/src/editor-manager/base/interface.d.ts +17 -9
- package/src/editor-manager/base/types.d.ts +1 -1
- package/src/editor-manager/plugin/alignments.d.ts +2 -2
- package/src/editor-manager/plugin/alignments.js +2 -2
- package/src/editor-manager/plugin/audio.d.ts +3 -3
- package/src/editor-manager/plugin/audio.js +16 -6
- package/src/editor-manager/plugin/clearformat-exec.d.ts +2 -2
- package/src/editor-manager/plugin/clearformat-exec.js +2 -2
- package/src/editor-manager/plugin/clearformat.d.ts +1 -1
- package/src/editor-manager/plugin/clearformat.js +1 -1
- package/src/editor-manager/plugin/dom-node.d.ts +39 -35
- package/src/editor-manager/plugin/dom-node.js +203 -62
- package/src/editor-manager/plugin/format-painter-actions.d.ts +2 -1
- package/src/editor-manager/plugin/format-painter-actions.js +20 -2
- package/src/editor-manager/plugin/formats.d.ts +3 -2
- package/src/editor-manager/plugin/formats.js +40 -5
- package/src/editor-manager/plugin/image.d.ts +3 -3
- package/src/editor-manager/plugin/image.js +41 -18
- package/src/editor-manager/plugin/indents.d.ts +2 -2
- package/src/editor-manager/plugin/indents.js +3 -3
- package/src/editor-manager/plugin/insert-methods.d.ts +4 -4
- package/src/editor-manager/plugin/insert-methods.js +4 -4
- package/src/editor-manager/plugin/insert-text.d.ts +2 -2
- package/src/editor-manager/plugin/insert-text.js +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.d.ts +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.js +2 -2
- package/src/editor-manager/plugin/inserthtml.d.ts +3 -2
- package/src/editor-manager/plugin/inserthtml.js +85 -22
- package/src/editor-manager/plugin/isformatted.d.ts +8 -8
- package/src/editor-manager/plugin/isformatted.js +8 -8
- package/src/editor-manager/plugin/link.d.ts +2 -2
- package/src/editor-manager/plugin/link.js +10 -5
- package/src/editor-manager/plugin/lists.d.ts +2 -2
- package/src/editor-manager/plugin/lists.js +161 -72
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +216 -86
- package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
- package/src/editor-manager/plugin/nodecutter.js +11 -8
- package/src/editor-manager/plugin/selection-commands.d.ts +3 -1
- package/src/editor-manager/plugin/selection-commands.js +249 -5
- package/src/editor-manager/plugin/selection-exec.d.ts +2 -2
- package/src/editor-manager/plugin/selection-exec.js +2 -2
- package/src/editor-manager/plugin/table.d.ts +6 -3
- package/src/editor-manager/plugin/table.js +97 -51
- package/src/editor-manager/plugin/toolbar-status.d.ts +4 -4
- package/src/editor-manager/plugin/toolbar-status.js +22 -12
- package/src/editor-manager/plugin/undo.d.ts +7 -6
- package/src/editor-manager/plugin/undo.js +27 -7
- package/src/editor-manager/plugin/video.d.ts +3 -3
- package/src/editor-manager/plugin/video.js +3 -3
- package/src/global.d.ts +1 -0
- package/src/markdown-parser/base/interface.d.ts +10 -10
- package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
- package/src/markdown-parser/base/markdown-parser.js +3 -3
- package/src/markdown-parser/base/types.d.ts +1 -1
- package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
- package/src/markdown-parser/plugin/clearformat.js +2 -2
- package/src/markdown-parser/plugin/formats.d.ts +2 -2
- package/src/markdown-parser/plugin/formats.js +2 -2
- package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
- package/src/markdown-parser/plugin/insert-text.js +2 -2
- package/src/markdown-parser/plugin/link.d.ts +2 -2
- package/src/markdown-parser/plugin/link.js +2 -2
- package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
- package/src/markdown-parser/plugin/markdown-selection.js +14 -14
- package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
- package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
- package/src/markdown-parser/plugin/table.d.ts +3 -3
- package/src/markdown-parser/plugin/table.js +3 -3
- package/src/markdown-parser/plugin/undo.d.ts +6 -6
- package/src/markdown-parser/plugin/undo.js +6 -6
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +13 -12
- package/src/rich-text-editor/actions/base-quick-toolbar.js +70 -23
- package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-toolbar.js +36 -37
- package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
- package/src/rich-text-editor/actions/color-picker.js +15 -5
- package/src/rich-text-editor/actions/count.d.ts +3 -3
- package/src/rich-text-editor/actions/count.js +4 -4
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +3 -2
- package/src/rich-text-editor/actions/dropdown-buttons.js +13 -7
- package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
- package/src/rich-text-editor/actions/emoji-picker.js +17 -8
- package/src/rich-text-editor/actions/enter-key.js +10 -5
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +5 -2
- package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
- package/src/rich-text-editor/actions/full-screen.js +8 -7
- package/src/rich-text-editor/actions/html-editor.d.ts +5 -3
- package/src/rich-text-editor/actions/html-editor.js +134 -22
- package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
- package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
- package/src/rich-text-editor/actions/keyboard.js +23 -21
- package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
- package/src/rich-text-editor/actions/markdown-editor.js +5 -3
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +6 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +157 -29
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +17 -9
- package/src/rich-text-editor/actions/quick-toolbar.js +68 -21
- 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 +16 -16
- package/src/rich-text-editor/actions/toolbar.js +48 -109
- package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
- package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
- package/src/rich-text-editor/base/classes.d.ts +125 -125
- package/src/rich-text-editor/base/classes.js +125 -125
- package/src/rich-text-editor/base/constant.d.ts +195 -150
- package/src/rich-text-editor/base/constant.js +364 -150
- package/src/rich-text-editor/base/enum.d.ts +1 -1
- package/src/rich-text-editor/base/enum.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +96 -52
- package/src/rich-text-editor/base/interface.js +1 -1
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
- package/src/rich-text-editor/base/rich-text-editor.d.ts +76 -64
- package/src/rich-text-editor/base/rich-text-editor.js +247 -160
- package/src/rich-text-editor/base/util.d.ts +1 -1
- package/src/rich-text-editor/base/util.js +23 -5
- package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
- package/src/rich-text-editor/formatter/formatter.js +24 -12
- package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/html-formatter.js +15 -15
- package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
- package/src/rich-text-editor/models/default-locale.js +31 -25
- package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
- package/src/rich-text-editor/models/iframe-settings.js +19 -19
- package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
- package/src/rich-text-editor/models/inline-mode.js +19 -19
- package/src/rich-text-editor/models/items.js +3 -3
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +20 -20
- package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
- package/src/rich-text-editor/renderer/audio-module.js +23 -5
- package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/content-renderer.js +6 -6
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +24 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
- package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
- package/src/rich-text-editor/renderer/image-module.js +265 -221
- package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/link-module.js +54 -25
- package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
- package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
- package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
- package/src/rich-text-editor/renderer/render.d.ts +2 -2
- package/src/rich-text-editor/renderer/render.js +2 -2
- package/src/rich-text-editor/renderer/table-module.d.ts +11 -2
- package/src/rich-text-editor/renderer/table-module.js +344 -169
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +12 -15
- package/src/rich-text-editor/renderer/toolbar-renderer.js +115 -110
- package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/video-module.js +83 -42
- package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
- package/src/rich-text-editor/renderer/view-source.js +21 -11
- package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
- package/src/rich-text-editor/services/renderer-factory.js +3 -3
- package/src/rich-text-editor/services/service-locator.d.ts +3 -3
- package/src/rich-text-editor/services/service-locator.js +3 -3
- package/src/selection/selection.d.ts +22 -22
- package/src/selection/selection.js +25 -22
- package/styles/_all.scss +1 -1
- package/styles/bootstrap-dark.css +353 -103
- package/styles/bootstrap.css +357 -112
- package/styles/bootstrap4.css +338 -96
- package/styles/bootstrap5-dark.css +344 -97
- package/styles/bootstrap5.css +344 -97
- package/styles/fabric-dark.css +332 -90
- package/styles/fabric.css +333 -91
- package/styles/fluent-dark.css +360 -98
- package/styles/fluent.css +360 -98
- package/styles/highcontrast-light.css +332 -90
- package/styles/highcontrast.css +336 -91
- package/styles/material-dark.css +339 -92
- package/styles/material.css +339 -92
- package/styles/material3-dark.css +348 -100
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +348 -100
- package/styles/material3.scss +1 -1
- package/styles/rich-text-editor/_all.scss +2 -2
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
- package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
- package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
- package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
- package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
- package/styles/rich-text-editor/_fabric-definition.scss +261 -257
- package/styles/rich-text-editor/_fluent-definition.scss +267 -263
- package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
- package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
- package/styles/rich-text-editor/_layout.scss +2249 -2072
- package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
- package/styles/rich-text-editor/_material-definition.scss +264 -260
- package/styles/rich-text-editor/_material3-definition.scss +266 -262
- package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
- package/styles/rich-text-editor/_theme.scss +926 -837
- package/styles/rich-text-editor/bootstrap-dark.css +353 -103
- package/styles/rich-text-editor/bootstrap.css +357 -112
- package/styles/rich-text-editor/bootstrap4.css +338 -96
- package/styles/rich-text-editor/bootstrap5-dark.css +344 -97
- package/styles/rich-text-editor/bootstrap5.css +344 -97
- package/styles/rich-text-editor/fabric-dark.css +332 -90
- package/styles/rich-text-editor/fabric.css +333 -91
- package/styles/rich-text-editor/fluent-dark.css +360 -98
- package/styles/rich-text-editor/fluent.css +360 -98
- package/styles/rich-text-editor/highcontrast-light.css +332 -90
- package/styles/rich-text-editor/highcontrast.css +336 -91
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
- package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_fabric.scss +349 -349
- package/styles/rich-text-editor/icons/_fluent.scss +348 -348
- package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
- package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
- package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_material.scss +349 -349
- package/styles/rich-text-editor/icons/_material3.scss +348 -348
- package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
- package/styles/rich-text-editor/material-dark.css +339 -92
- package/styles/rich-text-editor/material.css +339 -92
- package/styles/rich-text-editor/material3-dark.css +348 -100
- package/styles/rich-text-editor/material3-dark.scss +1 -1
- package/styles/rich-text-editor/material3.css +348 -100
- package/styles/rich-text-editor/material3.scss +1 -1
- package/styles/rich-text-editor/tailwind-dark.css +383 -113
- package/styles/rich-text-editor/tailwind.css +383 -113
- package/styles/tailwind-dark.css +383 -113
- package/styles/tailwind.css +383 -113
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
- package/dist/ej2-richtexteditor.min.js +0 -10
- package/dist/global/ej2-richtexteditor.min.js +0 -11
- package/dist/global/ej2-richtexteditor.min.js.map +0 -1
- package/dist/global/index.d.ts +0 -14
- package/tslint.json +0 -111
|
@@ -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,14 +642,15 @@ 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');
|
|
603
|
-
|
|
645
|
+
var closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
|
|
646
|
+
var isResizing = this.parent.contentModule.getEditPanel().querySelectorAll('.e-table-box.e-rbox-select, .e-table-rhelper.e-column-helper, .e-table-rhelper.e-row-helper').length > 0;
|
|
647
|
+
if (!isResizing && !isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable &&
|
|
604
648
|
this.parent.contentModule.getEditPanel().contains(closestTable)) {
|
|
605
649
|
this.removeResizeElement();
|
|
606
650
|
this.removeHelper(e);
|
|
607
651
|
this.cancelResizeAction();
|
|
608
652
|
}
|
|
609
|
-
if (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH') {
|
|
653
|
+
if (!isResizing && (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH')) {
|
|
610
654
|
this.curTable = (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable))
|
|
611
655
|
&& (target.nodeName === 'TD' || target.nodeName === 'TH') ?
|
|
612
656
|
closestTable : target;
|
|
@@ -616,7 +660,7 @@ var Table = /** @class */ (function () {
|
|
|
616
660
|
};
|
|
617
661
|
Table.prototype.tableResizeEleCreation = function (table, e) {
|
|
618
662
|
this.parent.preventDefaultResize(e);
|
|
619
|
-
var columns =
|
|
663
|
+
var columns = this.calMaxCol(this.curTable);
|
|
620
664
|
var rows = [];
|
|
621
665
|
for (var i = 0; i < table.rows.length; i++) {
|
|
622
666
|
for (var j = 0; j < table.rows[i].cells.length; j++) {
|
|
@@ -638,11 +682,11 @@ var Table = /** @class */ (function () {
|
|
|
638
682
|
colReEle.classList.add(classes.CLS_RTE_TABLE_RESIZE, classes.CLS_TB_COL_RES);
|
|
639
683
|
if (columns.length === i) {
|
|
640
684
|
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;';
|
|
685
|
+
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
|
|
642
686
|
}
|
|
643
687
|
else {
|
|
644
688
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
645
|
-
'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
|
|
689
|
+
'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
|
|
646
690
|
}
|
|
647
691
|
this.contentModule.getEditPanel().appendChild(colReEle);
|
|
648
692
|
}
|
|
@@ -661,7 +705,7 @@ var Table = /** @class */ (function () {
|
|
|
661
705
|
this.contentModule.getEditPanel().appendChild(rowReEle);
|
|
662
706
|
}
|
|
663
707
|
var tableReBox = this.parent.createElement('span', {
|
|
664
|
-
className: classes.CLS_TB_BOX_RES +
|
|
708
|
+
className: classes.CLS_TB_BOX_RES + this.parent.getCssClass(true), attrs: {
|
|
665
709
|
'data-col': columns.length.toString(), 'unselectable': 'on', 'contenteditable': 'false'
|
|
666
710
|
}
|
|
667
711
|
});
|
|
@@ -674,7 +718,7 @@ var Table = /** @class */ (function () {
|
|
|
674
718
|
};
|
|
675
719
|
Table.prototype.removeResizeElement = function () {
|
|
676
720
|
var item = this.parent.contentModule.getEditPanel().
|
|
677
|
-
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box
|
|
721
|
+
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
|
|
678
722
|
if (item.length > 0) {
|
|
679
723
|
for (var i = 0; i < item.length; i++) {
|
|
680
724
|
detach(item[i]);
|
|
@@ -748,19 +792,20 @@ var Table = /** @class */ (function () {
|
|
|
748
792
|
if (target.classList.contains(classes.CLS_TB_COL_RES) ||
|
|
749
793
|
target.classList.contains(classes.CLS_TB_ROW_RES) ||
|
|
750
794
|
target.classList.contains(classes.CLS_TB_BOX_RES)) {
|
|
795
|
+
this.resetResizeHelper(this.curTable);
|
|
751
796
|
e.preventDefault();
|
|
752
797
|
this.parent.preventDefaultResize(e);
|
|
753
798
|
removeClass(this.curTable.querySelectorAll('td,th'), classes.CLS_TABLE_SEL);
|
|
754
|
-
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
755
799
|
this.pageX = this.getPointX(e);
|
|
756
800
|
this.pageY = this.getPointY(e);
|
|
757
801
|
this.resizeBtnInit();
|
|
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,44 @@ 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
|
+
// For table pasted from word, Margin left can be anything so we are avoiding the below process.
|
|
1059
|
+
if (!_this.curTable.classList.contains('e-rte-paste-table') && currentMarginLeft && currentMarginLeft < 1) {
|
|
1060
|
+
_this.curTable.style.marginLeft = null;
|
|
1061
|
+
_this.curTable.style.width = '100%';
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
_this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : currentMarginLeft) + '%)';
|
|
928
1065
|
for (var i = 0; i < firstColumnsCell.length; i++) {
|
|
929
|
-
_this.
|
|
1066
|
+
var currentColumnCellWidth = _this.getCurrentColWidth(firstColumnsCell[i], tableWidth);
|
|
1067
|
+
firstColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
930
1068
|
}
|
|
931
1069
|
}
|
|
932
1070
|
}
|
|
@@ -938,112 +1076,48 @@ var Table = /** @class */ (function () {
|
|
|
938
1076
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
939
1077
|
}
|
|
940
1078
|
// Below the value '100' is the 100% width of the parent element.
|
|
941
|
-
if (((mouseX !== 0 && 5 <
|
|
1079
|
+
if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX > 0) &&
|
|
942
1080
|
currentTableWidth <= 100 && _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
|
|
943
1081
|
var lastColumnsCell = _this.findFirstLastColCells(_this.curTable, false);
|
|
944
1082
|
_this.curTable.style.width = _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) > 100 ? (100 + '%') : (_this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%');
|
|
945
1083
|
var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
|
|
946
1084
|
for (var i = 0; i < lastColumnsCell.length; i++) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
_this.colIndex - 1 : _this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
950
|
-
}
|
|
1085
|
+
var currentColumnCellWidth = _this.getCurrentColWidth(lastColumnsCell[i], tableWidth);
|
|
1086
|
+
lastColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
951
1087
|
}
|
|
952
1088
|
}
|
|
953
1089
|
}
|
|
954
1090
|
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
|
-
}
|
|
1091
|
+
var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
|
|
1092
|
+
// eslint-disable-next-line
|
|
1093
|
+
var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
|
|
1094
|
+
if ((totalwid - actualwid) > 20 && actualwid > 20) {
|
|
1095
|
+
var leftColumnWidth = totalwid - actualwid;
|
|
1096
|
+
var rightColWidth = actualwid;
|
|
1097
|
+
colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1098
|
+
colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1036
1099
|
}
|
|
1037
1100
|
}
|
|
1038
1101
|
_this.updateHelper();
|
|
1039
1102
|
}
|
|
1040
1103
|
else if (_this.resizeBtnStat.row) {
|
|
1041
1104
|
_this.parent.preventDefaultResize(e);
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
|
|
1105
|
+
var tableTrElementPixel = [];
|
|
1106
|
+
var currentTableTrElement = _this.curTable.querySelectorAll('tr');
|
|
1107
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1108
|
+
if (_this.rowEle !== currentTableTrElement[i]) {
|
|
1109
|
+
tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
_this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + ((mouseY > 0) ? 0 : mouseY)) + 'px';
|
|
1113
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1114
|
+
if (_this.rowEle === currentTableTrElement[i]) {
|
|
1115
|
+
currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
|
|
1116
|
+
}
|
|
1117
|
+
else {
|
|
1118
|
+
currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
|
|
1119
|
+
}
|
|
1045
1120
|
}
|
|
1046
|
-
_this.curTable.style.height = '';
|
|
1047
1121
|
if (!isNOU(tableReBox)) {
|
|
1048
1122
|
tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
|
|
1049
1123
|
'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
|
|
@@ -1057,19 +1131,40 @@ var Table = /** @class */ (function () {
|
|
|
1057
1131
|
maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
|
|
1058
1132
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
1059
1133
|
}
|
|
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
1134
|
_this.curTable.style.height = tableHeight + mouseY + 'px';
|
|
1064
1135
|
if (!isNOU(tableReBox)) {
|
|
1065
1136
|
tableReBox.classList.add('e-rbox-select');
|
|
1066
1137
|
tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
|
|
1067
1138
|
'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
|
|
1068
1139
|
}
|
|
1140
|
+
if (_this.curTable.closest('li')) {
|
|
1141
|
+
widthCompare = _this.curTable.closest('li').offsetWidth;
|
|
1142
|
+
}
|
|
1143
|
+
var widthType = _this.curTable.style.width.indexOf('%') > -1;
|
|
1144
|
+
if (widthType && parseFloat(_this.curTable.style.width.split('%')[0]) > 100) {
|
|
1145
|
+
_this.curTable.style.width = '100%';
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
if (!widthType && _this.curTable.offsetWidth > _this.contentModule.getEditPanel().offsetWidth) {
|
|
1149
|
+
_this.curTable.style.width = rteWidth + 'px';
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
_this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
|
|
1153
|
+
: tableWidth + mouseX + 'px';
|
|
1069
1154
|
}
|
|
1070
1155
|
}
|
|
1071
1156
|
});
|
|
1072
1157
|
};
|
|
1158
|
+
Table.prototype.getCurrentColWidth = function (col, tableWidth) {
|
|
1159
|
+
var currentColWidth = 0;
|
|
1160
|
+
if (col.style.width !== '' && col.style.width.includes('%')) {
|
|
1161
|
+
currentColWidth = parseFloat(col.style.width.split('%')[0]);
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
currentColWidth = this.convertPixelToPercentage(col.offsetWidth, tableWidth);
|
|
1165
|
+
}
|
|
1166
|
+
return currentColWidth;
|
|
1167
|
+
};
|
|
1073
1168
|
Table.prototype.getCurrentTableWidth = function (tableWidth, parentWidth) {
|
|
1074
1169
|
var currentTableWidth = 0;
|
|
1075
1170
|
currentTableWidth = tableWidth / parentWidth * 100;
|
|
@@ -1077,12 +1172,22 @@ var Table = /** @class */ (function () {
|
|
|
1077
1172
|
};
|
|
1078
1173
|
Table.prototype.findFirstLastColCells = function (table, isFirst) {
|
|
1079
1174
|
var resultColumns = [];
|
|
1080
|
-
var rows = table.
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1175
|
+
var rows = table.rows;
|
|
1176
|
+
var rowSpanCellIndexs = new Array();
|
|
1177
|
+
var _loop_1 = function (i) {
|
|
1178
|
+
var cellIndex = isFirst ? 0 : rows[i].cells.length - 1;
|
|
1179
|
+
var column = rows[i].cells[cellIndex];
|
|
1180
|
+
for (var rowSpan = 1; rowSpan < column.rowSpan; rowSpan++) {
|
|
1181
|
+
var key = i + rowSpan + "-" + cellIndex;
|
|
1182
|
+
rowSpanCellIndexs.push(key);
|
|
1183
|
+
}
|
|
1184
|
+
var spannedCellKey = i + "-" + cellIndex;
|
|
1185
|
+
if (rowSpanCellIndexs.length === 0 || (isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1) || (!isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1 && rowSpanCellIndexs.every(function (key) { return key.split('-')[0] !== i.toString(); }))) {
|
|
1186
|
+
resultColumns.push(column);
|
|
1085
1187
|
}
|
|
1188
|
+
};
|
|
1189
|
+
for (var i = 0; i < rows.length; i++) {
|
|
1190
|
+
_loop_1(i);
|
|
1086
1191
|
}
|
|
1087
1192
|
return resultColumns;
|
|
1088
1193
|
};
|
|
@@ -1106,12 +1211,56 @@ var Table = /** @class */ (function () {
|
|
|
1106
1211
|
detach(this.helper);
|
|
1107
1212
|
this.helper = null;
|
|
1108
1213
|
}
|
|
1214
|
+
this.resetResizeHelper(this.curTable);
|
|
1109
1215
|
this.pageX = null;
|
|
1110
1216
|
this.pageY = null;
|
|
1111
1217
|
this.moveEle = null;
|
|
1218
|
+
var currentTableTrElement = this.curTable.querySelectorAll("tr");
|
|
1219
|
+
var tableTrPercentage = [];
|
|
1220
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1221
|
+
var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
|
|
1222
|
+
tableTrPercentage[i] = percentage;
|
|
1223
|
+
}
|
|
1224
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1225
|
+
if (currentTableTrElement[i].parentElement.nodeName === 'THEAD') {
|
|
1226
|
+
currentTableTrElement[i].parentElement.style.height = tableTrPercentage[i] + '%';
|
|
1227
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1112
1233
|
var args = { event: e, requestType: 'table' };
|
|
1113
1234
|
this.parent.trigger(events.resizeStop, args);
|
|
1114
1235
|
this.parent.formatter.saveData();
|
|
1236
|
+
this.resizeEndTime = new Date().getTime();
|
|
1237
|
+
};
|
|
1238
|
+
Table.prototype.resetResizeHelper = function (curTable) {
|
|
1239
|
+
var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
|
|
1240
|
+
Array.from(colHelper).forEach(function (element) {
|
|
1241
|
+
if (element.parentNode) {
|
|
1242
|
+
element.parentNode.removeChild(element);
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
var rowHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-row-helper');
|
|
1246
|
+
Array.from(rowHelper).forEach(function (element) {
|
|
1247
|
+
if (element.parentNode) {
|
|
1248
|
+
element.parentNode.removeChild(element);
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
if (!curTable.style.width) {
|
|
1252
|
+
curTable.style.width = curTable.offsetWidth + 'px';
|
|
1253
|
+
}
|
|
1254
|
+
var colGroup = curTable.querySelector('colgroup');
|
|
1255
|
+
if (colGroup) {
|
|
1256
|
+
for (var i = 0; i < curTable.rows.length; i++) {
|
|
1257
|
+
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
1258
|
+
var width = this.convertPixelToPercentage(curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(curTable).width, 10)) + '%';
|
|
1259
|
+
curTable.rows[i].cells[k].style.width = width;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
curTable.removeChild(colGroup);
|
|
1263
|
+
}
|
|
1115
1264
|
};
|
|
1116
1265
|
Table.prototype.resizeBtnInit = function () {
|
|
1117
1266
|
return this.resizeBtnStat = { column: false, row: false, tableBox: false };
|
|
@@ -1175,16 +1324,16 @@ var Table = /** @class */ (function () {
|
|
|
1175
1324
|
this.hideTableQuickToolbar();
|
|
1176
1325
|
var header = '1X1';
|
|
1177
1326
|
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' +
|
|
1327
|
+
this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
|
|
1328
|
+
this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
|
|
1180
1329
|
this.tblHeader.innerHTML = header;
|
|
1181
1330
|
this.dlgDiv.appendChild(this.tblHeader);
|
|
1182
|
-
var tableDiv = this.parent.createElement('div', { className: 'e-rte-table-span' +
|
|
1331
|
+
var tableDiv = this.parent.createElement('div', { className: 'e-rte-table-span' + this.parent.getCssClass(true) });
|
|
1183
1332
|
this.drawTable(tableDiv, args);
|
|
1184
1333
|
this.dlgDiv.appendChild(tableDiv);
|
|
1185
|
-
this.dlgDiv.appendChild(this.parent.createElement('span', { className: 'e-span-border' +
|
|
1334
|
+
this.dlgDiv.appendChild(this.parent.createElement('span', { className: 'e-span-border' + this.parent.getCssClass(true) }));
|
|
1186
1335
|
var btnEle = this.parent.createElement('button', {
|
|
1187
|
-
className: 'e-insert-table-btn' +
|
|
1336
|
+
className: 'e-insert-table-btn' + this.parent.getCssClass(true), id: this.rteID + '_insertTable',
|
|
1188
1337
|
attrs: { type: 'button', tabindex: '0' }
|
|
1189
1338
|
});
|
|
1190
1339
|
if (!isNOU(this.parent.getToolbarElement().querySelector('.e-expended-nav'))) {
|
|
@@ -1192,13 +1341,13 @@ var Table = /** @class */ (function () {
|
|
|
1192
1341
|
}
|
|
1193
1342
|
this.dlgDiv.appendChild(btnEle);
|
|
1194
1343
|
this.createTableButton = new Button({
|
|
1195
|
-
iconCss: 'e-icons e-create-table', content: insertbtn, cssClass: 'e-flat' +
|
|
1344
|
+
iconCss: 'e-icons e-create-table', content: insertbtn, cssClass: 'e-flat' + this.parent.getCssClass(true),
|
|
1196
1345
|
enableRtl: this.parent.enableRtl, locale: this.parent.locale
|
|
1197
1346
|
});
|
|
1198
1347
|
this.createTableButton.isStringTemplate = true;
|
|
1199
1348
|
this.createTableButton.appendTo(btnEle);
|
|
1200
1349
|
EventHandler.add(btnEle, 'click', this.insertTableDialog, { self: this, args: args.args, selection: args.selection });
|
|
1201
|
-
this.parent.getToolbar().appendChild(this.dlgDiv);
|
|
1350
|
+
this.parent.getToolbar().parentElement.appendChild(this.dlgDiv);
|
|
1202
1351
|
var target = args.args.originalEvent.target;
|
|
1203
1352
|
target = target.classList.contains('e-toolbar-item') ? target.firstChild : target.parentElement;
|
|
1204
1353
|
this.popupObj = new Popup(this.dlgDiv, {
|
|
@@ -1220,10 +1369,19 @@ var Table = /** @class */ (function () {
|
|
|
1220
1369
|
});
|
|
1221
1370
|
addClass([this.popupObj.element], 'e-popup-open');
|
|
1222
1371
|
if (!isNOU(this.parent.cssClass)) {
|
|
1223
|
-
addClass([this.popupObj.element], this.parent.
|
|
1372
|
+
addClass([this.popupObj.element], this.parent.getCssClass());
|
|
1224
1373
|
}
|
|
1374
|
+
btnEle.focus();
|
|
1225
1375
|
this.popupObj.refreshPosition(target);
|
|
1226
1376
|
};
|
|
1377
|
+
Table.prototype.onIframeMouseDown = function () {
|
|
1378
|
+
if (this.popupObj) {
|
|
1379
|
+
this.popupObj.hide();
|
|
1380
|
+
}
|
|
1381
|
+
if (this.parent.inlineMode.enable && this.editdlgObj) {
|
|
1382
|
+
this.editdlgObj.hide();
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1227
1385
|
Table.prototype.docClick = function (e) {
|
|
1228
1386
|
var target = e.args.target;
|
|
1229
1387
|
// eslint-disable-next-line
|
|
@@ -1234,6 +1392,7 @@ var Table = /** @class */ (function () {
|
|
|
1234
1392
|
this.popupObj.hide();
|
|
1235
1393
|
}
|
|
1236
1394
|
if (this.editdlgObj) {
|
|
1395
|
+
this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
|
|
1237
1396
|
this.editdlgObj.hide();
|
|
1238
1397
|
}
|
|
1239
1398
|
this.parent.isBlur = true;
|
|
@@ -1260,10 +1419,10 @@ var Table = /** @class */ (function () {
|
|
|
1260
1419
|
var rowDiv;
|
|
1261
1420
|
var tableCell;
|
|
1262
1421
|
for (var row = 0; row < 3; row++) {
|
|
1263
|
-
rowDiv = this.parent.createElement('div', { className: 'e-rte-table-row' +
|
|
1422
|
+
rowDiv = this.parent.createElement('div', { className: 'e-rte-table-row' + this.parent.getCssClass(true), attrs: { 'data-column': '' + row } });
|
|
1264
1423
|
for (var col = 0; col < 10; col++) {
|
|
1265
1424
|
var display = (row > 2) ? 'none' : 'inline-block';
|
|
1266
|
-
tableCell = this.parent.createElement('div', { className: 'e-rte-tablecell e-default' +
|
|
1425
|
+
tableCell = this.parent.createElement('div', { className: 'e-rte-tablecell e-default' + this.parent.getCssClass(true), attrs: { 'data-cell': '' + col } });
|
|
1267
1426
|
rowDiv.appendChild(tableCell);
|
|
1268
1427
|
tableCell.style.display = display;
|
|
1269
1428
|
if (col === 0 && row === 0) {
|
|
@@ -1287,13 +1446,13 @@ var Table = /** @class */ (function () {
|
|
|
1287
1446
|
height: 'initial', width: '290px', content: editContent, header: editHeader,
|
|
1288
1447
|
buttons: [{
|
|
1289
1448
|
click: this.applyProperties.bind(this, args),
|
|
1290
|
-
buttonModel: { content: update, cssClass: 'e-flat e-size-update' +
|
|
1449
|
+
buttonModel: { content: update, cssClass: 'e-flat e-size-update' + this.parent.getCssClass(true), isPrimary: true }
|
|
1291
1450
|
},
|
|
1292
1451
|
{
|
|
1293
1452
|
click: function (e) {
|
|
1294
1453
|
_this.cancelDialog(e);
|
|
1295
1454
|
},
|
|
1296
|
-
buttonModel: { cssClass: 'e-flat e-cancel' +
|
|
1455
|
+
buttonModel: { cssClass: 'e-flat e-cancel' + this.parent.getCssClass(true), content: cancel }
|
|
1297
1456
|
}],
|
|
1298
1457
|
cssClass: this.editdlgObj.cssClass + ' e-rte-edit-table-prop-dialog'
|
|
1299
1458
|
});
|
|
@@ -1335,10 +1494,10 @@ var Table = /** @class */ (function () {
|
|
|
1335
1494
|
Table.prototype.tableCellDlgContent = function () {
|
|
1336
1495
|
var tableColumn = this.l10n.getConstant('columns');
|
|
1337
1496
|
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' +
|
|
1497
|
+
var tableWrap = this.parent.createElement('div', { className: 'e-cell-wrap' + this.parent.getCssClass(true) });
|
|
1498
|
+
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" '
|
|
1499
|
+
+ ' data-role ="none" id="tableColumn" class="e-table-column' + this.parent.getCssClass(true) + '"/></div>'
|
|
1500
|
+
+ '<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
1501
|
var contentElem = parseHtml(content);
|
|
1343
1502
|
tableWrap.appendChild(contentElem);
|
|
1344
1503
|
this.columnTextBox = new NumericTextBox({
|
|
@@ -1349,7 +1508,7 @@ var Table = /** @class */ (function () {
|
|
|
1349
1508
|
floatLabelType: 'Auto',
|
|
1350
1509
|
max: 50,
|
|
1351
1510
|
enableRtl: this.parent.enableRtl, locale: this.parent.locale,
|
|
1352
|
-
cssClass: this.parent.
|
|
1511
|
+
cssClass: this.parent.getCssClass()
|
|
1353
1512
|
});
|
|
1354
1513
|
this.columnTextBox.isStringTemplate = true;
|
|
1355
1514
|
this.columnTextBox.appendTo(tableWrap.querySelector('#tableColumn'));
|
|
@@ -1361,7 +1520,7 @@ var Table = /** @class */ (function () {
|
|
|
1361
1520
|
floatLabelType: 'Auto',
|
|
1362
1521
|
max: 1000,
|
|
1363
1522
|
enableRtl: this.parent.enableRtl, locale: this.parent.locale,
|
|
1364
|
-
cssClass: this.parent.
|
|
1523
|
+
cssClass: this.parent.getCssClass()
|
|
1365
1524
|
});
|
|
1366
1525
|
this.rowTextBox.isStringTemplate = true;
|
|
1367
1526
|
this.rowTextBox.appendTo(tableWrap.querySelector('#tableRow'));
|
|
@@ -1382,7 +1541,7 @@ var Table = /** @class */ (function () {
|
|
|
1382
1541
|
return;
|
|
1383
1542
|
}
|
|
1384
1543
|
var tableDialog = this.parent.createElement('div', {
|
|
1385
|
-
className: 'e-rte-edit-table' +
|
|
1544
|
+
className: 'e-rte-edit-table' + this.parent.getCssClass(true), id: this.rteID + '_tabledialog'
|
|
1386
1545
|
});
|
|
1387
1546
|
this.parent.element.appendChild(tableDialog);
|
|
1388
1547
|
var insert = this.l10n.getConstant('dialogInsert');
|
|
@@ -1390,20 +1549,20 @@ var Table = /** @class */ (function () {
|
|
|
1390
1549
|
var header = this.l10n.getConstant('tabledialogHeader');
|
|
1391
1550
|
var dialogModel = {
|
|
1392
1551
|
header: header,
|
|
1393
|
-
cssClass: classes.CLS_RTE_ELEMENTS +
|
|
1552
|
+
cssClass: classes.CLS_RTE_ELEMENTS + this.parent.getCssClass(true),
|
|
1394
1553
|
enableRtl: this.parent.enableRtl,
|
|
1395
1554
|
locale: this.parent.locale,
|
|
1396
1555
|
showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'initial',
|
|
1397
1556
|
position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
|
|
1398
1557
|
isModal: Browser.isDevice,
|
|
1399
1558
|
buttons: [{
|
|
1400
|
-
buttonModel: { content: insert, cssClass: 'e-flat e-insert-table' +
|
|
1559
|
+
buttonModel: { content: insert, cssClass: 'e-flat e-insert-table' + this.parent.getCssClass(true), isPrimary: true }
|
|
1401
1560
|
},
|
|
1402
1561
|
{
|
|
1403
1562
|
click: function (e) {
|
|
1404
1563
|
_this.cancelDialog(e);
|
|
1405
1564
|
},
|
|
1406
|
-
buttonModel: { cssClass: 'e-flat e-cancel' +
|
|
1565
|
+
buttonModel: { cssClass: 'e-flat e-cancel' + this.parent.getCssClass(true), content: cancel }
|
|
1407
1566
|
}],
|
|
1408
1567
|
target: (Browser.isDevice) ? document.body : this.parent.element,
|
|
1409
1568
|
animationSettings: { effect: 'None' },
|
|
@@ -1476,13 +1635,13 @@ var Table = /** @class */ (function () {
|
|
|
1476
1635
|
var tableWidth = this.l10n.getConstant('tableWidth');
|
|
1477
1636
|
var cellPadding = this.l10n.getConstant('cellpadding');
|
|
1478
1637
|
var cellSpacing = this.l10n.getConstant('cellspacing');
|
|
1479
|
-
var tableWrap = this.parent.createElement('div', { className: 'e-table-sizewrap' +
|
|
1638
|
+
var tableWrap = this.parent.createElement('div', { className: 'e-table-sizewrap' + this.parent.getCssClass(true) });
|
|
1480
1639
|
var widthVal = closest(selectNode, 'table').getClientRects()[0].width;
|
|
1481
1640
|
var padVal = closest(selectNode, 'td').style.padding;
|
|
1482
1641
|
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' +
|
|
1642
|
+
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) + '" '
|
|
1643
|
+
+ ' /></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) + '" />'
|
|
1644
|
+
+ ' </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
1645
|
var contentElem = parseHtml(content);
|
|
1487
1646
|
tableWrap.appendChild(contentElem);
|
|
1488
1647
|
this.tableWidthNum = new NumericTextBox({
|
|
@@ -1525,7 +1684,7 @@ var Table = /** @class */ (function () {
|
|
|
1525
1684
|
* @function destroy
|
|
1526
1685
|
* @returns {void}
|
|
1527
1686
|
* @hidden
|
|
1528
|
-
|
|
1687
|
+
* @deprecated
|
|
1529
1688
|
*/
|
|
1530
1689
|
Table.prototype.destroy = function () {
|
|
1531
1690
|
if (isNOU(this.parent)) {
|
|
@@ -1544,6 +1703,22 @@ var Table = /** @class */ (function () {
|
|
|
1544
1703
|
Table.prototype.getModuleName = function () {
|
|
1545
1704
|
return 'table';
|
|
1546
1705
|
};
|
|
1706
|
+
Table.prototype.afterKeyDown = function (e) {
|
|
1707
|
+
var _this = this;
|
|
1708
|
+
if (this.curTable) {
|
|
1709
|
+
setTimeout(function () {
|
|
1710
|
+
_this.updateResizeIconPosition();
|
|
1711
|
+
}, 1);
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
Table.prototype.updateResizeIconPosition = function () {
|
|
1715
|
+
var tableReBox = this.parent.contentModule.getEditPanel().querySelector('.e-table-box');
|
|
1716
|
+
if (!isNOU(tableReBox)) {
|
|
1717
|
+
var tablePosition = this.calcPos(this.curTable);
|
|
1718
|
+
tableReBox.style.cssText = 'top: ' + (tablePosition.top + parseInt(getComputedStyle(this.curTable).height, 10) - 4) +
|
|
1719
|
+
'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
|
|
1720
|
+
}
|
|
1721
|
+
};
|
|
1547
1722
|
return Table;
|
|
1548
1723
|
}());
|
|
1549
1724
|
export { Table };
|