@syncfusion/ej2-richtexteditor 24.2.4 → 24.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +669 -272
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +662 -269
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/common/util.js +4 -1
- package/src/editor-manager/plugin/dom-node.js +3 -1
- package/src/editor-manager/plugin/format-painter-actions.d.ts +1 -0
- package/src/editor-manager/plugin/format-painter-actions.js +18 -0
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +37 -2
- package/src/editor-manager/plugin/inserthtml.js +15 -2
- package/src/editor-manager/plugin/lists.js +85 -63
- package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
- package/src/editor-manager/plugin/nodecutter.js +1 -1
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +56 -1
- package/src/editor-manager/plugin/table.js +1 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.js +4 -4
- package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
- package/src/rich-text-editor/actions/color-picker.js +10 -0
- package/src/rich-text-editor/actions/enter-key.js +2 -2
- package/src/rich-text-editor/actions/html-editor.js +25 -12
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.js +4 -1
- package/src/rich-text-editor/base/constant.d.ts +5 -0
- package/src/rich-text-editor/base/constant.js +5 -0
- package/src/rich-text-editor/base/interface.d.ts +0 -8
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.js +33 -7
- package/src/rich-text-editor/base/util.js +3 -0
- package/src/rich-text-editor/models/default-locale.js +3 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +5 -1
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +31 -10
- package/src/rich-text-editor/renderer/table-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/table-module.js +200 -131
- package/src/rich-text-editor/renderer/toolbar-renderer.js +13 -13
- package/styles/bootstrap-dark.css +57 -22
- package/styles/bootstrap.css +61 -29
- package/styles/bootstrap4.css +48 -17
- package/styles/bootstrap5-dark.css +47 -18
- package/styles/bootstrap5.css +47 -18
- package/styles/fabric-dark.css +43 -12
- package/styles/fabric.css +43 -12
- package/styles/fluent-dark.css +51 -14
- package/styles/fluent.css +51 -14
- package/styles/highcontrast-light.css +43 -12
- package/styles/highcontrast.css +46 -12
- package/styles/material-dark.css +47 -12
- package/styles/material.css +47 -12
- package/styles/material3-dark.css +45 -14
- package/styles/material3.css +45 -14
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +12 -10
- package/styles/rich-text-editor/_bootstrap-definition.scss +18 -16
- package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
- package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
- package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_fabric-definition.scss +4 -2
- package/styles/rich-text-editor/_fluent-definition.scss +5 -3
- package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
- package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
- package/styles/rich-text-editor/_layout.scss +46 -6
- package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_material-definition.scss +4 -2
- package/styles/rich-text-editor/_material3-definition.scss +6 -4
- package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
- package/styles/rich-text-editor/_theme.scss +65 -16
- package/styles/rich-text-editor/bootstrap-dark.css +57 -22
- package/styles/rich-text-editor/bootstrap.css +61 -29
- package/styles/rich-text-editor/bootstrap4.css +48 -17
- package/styles/rich-text-editor/bootstrap5-dark.css +47 -18
- package/styles/rich-text-editor/bootstrap5.css +47 -18
- package/styles/rich-text-editor/fabric-dark.css +43 -12
- package/styles/rich-text-editor/fabric.css +43 -12
- package/styles/rich-text-editor/fluent-dark.css +51 -14
- package/styles/rich-text-editor/fluent.css +51 -14
- package/styles/rich-text-editor/highcontrast-light.css +43 -12
- package/styles/rich-text-editor/highcontrast.css +46 -12
- package/styles/rich-text-editor/material-dark.css +47 -12
- package/styles/rich-text-editor/material.css +47 -12
- package/styles/rich-text-editor/material3-dark.css +45 -14
- package/styles/rich-text-editor/material3.css +45 -14
- package/styles/rich-text-editor/tailwind-dark.css +98 -35
- package/styles/rich-text-editor/tailwind.css +98 -35
- package/styles/tailwind-dark.css +98 -35
- package/styles/tailwind.css +98 -35
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
|
@@ -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,6 @@ var Table = /** @class */ (function () {
|
|
|
17
17
|
this.pageY = null;
|
|
18
18
|
this.moveEle = null;
|
|
19
19
|
this.currentColumnResize = '';
|
|
20
|
-
this.currentMarginLeft = 0;
|
|
21
20
|
this.parent = parent;
|
|
22
21
|
this.rteID = parent.element.id;
|
|
23
22
|
this.l10n = serviceLocator.getService('rteLocale');
|
|
@@ -633,7 +632,7 @@ var Table = /** @class */ (function () {
|
|
|
633
632
|
};
|
|
634
633
|
Table.prototype.tableResizeEleCreation = function (table, e) {
|
|
635
634
|
this.parent.preventDefaultResize(e);
|
|
636
|
-
var columns =
|
|
635
|
+
var columns = this.calMaxCol(this.curTable);
|
|
637
636
|
var rows = [];
|
|
638
637
|
for (var i = 0; i < table.rows.length; i++) {
|
|
639
638
|
for (var j = 0; j < table.rows[i].cells.length; j++) {
|
|
@@ -655,11 +654,11 @@ var Table = /** @class */ (function () {
|
|
|
655
654
|
colReEle.classList.add(classes.CLS_RTE_TABLE_RESIZE, classes.CLS_TB_COL_RES);
|
|
656
655
|
if (columns.length === i) {
|
|
657
656
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
658
|
-
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
|
|
657
|
+
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
|
|
659
658
|
}
|
|
660
659
|
else {
|
|
661
660
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
662
|
-
'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
|
|
661
|
+
'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
|
|
663
662
|
}
|
|
664
663
|
this.contentModule.getEditPanel().appendChild(colReEle);
|
|
665
664
|
}
|
|
@@ -691,7 +690,7 @@ var Table = /** @class */ (function () {
|
|
|
691
690
|
};
|
|
692
691
|
Table.prototype.removeResizeElement = function () {
|
|
693
692
|
var item = this.parent.contentModule.getEditPanel().
|
|
694
|
-
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box
|
|
693
|
+
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
|
|
695
694
|
if (item.length > 0) {
|
|
696
695
|
for (var i = 0; i < item.length; i++) {
|
|
697
696
|
detach(item[i]);
|
|
@@ -765,6 +764,7 @@ var Table = /** @class */ (function () {
|
|
|
765
764
|
if (target.classList.contains(classes.CLS_TB_COL_RES) ||
|
|
766
765
|
target.classList.contains(classes.CLS_TB_ROW_RES) ||
|
|
767
766
|
target.classList.contains(classes.CLS_TB_BOX_RES)) {
|
|
767
|
+
this.resetResizeHelper(this.curTable);
|
|
768
768
|
e.preventDefault();
|
|
769
769
|
this.parent.preventDefaultResize(e);
|
|
770
770
|
removeClass(this.curTable.querySelectorAll('td,th'), classes.CLS_TABLE_SEL);
|
|
@@ -775,9 +775,10 @@ var Table = /** @class */ (function () {
|
|
|
775
775
|
this.hideTableQuickToolbar();
|
|
776
776
|
if (target.classList.contains(classes.CLS_TB_COL_RES)) {
|
|
777
777
|
this.resizeBtnStat.column = true;
|
|
778
|
-
if (parseInt(target.getAttribute('data-col'), 10) === this.
|
|
778
|
+
if (parseInt(target.getAttribute('data-col'), 10) === this.calMaxCol(this.curTable).length) {
|
|
779
779
|
this.currentColumnResize = 'last';
|
|
780
|
-
this.
|
|
780
|
+
this.colIndex = parseInt(target.getAttribute('data-col'), 10) - 1;
|
|
781
|
+
this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
|
|
781
782
|
}
|
|
782
783
|
else {
|
|
783
784
|
if (parseInt(target.getAttribute('data-col'), 10) === 0) {
|
|
@@ -785,10 +786,48 @@ var Table = /** @class */ (function () {
|
|
|
785
786
|
}
|
|
786
787
|
else {
|
|
787
788
|
this.currentColumnResize = 'middle';
|
|
789
|
+
var cellColl = this.curTable.rows[0].cells;
|
|
790
|
+
var cellCount = 0;
|
|
791
|
+
for (var cell = 0; cell < cellColl.length; cell++) {
|
|
792
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
793
|
+
}
|
|
794
|
+
var sizes = new Array(cellCount);
|
|
795
|
+
var colGroupEle = createElement('colgroup');
|
|
796
|
+
var rowSpanCells = new Map();
|
|
797
|
+
for (var i = 0; i < this.curTable.rows.length; i++) {
|
|
798
|
+
var currentColIndex = 0;
|
|
799
|
+
for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
800
|
+
for (var l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
|
|
801
|
+
var key = "" + (i + l) + currentColIndex;
|
|
802
|
+
rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
|
|
803
|
+
}
|
|
804
|
+
var cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
805
|
+
if (cellIndex > currentColIndex) {
|
|
806
|
+
currentColIndex = cellIndex;
|
|
807
|
+
}
|
|
808
|
+
var width = this.curTable.rows[i].cells[k].offsetWidth;
|
|
809
|
+
if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
|
|
810
|
+
sizes[currentColIndex] = width;
|
|
811
|
+
}
|
|
812
|
+
currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
for (var size = 0; size < sizes.length; size++) {
|
|
816
|
+
var cell = createElement('col');
|
|
817
|
+
cell.appendChild(createElement('br'));
|
|
818
|
+
cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
|
|
819
|
+
colGroupEle.appendChild(cell);
|
|
820
|
+
}
|
|
821
|
+
this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
|
|
822
|
+
for (var i = 0; i < this.curTable.rows.length; i++) {
|
|
823
|
+
for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
824
|
+
this.curTable.rows[i].cells[k].style.width = '';
|
|
825
|
+
}
|
|
826
|
+
}
|
|
788
827
|
}
|
|
789
|
-
this.
|
|
828
|
+
this.colIndex = parseInt(target.getAttribute('data-col'), 10);
|
|
829
|
+
this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
|
|
790
830
|
}
|
|
791
|
-
this.colIndex = this.columnEle.cellIndex;
|
|
792
831
|
this.moveEle = e.target;
|
|
793
832
|
this.appendHelper();
|
|
794
833
|
}
|
|
@@ -817,6 +856,16 @@ var Table = /** @class */ (function () {
|
|
|
817
856
|
EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
|
|
818
857
|
}
|
|
819
858
|
};
|
|
859
|
+
Table.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
|
|
860
|
+
var cellKey = "" + rowIndex + colIndex;
|
|
861
|
+
var spannedCell = rowSpanCells.get(cellKey);
|
|
862
|
+
if (spannedCell) {
|
|
863
|
+
return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
return colIndex;
|
|
867
|
+
}
|
|
868
|
+
};
|
|
820
869
|
Table.prototype.removeHelper = function (e) {
|
|
821
870
|
var cls = e.target.classList;
|
|
822
871
|
if (!(cls.contains('e-reicon')) && this.helper) {
|
|
@@ -845,12 +894,12 @@ var Table = /** @class */ (function () {
|
|
|
845
894
|
this.helper.classList.add('e-column-helper');
|
|
846
895
|
this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
|
|
847
896
|
pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
|
|
848
|
-
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth
|
|
897
|
+
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
|
|
849
898
|
}
|
|
850
899
|
else {
|
|
851
900
|
this.helper.classList.add('e-row-helper');
|
|
852
901
|
this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
|
|
853
|
-
(this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
|
|
902
|
+
(this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
|
|
854
903
|
'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
|
|
855
904
|
}
|
|
856
905
|
};
|
|
@@ -858,24 +907,42 @@ var Table = /** @class */ (function () {
|
|
|
858
907
|
var pos = this.calcPos(this.curTable);
|
|
859
908
|
if (this.resizeBtnStat.column) {
|
|
860
909
|
var left = (pos.left + this.calcPos(this.columnEle).left) +
|
|
861
|
-
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth
|
|
910
|
+
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
|
|
862
911
|
this.helper.style.left = left + 'px';
|
|
912
|
+
this.helper.style.height = this.curTable.offsetHeight + 'px';
|
|
863
913
|
}
|
|
864
914
|
else {
|
|
865
|
-
var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
|
|
915
|
+
var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
|
|
866
916
|
this.helper.style.top = top_1 + 'px';
|
|
867
917
|
}
|
|
868
918
|
};
|
|
869
|
-
Table.prototype.calMaxCol = function (
|
|
870
|
-
var
|
|
871
|
-
var
|
|
872
|
-
for (var
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
919
|
+
Table.prototype.calMaxCol = function (curTable) {
|
|
920
|
+
var cellColl = curTable.rows[0].cells;
|
|
921
|
+
var cellCount = 0;
|
|
922
|
+
for (var cell = 0; cell < cellColl.length; cell++) {
|
|
923
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
924
|
+
}
|
|
925
|
+
var cells = new Array(cellCount);
|
|
926
|
+
var rowSpanCells = new Map();
|
|
927
|
+
for (var i = 0; i < curTable.rows.length; i++) {
|
|
928
|
+
var currentColIndex = 0;
|
|
929
|
+
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
930
|
+
for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
|
|
931
|
+
var key = "" + (i + l) + currentColIndex;
|
|
932
|
+
rowSpanCells.set(key, curTable.rows[i].cells[k]);
|
|
933
|
+
}
|
|
934
|
+
var cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
935
|
+
if (cellIndex > currentColIndex) {
|
|
936
|
+
currentColIndex = cellIndex;
|
|
937
|
+
}
|
|
938
|
+
var width = curTable.rows[i].cells[k].offsetWidth;
|
|
939
|
+
if (!cells[currentColIndex] || width < cells[currentColIndex].offsetWidth) {
|
|
940
|
+
cells[currentColIndex] = curTable.rows[i].cells[k];
|
|
941
|
+
}
|
|
942
|
+
currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
|
|
876
943
|
}
|
|
877
944
|
}
|
|
878
|
-
return
|
|
945
|
+
return cells;
|
|
879
946
|
};
|
|
880
947
|
Table.prototype.resizing = function (e) {
|
|
881
948
|
var _this = this;
|
|
@@ -888,10 +955,6 @@ var Table = /** @class */ (function () {
|
|
|
888
955
|
var maxiumWidth;
|
|
889
956
|
var currentTdElement = this.curTable.closest('td');
|
|
890
957
|
var args = { event: e, requestType: 'table' };
|
|
891
|
-
var isRowCellsMerged = false;
|
|
892
|
-
var isColCellsMerged = false;
|
|
893
|
-
var mergedCellIndex;
|
|
894
|
-
var mergedElement;
|
|
895
958
|
this.parent.trigger(events.onResize, args, function (resizingArgs) {
|
|
896
959
|
if (resizingArgs.cancel) {
|
|
897
960
|
_this.cancelResizeAction();
|
|
@@ -916,8 +979,7 @@ var Table = /** @class */ (function () {
|
|
|
916
979
|
widthCompare = rteWidth;
|
|
917
980
|
}
|
|
918
981
|
if (_this.resizeBtnStat.column) {
|
|
919
|
-
var
|
|
920
|
-
var cellRow = _this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
|
|
982
|
+
var colGroup = _this.curTable.querySelectorAll('colgroup > col');
|
|
921
983
|
var currentTableWidth = void 0;
|
|
922
984
|
if (_this.curTable.style.width !== '' && _this.curTable.style.width.includes('%')) {
|
|
923
985
|
currentTableWidth = parseFloat(_this.curTable.style.width.split('%')[0]);
|
|
@@ -925,7 +987,8 @@ var Table = /** @class */ (function () {
|
|
|
925
987
|
else {
|
|
926
988
|
currentTableWidth = _this.getCurrentTableWidth(_this.curTable.offsetWidth, _this.parent.inputElement.offsetWidth);
|
|
927
989
|
}
|
|
928
|
-
var
|
|
990
|
+
var currentCol = _this.calMaxCol(_this.curTable)[_this.colIndex];
|
|
991
|
+
var currentColResizableWidth = _this.getCurrentColWidth(currentCol, tableWidth);
|
|
929
992
|
if (_this.currentColumnResize === 'first') {
|
|
930
993
|
mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
|
|
931
994
|
_this.removeResizeElement();
|
|
@@ -934,16 +997,25 @@ var Table = /** @class */ (function () {
|
|
|
934
997
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
935
998
|
}
|
|
936
999
|
// Below the value '100' is the 100% width of the parent element.
|
|
937
|
-
if (((mouseX !== 0 && 5 <
|
|
1000
|
+
if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX < 0) && currentTableWidth <= 100 &&
|
|
938
1001
|
_this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) <= 100) {
|
|
939
1002
|
var firstColumnsCell = _this.findFirstLastColCells(_this.curTable, true);
|
|
940
1003
|
_this.curTable.style.width = _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) > 100 ? (100 + '%') :
|
|
941
1004
|
(_this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) + '%');
|
|
942
1005
|
var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare);
|
|
943
|
-
|
|
944
|
-
_this.curTable.style.marginLeft
|
|
1006
|
+
var preMarginLeft = 0;
|
|
1007
|
+
if (!isNullOrUndefined(_this.curTable.style.marginLeft) && _this.curTable.style.marginLeft !== '') {
|
|
1008
|
+
var regex = /[-+]?\d*\.\d+|\d+/;
|
|
1009
|
+
var value = _this.curTable.style.marginLeft.match(regex);
|
|
1010
|
+
if (!isNullOrUndefined(value)) {
|
|
1011
|
+
preMarginLeft = parseFloat(value[0]);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
var currentMarginLeft = preMarginLeft + differenceWidth;
|
|
1015
|
+
_this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : currentMarginLeft) + '%)';
|
|
945
1016
|
for (var i = 0; i < firstColumnsCell.length; i++) {
|
|
946
|
-
_this.
|
|
1017
|
+
var currentColumnCellWidth = _this.getCurrentColWidth(firstColumnsCell[i], tableWidth);
|
|
1018
|
+
firstColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
947
1019
|
}
|
|
948
1020
|
}
|
|
949
1021
|
}
|
|
@@ -955,112 +1027,48 @@ var Table = /** @class */ (function () {
|
|
|
955
1027
|
_this.curTable.style.maxWidth = maxiumWidth + 'px';
|
|
956
1028
|
}
|
|
957
1029
|
// Below the value '100' is the 100% width of the parent element.
|
|
958
|
-
if (((mouseX !== 0 && 5 <
|
|
1030
|
+
if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX > 0) &&
|
|
959
1031
|
currentTableWidth <= 100 && _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
|
|
960
1032
|
var lastColumnsCell = _this.findFirstLastColCells(_this.curTable, false);
|
|
961
1033
|
_this.curTable.style.width = _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) > 100 ? (100 + '%') : (_this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%');
|
|
962
1034
|
var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
|
|
963
1035
|
for (var i = 0; i < lastColumnsCell.length; i++) {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
_this.colIndex - 1 : _this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
967
|
-
}
|
|
1036
|
+
var currentColumnCellWidth = _this.getCurrentColWidth(lastColumnsCell[i], tableWidth);
|
|
1037
|
+
lastColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
|
|
968
1038
|
}
|
|
969
1039
|
}
|
|
970
1040
|
}
|
|
971
1041
|
else {
|
|
972
|
-
var
|
|
973
|
-
|
|
974
|
-
var totalwid =
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
var
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
var rightColWidth = actualwid;
|
|
981
|
-
var index = void 0;
|
|
982
|
-
var isMergedEleResize = false;
|
|
983
|
-
var leftTableCell = void 0;
|
|
984
|
-
var rightTableCell = void 0;
|
|
985
|
-
isColCellsMerged = false;
|
|
986
|
-
isRowCellsMerged = false;
|
|
987
|
-
/* eslint-disable */
|
|
988
|
-
for (var j = 0; j < currentRow.cells.length; j++) {
|
|
989
|
-
if (currentRow.cells[j].hasAttribute('rowspan') && j <= _this.colIndex) {
|
|
990
|
-
isRowCellsMerged = true;
|
|
991
|
-
mergedCellIndex = i;
|
|
992
|
-
mergedElement = currentRow.cells[j];
|
|
993
|
-
}
|
|
994
|
-
else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
|
|
995
|
-
isColCellsMerged = true;
|
|
996
|
-
mergedCellIndex = i;
|
|
997
|
-
mergedElement = currentRow.cells[j];
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
if (!isNOU(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
|
|
1001
|
-
index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
|
|
1002
|
-
}
|
|
1003
|
-
else {
|
|
1004
|
-
index = _this.colIndex;
|
|
1005
|
-
}
|
|
1006
|
-
if (isRowCellsMerged || isColCellsMerged) {
|
|
1007
|
-
var currentResizeRow = void 0;
|
|
1008
|
-
if (currentRow.cells.length < cellColl.length) {
|
|
1009
|
-
index = currentRow.cells.length === _this.colIndex || currentRow === _this.curTable.rows[_this.curTable.rows.length - 1] ?
|
|
1010
|
-
_this.colIndex - 1 : _this.colIndex;
|
|
1011
|
-
currentResizeRow = _this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
|
|
1012
|
-
mergedCellIndex : _this.colIndex - 1];
|
|
1013
|
-
if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[_this.colIndex - 1] === mergedElement ||
|
|
1014
|
-
currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
|
|
1015
|
-
isMergedEleResize = true;
|
|
1016
|
-
}
|
|
1017
|
-
else {
|
|
1018
|
-
isMergedEleResize = false;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
else {
|
|
1022
|
-
index = _this.colIndex;
|
|
1023
|
-
}
|
|
1024
|
-
leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
|
|
1025
|
-
currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
|
|
1026
|
-
currentResizeRow.cells[_this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
|
|
1027
|
-
rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
|
|
1028
|
-
currentResizeRow.cells[_this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
|
|
1029
|
-
currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
|
|
1030
|
-
}
|
|
1031
|
-
if (!isNOU(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
|
|
1032
|
-
currentRow.cells[index - 1].style.width =
|
|
1033
|
-
_this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1034
|
-
}
|
|
1035
|
-
else {
|
|
1036
|
-
if (leftTableCell) {
|
|
1037
|
-
leftTableCell.style.width =
|
|
1038
|
-
_this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
if (!isNOU(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
|
|
1042
|
-
currentRow.cells[index].style.width =
|
|
1043
|
-
_this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1044
|
-
}
|
|
1045
|
-
else {
|
|
1046
|
-
if (rightTableCell) {
|
|
1047
|
-
rightTableCell.style.width =
|
|
1048
|
-
_this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
/* eslint-enable */
|
|
1052
|
-
}
|
|
1042
|
+
var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
|
|
1043
|
+
// eslint-disable-next-line
|
|
1044
|
+
var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
|
|
1045
|
+
if ((totalwid - actualwid) > 20 && actualwid > 20) {
|
|
1046
|
+
var leftColumnWidth = totalwid - actualwid;
|
|
1047
|
+
var rightColWidth = actualwid;
|
|
1048
|
+
colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
1049
|
+
colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
1053
1050
|
}
|
|
1054
1051
|
}
|
|
1055
1052
|
_this.updateHelper();
|
|
1056
1053
|
}
|
|
1057
1054
|
else if (_this.resizeBtnStat.row) {
|
|
1058
1055
|
_this.parent.preventDefaultResize(e);
|
|
1059
|
-
var
|
|
1060
|
-
|
|
1061
|
-
|
|
1056
|
+
var tableTrElementPixel = [];
|
|
1057
|
+
var currentTableTrElement = _this.curTable.querySelectorAll('tr');
|
|
1058
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1059
|
+
if (_this.rowEle !== currentTableTrElement[i]) {
|
|
1060
|
+
tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
_this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + ((mouseY > 0) ? 0 : mouseY)) + 'px';
|
|
1064
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1065
|
+
if (_this.rowEle === currentTableTrElement[i]) {
|
|
1066
|
+
currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
|
|
1067
|
+
}
|
|
1068
|
+
else {
|
|
1069
|
+
currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
|
|
1070
|
+
}
|
|
1062
1071
|
}
|
|
1063
|
-
_this.curTable.style.height = '';
|
|
1064
1072
|
if (!isNOU(tableReBox)) {
|
|
1065
1073
|
tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
|
|
1066
1074
|
'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
|
|
@@ -1087,6 +1095,16 @@ var Table = /** @class */ (function () {
|
|
|
1087
1095
|
}
|
|
1088
1096
|
});
|
|
1089
1097
|
};
|
|
1098
|
+
Table.prototype.getCurrentColWidth = function (col, tableWidth) {
|
|
1099
|
+
var currentColWidth = 0;
|
|
1100
|
+
if (col.style.width !== '' && col.style.width.includes('%')) {
|
|
1101
|
+
currentColWidth = parseFloat(col.style.width.split('%')[0]);
|
|
1102
|
+
}
|
|
1103
|
+
else {
|
|
1104
|
+
currentColWidth = this.convertPixelToPercentage(col.offsetWidth, tableWidth);
|
|
1105
|
+
}
|
|
1106
|
+
return currentColWidth;
|
|
1107
|
+
};
|
|
1090
1108
|
Table.prototype.getCurrentTableWidth = function (tableWidth, parentWidth) {
|
|
1091
1109
|
var currentTableWidth = 0;
|
|
1092
1110
|
currentTableWidth = tableWidth / parentWidth * 100;
|
|
@@ -1094,12 +1112,22 @@ var Table = /** @class */ (function () {
|
|
|
1094
1112
|
};
|
|
1095
1113
|
Table.prototype.findFirstLastColCells = function (table, isFirst) {
|
|
1096
1114
|
var resultColumns = [];
|
|
1097
|
-
var rows = table.
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1115
|
+
var rows = table.rows;
|
|
1116
|
+
var rowSpanCellIndexs = new Array();
|
|
1117
|
+
var _loop_1 = function (i) {
|
|
1118
|
+
var cellIndex = isFirst ? 0 : rows[i].cells.length - 1;
|
|
1119
|
+
var column = rows[i].cells[cellIndex];
|
|
1120
|
+
for (var rowSpan = 1; rowSpan < column.rowSpan; rowSpan++) {
|
|
1121
|
+
var key = i + rowSpan + "-" + cellIndex;
|
|
1122
|
+
rowSpanCellIndexs.push(key);
|
|
1123
|
+
}
|
|
1124
|
+
var spannedCellKey = i + "-" + cellIndex;
|
|
1125
|
+
if (rowSpanCellIndexs.length === 0 || (isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1) || (!isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1 && rowSpanCellIndexs.every(function (key) { return key.split('-')[0] !== i.toString(); }))) {
|
|
1126
|
+
resultColumns.push(column);
|
|
1102
1127
|
}
|
|
1128
|
+
};
|
|
1129
|
+
for (var i = 0; i < rows.length; i++) {
|
|
1130
|
+
_loop_1(i);
|
|
1103
1131
|
}
|
|
1104
1132
|
return resultColumns;
|
|
1105
1133
|
};
|
|
@@ -1123,13 +1151,47 @@ var Table = /** @class */ (function () {
|
|
|
1123
1151
|
detach(this.helper);
|
|
1124
1152
|
this.helper = null;
|
|
1125
1153
|
}
|
|
1154
|
+
this.resetResizeHelper(this.curTable);
|
|
1126
1155
|
this.pageX = null;
|
|
1127
1156
|
this.pageY = null;
|
|
1128
1157
|
this.moveEle = null;
|
|
1158
|
+
var currentTableTrElement = this.curTable.querySelectorAll("tr");
|
|
1159
|
+
var tableTrPercentage = [];
|
|
1160
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1161
|
+
var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
|
|
1162
|
+
tableTrPercentage[i] = percentage;
|
|
1163
|
+
}
|
|
1164
|
+
for (var i = 0; i < currentTableTrElement.length; i++) {
|
|
1165
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
1166
|
+
}
|
|
1129
1167
|
var args = { event: e, requestType: 'table' };
|
|
1130
1168
|
this.parent.trigger(events.resizeStop, args);
|
|
1131
1169
|
this.parent.formatter.saveData();
|
|
1132
1170
|
};
|
|
1171
|
+
Table.prototype.resetResizeHelper = function (curTable) {
|
|
1172
|
+
var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
|
|
1173
|
+
Array.from(colHelper).forEach(function (element) {
|
|
1174
|
+
if (element.parentNode) {
|
|
1175
|
+
element.parentNode.removeChild(element);
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
var rowHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-row-helper');
|
|
1179
|
+
Array.from(rowHelper).forEach(function (element) {
|
|
1180
|
+
if (element.parentNode) {
|
|
1181
|
+
element.parentNode.removeChild(element);
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
var colGroup = curTable.querySelector('colgroup');
|
|
1185
|
+
if (colGroup) {
|
|
1186
|
+
for (var i = 0; i < curTable.rows.length; i++) {
|
|
1187
|
+
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
1188
|
+
var width = this.convertPixelToPercentage(curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(curTable).width, 10)) + '%';
|
|
1189
|
+
curTable.rows[i].cells[k].style.width = width;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
curTable.removeChild(colGroup);
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1133
1195
|
Table.prototype.resizeBtnInit = function () {
|
|
1134
1196
|
return this.resizeBtnStat = { column: false, row: false, tableBox: false };
|
|
1135
1197
|
};
|
|
@@ -1239,6 +1301,7 @@ var Table = /** @class */ (function () {
|
|
|
1239
1301
|
if (!isNOU(this.parent.cssClass)) {
|
|
1240
1302
|
addClass([this.popupObj.element], this.parent.getCssClass());
|
|
1241
1303
|
}
|
|
1304
|
+
btnEle.focus();
|
|
1242
1305
|
this.popupObj.refreshPosition(target);
|
|
1243
1306
|
};
|
|
1244
1307
|
Table.prototype.onIframeMouseDown = function () {
|
|
@@ -1571,12 +1634,18 @@ var Table = /** @class */ (function () {
|
|
|
1571
1634
|
var _this = this;
|
|
1572
1635
|
if (this.curTable) {
|
|
1573
1636
|
setTimeout(function () {
|
|
1574
|
-
|
|
1575
|
-
mouseOverEvent.initEvent('mouseover', true, true);
|
|
1576
|
-
_this.curTable.dispatchEvent(mouseOverEvent);
|
|
1637
|
+
_this.updateResizeIconPosition();
|
|
1577
1638
|
}, 1);
|
|
1578
1639
|
}
|
|
1579
1640
|
};
|
|
1641
|
+
Table.prototype.updateResizeIconPosition = function () {
|
|
1642
|
+
var tableReBox = this.parent.contentModule.getEditPanel().querySelector('.e-table-box');
|
|
1643
|
+
if (!isNOU(tableReBox)) {
|
|
1644
|
+
var tablePosition = this.calcPos(this.curTable);
|
|
1645
|
+
tableReBox.style.cssText = 'top: ' + (tablePosition.top + parseInt(getComputedStyle(this.curTable).height, 10) - 4) +
|
|
1646
|
+
'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1580
1649
|
return Table;
|
|
1581
1650
|
}());
|
|
1582
1651
|
export { Table };
|
|
@@ -108,6 +108,19 @@ var ToolbarRenderer = /** @class */ (function () {
|
|
|
108
108
|
addClass([listEle[1], listEle[2]], 'e-disabled');
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
+
if (this.parent.showTooltip) {
|
|
112
|
+
this.dropdownTooltip = new Tooltip({
|
|
113
|
+
target: '[aria-owns="' + this.parent.getID() + '"].e-rte-elements [title]',
|
|
114
|
+
showTipPointer: true,
|
|
115
|
+
openDelay: 400,
|
|
116
|
+
opensOn: 'Hover',
|
|
117
|
+
beforeRender: this.tooltipBeforeRender.bind(this),
|
|
118
|
+
cssClass: this.parent.getCssClass(),
|
|
119
|
+
windowCollision: true,
|
|
120
|
+
position: 'BottomCenter'
|
|
121
|
+
});
|
|
122
|
+
this.dropdownTooltip.appendTo(args.element);
|
|
123
|
+
}
|
|
111
124
|
this.parent.notify(events.selectionSave, args);
|
|
112
125
|
};
|
|
113
126
|
ToolbarRenderer.prototype.dropDownClose = function (args) {
|
|
@@ -152,19 +165,6 @@ var ToolbarRenderer = /** @class */ (function () {
|
|
|
152
165
|
});
|
|
153
166
|
this.tooltip.appendTo(args.target);
|
|
154
167
|
}
|
|
155
|
-
if (this.parent.showTooltip) {
|
|
156
|
-
this.dropdownTooltip = new Tooltip({
|
|
157
|
-
target: '[aria-owns="' + this.parent.getID() + '"].e-rte-elements [title]',
|
|
158
|
-
showTipPointer: true,
|
|
159
|
-
openDelay: 400,
|
|
160
|
-
opensOn: 'Hover',
|
|
161
|
-
beforeRender: this.tooltipBeforeRender.bind(this),
|
|
162
|
-
cssClass: this.parent.getCssClass(),
|
|
163
|
-
windowCollision: true,
|
|
164
|
-
position: 'BottomCenter'
|
|
165
|
-
});
|
|
166
|
-
this.dropdownTooltip.appendTo(document.body);
|
|
167
|
-
}
|
|
168
168
|
};
|
|
169
169
|
/**
|
|
170
170
|
* renderDropDownButton method
|