@atlaskit/editor-plugin-table 5.7.9 → 5.8.0
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 +19 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/commands/column-resize.js +155 -0
- package/dist/cjs/commands/go-to-next-cell.js +15 -0
- package/dist/cjs/commands/selection.js +16 -3
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -1
- package/dist/cjs/plugin.js +2 -1
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/cjs/pm-plugins/keymap.js +9 -0
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +18 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
- package/dist/cjs/types.js +8 -1
- package/dist/cjs/ui/DragHandle/index.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +187 -17
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/styles.js +19 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/cjs/ui/ui-styles.js +6 -2
- package/dist/cjs/utils/decoration.js +14 -4
- package/dist/es2019/commands/column-resize.js +149 -0
- package/dist/es2019/commands/go-to-next-cell.js +13 -0
- package/dist/es2019/commands/selection.js +16 -3
- package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -1
- package/dist/es2019/plugin.js +2 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/es2019/pm-plugins/keymap.js +10 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +19 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/types.js +8 -1
- package/dist/es2019/ui/DragHandle/index.js +1 -1
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +177 -7
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/styles.js +62 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/es2019/ui/consts.js +2 -1
- package/dist/es2019/ui/ui-styles.js +108 -65
- package/dist/es2019/utils/decoration.js +14 -4
- package/dist/esm/commands/column-resize.js +149 -0
- package/dist/esm/commands/go-to-next-cell.js +15 -0
- package/dist/esm/commands/selection.js +16 -3
- package/dist/esm/nodeviews/ExternalDropTargets.js +2 -1
- package/dist/esm/plugin.js +2 -1
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/esm/pm-plugins/keymap.js +10 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +19 -8
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/types.js +8 -1
- package/dist/esm/ui/DragHandle/index.js +1 -1
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +177 -7
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/styles.js +12 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/esm/ui/consts.js +2 -1
- package/dist/esm/ui/ui-styles.js +7 -3
- package/dist/esm/utils/decoration.js +14 -4
- package/dist/types/commands/column-resize.d.ts +5 -0
- package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/types.d.ts +7 -0
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +3 -0
- package/dist/types/ui/consts.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +2 -2
- package/dist/types-ts4.5/commands/column-resize.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +7 -0
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +3 -0
- package/dist/types-ts4.5/ui/consts.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +2 -2
- package/package.json +8 -4
- package/src/__tests__/unit/analytics.ts +5 -1
- package/src/__tests__/unit/ui/FloatingDragMenu.tsx +295 -0
- package/src/__tests__/unit/ui/RowDragControls.tsx +5 -4
- package/src/commands/column-resize.ts +257 -0
- package/src/commands/go-to-next-cell.ts +21 -0
- package/src/commands/selection.ts +19 -2
- package/src/nodeviews/ExternalDropTargets.tsx +1 -0
- package/src/plugin.tsx +1 -0
- package/src/pm-plugins/drag-and-drop/commands.ts +3 -2
- package/src/pm-plugins/drag-and-drop/plugin.ts +10 -4
- package/src/pm-plugins/keymap.ts +35 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +33 -21
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
- package/src/types.ts +9 -0
- package/src/ui/DragHandle/index.tsx +1 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +226 -7
- package/src/ui/FloatingDragMenu/index.tsx +4 -1
- package/src/ui/FloatingDragMenu/styles.ts +71 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +35 -37
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +33 -33
- package/src/ui/consts.ts +6 -1
- package/src/ui/ui-styles.ts +115 -64
- package/src/utils/decoration.ts +27 -8
- package/tsconfig.app.json +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -786,116 +786,159 @@ export const resizeHandle = () => css`
|
|
|
786
786
|
`;
|
|
787
787
|
|
|
788
788
|
// Drag and Drop: drop target insert line
|
|
789
|
+
const tableCellColumnInsertLineStyles = css`
|
|
790
|
+
content: ' ';
|
|
791
|
+
position: absolute;
|
|
792
|
+
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
793
|
+
width: ${insertLineWidth}px;
|
|
794
|
+
z-index: ${columnControlsZIndex * 2};
|
|
795
|
+
`;
|
|
796
|
+
const tableCellRowInsertLineStyles = css`
|
|
797
|
+
content: ' ';
|
|
798
|
+
position: absolute;
|
|
799
|
+
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
800
|
+
height: ${insertLineWidth}px;
|
|
801
|
+
width: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
802
|
+
z-index: ${columnControlsZIndex * 2};
|
|
803
|
+
`;
|
|
804
|
+
const insertLineActiveColor = css`
|
|
805
|
+
background-color: ${tableBorderSelectedColor};
|
|
806
|
+
`;
|
|
807
|
+
const insertLineInactiveColor = css`
|
|
808
|
+
background-color: ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
|
|
809
|
+
`;
|
|
789
810
|
export const insertLine = () => css`
|
|
790
811
|
.${ClassName.TABLE_CONTAINER} {
|
|
791
812
|
td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
|
|
792
|
-
|
|
793
|
-
position: absolute;
|
|
813
|
+
${tableCellColumnInsertLineStyles}
|
|
794
814
|
left: -1px;
|
|
795
815
|
top: -1px;
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
816
|
+
${insertLineActiveColor}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
820
|
+
${tableCellColumnInsertLineStyles}
|
|
821
|
+
left: -1px;
|
|
822
|
+
top: -1px;
|
|
823
|
+
${insertLineInactiveColor}
|
|
800
824
|
}
|
|
801
825
|
|
|
802
826
|
th.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
|
|
803
|
-
|
|
827
|
+
${tableCellColumnInsertLineStyles}
|
|
828
|
+
left: -1px;
|
|
829
|
+
top: -${tableCellBorderWidth}px;
|
|
830
|
+
${insertLineActiveColor}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
th.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
834
|
+
${tableCellColumnInsertLineStyles}
|
|
804
835
|
left: -1px;
|
|
805
|
-
position: absolute;
|
|
806
|
-
width: ${insertLineWidth}px;
|
|
807
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
808
|
-
background-color: ${tableBorderSelectedColor};
|
|
809
|
-
z-index: ${columnControlsZIndex * 2};
|
|
810
836
|
top: -${tableCellBorderWidth}px;
|
|
837
|
+
${insertLineInactiveColor}
|
|
811
838
|
}
|
|
812
839
|
|
|
813
840
|
td.${ClassName.WITH_COLUMN_INSERT_LINE}::before {
|
|
814
|
-
|
|
815
|
-
position: absolute;
|
|
841
|
+
${tableCellColumnInsertLineStyles}
|
|
816
842
|
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
817
843
|
top: -1px;
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
844
|
+
${insertLineActiveColor}
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
td.${ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
848
|
+
${tableCellColumnInsertLineStyles}
|
|
849
|
+
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
850
|
+
top: -1px;
|
|
851
|
+
${insertLineInactiveColor}
|
|
822
852
|
}
|
|
823
853
|
|
|
824
854
|
th.${ClassName.WITH_COLUMN_INSERT_LINE}::before {
|
|
825
|
-
|
|
855
|
+
${tableCellColumnInsertLineStyles}
|
|
856
|
+
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
857
|
+
top: -${tableCellBorderWidth}px;
|
|
858
|
+
${insertLineActiveColor}
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
th.${ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
862
|
+
${tableCellColumnInsertLineStyles}
|
|
826
863
|
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
827
|
-
position: absolute;
|
|
828
|
-
width: ${insertLineWidth}px;
|
|
829
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
830
|
-
background-color: ${tableBorderSelectedColor};
|
|
831
|
-
z-index: ${columnControlsZIndex * 2};
|
|
832
864
|
top: -${tableCellBorderWidth}px;
|
|
865
|
+
${insertLineInactiveColor}
|
|
833
866
|
}
|
|
834
867
|
|
|
835
868
|
td.${ClassName.WITH_LAST_COLUMN_INSERT_LINE}::before {
|
|
836
|
-
|
|
837
|
-
position: absolute;
|
|
869
|
+
${tableCellColumnInsertLineStyles}
|
|
838
870
|
right: -1px;
|
|
839
871
|
top: -1px;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
872
|
+
${insertLineActiveColor}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
td.${ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
876
|
+
${tableCellColumnInsertLineStyles}
|
|
877
|
+
right: -1px;
|
|
878
|
+
top: -1px;
|
|
879
|
+
${insertLineInactiveColor}
|
|
844
880
|
}
|
|
845
881
|
|
|
846
882
|
th.${ClassName.WITH_LAST_COLUMN_INSERT_LINE}::before {
|
|
847
|
-
|
|
883
|
+
${tableCellColumnInsertLineStyles}
|
|
884
|
+
right: -1px;
|
|
885
|
+
top: -${tableCellBorderWidth}px;
|
|
886
|
+
${insertLineActiveColor}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
th.${ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
890
|
+
${tableCellColumnInsertLineStyles}
|
|
848
891
|
right: -1px;
|
|
849
|
-
position: absolute;
|
|
850
|
-
width: ${insertLineWidth}px;
|
|
851
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
852
|
-
background-color: ${tableBorderSelectedColor};
|
|
853
|
-
z-index: ${columnControlsZIndex * 2};
|
|
854
892
|
top: -${tableCellBorderWidth}px;
|
|
893
|
+
${insertLineInactiveColor}
|
|
855
894
|
}
|
|
856
895
|
|
|
857
896
|
td.${ClassName.WITH_ROW_INSERT_LINE}::before {
|
|
858
|
-
|
|
859
|
-
position: absolute;
|
|
860
|
-
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
897
|
+
${tableCellRowInsertLineStyles}
|
|
861
898
|
top: -1px;
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
899
|
+
${insertLineActiveColor}
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
td.${ClassName.WITH_ROW_INSERT_LINE_INACTIVE}::before {
|
|
903
|
+
${tableCellRowInsertLineStyles}
|
|
904
|
+
top: -1px;
|
|
905
|
+
${insertLineInactiveColor}
|
|
866
906
|
}
|
|
867
907
|
|
|
868
908
|
th.${ClassName.WITH_ROW_INSERT_LINE}::before {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
909
|
+
${tableCellRowInsertLineStyles}
|
|
910
|
+
top: -1px;
|
|
911
|
+
${insertLineActiveColor}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
th.${ClassName.WITH_ROW_INSERT_LINE_INACTIVE}::before {
|
|
915
|
+
${tableCellRowInsertLineStyles}
|
|
876
916
|
top: -1px;
|
|
917
|
+
${insertLineInactiveColor}
|
|
877
918
|
}
|
|
878
919
|
|
|
879
920
|
td.${ClassName.WITH_LAST_ROW_INSERT_LINE}::before {
|
|
880
|
-
|
|
881
|
-
position: absolute;
|
|
882
|
-
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
921
|
+
${tableCellRowInsertLineStyles}
|
|
883
922
|
bottom: 0;
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
923
|
+
${insertLineActiveColor}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
td.${ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE}::before {
|
|
927
|
+
${tableCellRowInsertLineStyles}
|
|
928
|
+
bottom: 0;
|
|
929
|
+
${insertLineInactiveColor}
|
|
888
930
|
}
|
|
889
931
|
|
|
890
932
|
th.${ClassName.WITH_LAST_ROW_INSERT_LINE}::before {
|
|
891
|
-
|
|
892
|
-
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
933
|
+
${tableCellRowInsertLineStyles}
|
|
893
934
|
bottom: 0;
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
935
|
+
${insertLineActiveColor}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
th.${ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE}::before {
|
|
939
|
+
${tableCellRowInsertLineStyles}
|
|
940
|
+
bottom: 0;
|
|
941
|
+
${insertLineInactiveColor}
|
|
899
942
|
}
|
|
900
943
|
}
|
|
901
944
|
`;
|
|
@@ -426,7 +426,7 @@ export const createColumnLineResize = (selection, cellColumnPositioning) => {
|
|
|
426
426
|
});
|
|
427
427
|
}).filter(nonNullable);
|
|
428
428
|
};
|
|
429
|
-
export const createColumnInsertLine = (columnIndex, selection) => {
|
|
429
|
+
export const createColumnInsertLine = (columnIndex, selection, hasMergedCells) => {
|
|
430
430
|
const table = findTable(selection);
|
|
431
431
|
if (!table) {
|
|
432
432
|
return [];
|
|
@@ -437,7 +437,12 @@ export const createColumnInsertLine = (columnIndex, selection) => {
|
|
|
437
437
|
if (isLastColumn) {
|
|
438
438
|
columnIndex -= 1;
|
|
439
439
|
}
|
|
440
|
-
|
|
440
|
+
let decorationClassName;
|
|
441
|
+
if (hasMergedCells) {
|
|
442
|
+
decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE : ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE;
|
|
443
|
+
} else {
|
|
444
|
+
decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE : ClassName.WITH_COLUMN_INSERT_LINE;
|
|
445
|
+
}
|
|
441
446
|
const cellPositions = makeArray(map.height).map(rowIndex => map.map[map.width * rowIndex + columnIndex]).filter((cellPosition, rowIndex) => {
|
|
442
447
|
if (isLastColumn) {
|
|
443
448
|
return true; // If is the last column no filter applied
|
|
@@ -462,7 +467,7 @@ export const createColumnInsertLine = (columnIndex, selection) => {
|
|
|
462
467
|
});
|
|
463
468
|
}).filter(nonNullable);
|
|
464
469
|
};
|
|
465
|
-
export const createRowInsertLine = (rowIndex, selection) => {
|
|
470
|
+
export const createRowInsertLine = (rowIndex, selection, hasMergedCells) => {
|
|
466
471
|
const table = findTable(selection);
|
|
467
472
|
if (!table) {
|
|
468
473
|
return [];
|
|
@@ -476,7 +481,12 @@ export const createRowInsertLine = (rowIndex, selection) => {
|
|
|
476
481
|
if (!cells) {
|
|
477
482
|
return [];
|
|
478
483
|
}
|
|
479
|
-
|
|
484
|
+
let decorationClassName;
|
|
485
|
+
if (hasMergedCells) {
|
|
486
|
+
decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE : ClassName.WITH_ROW_INSERT_LINE_INACTIVE;
|
|
487
|
+
} else {
|
|
488
|
+
decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE : ClassName.WITH_ROW_INSERT_LINE;
|
|
489
|
+
}
|
|
480
490
|
return cells.map((cell, index) => {
|
|
481
491
|
if (!cell || !cell.node) {
|
|
482
492
|
return;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
|
+
import { TableMap } from '@atlaskit/editor-tables';
|
|
3
|
+
import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/src/utils';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { getPluginState as getTableResizingPluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
|
|
6
|
+
import { currentColWidth, getResizeState, getTableMaxWidth, resizeColumn, updateControls } from '../pm-plugins/table-resizing/utils';
|
|
7
|
+
import { updateColumnWidths } from '../transforms';
|
|
8
|
+
import { getSelectedColumnIndexes } from '../utils';
|
|
9
|
+
import { addResizeHandleDecorations, showResizeHandleLine } from './index';
|
|
10
|
+
var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos) {
|
|
11
|
+
return function (state, dispatch) {
|
|
12
|
+
addResizeHandleDecorations(rowIndex, columnIndex, true)(state, dispatch);
|
|
13
|
+
// Currently only 'right' position is used in showResizeHandleLine
|
|
14
|
+
showResizeHandleLine({
|
|
15
|
+
left: 0,
|
|
16
|
+
right: columnIndex
|
|
17
|
+
})(state, dispatch);
|
|
18
|
+
tableResizingPluginCreateCommand({
|
|
19
|
+
type: 'SET_RESIZE_HANDLE_POSITION',
|
|
20
|
+
data: {
|
|
21
|
+
resizeHandlePos: nextResizeHandlePos
|
|
22
|
+
}
|
|
23
|
+
})(state, dispatch);
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(state, dispatch, view) {
|
|
28
|
+
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
var selection = state.selection;
|
|
32
|
+
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
33
|
+
var cell = findCellClosestToPos(selection.$from);
|
|
34
|
+
if (selectionRect && cell && view) {
|
|
35
|
+
var cellAttrs = cell.node.attrs;
|
|
36
|
+
var width = currentColWidth(view, cell.pos, cellAttrs);
|
|
37
|
+
updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
38
|
+
tableResizingPluginCreateCommand({
|
|
39
|
+
type: 'SET_DRAGGING',
|
|
40
|
+
data: {
|
|
41
|
+
dragging: {
|
|
42
|
+
startX: 0,
|
|
43
|
+
startWidth: width
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
})(state, dispatch);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
51
|
+
export var activateNextResizeArea = function activateNextResizeArea(direction) {
|
|
52
|
+
return function (state, dispatch) {
|
|
53
|
+
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
var _ref = getTableResizingPluginState(state) || {},
|
|
57
|
+
resizeHandlePos = _ref.resizeHandlePos,
|
|
58
|
+
dragging = _ref.dragging;
|
|
59
|
+
// If No resizing has initiated, skip to regular handler
|
|
60
|
+
if (!resizeHandlePos || !dragging) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
var selection = state.selection;
|
|
64
|
+
var cell = findCellClosestToPos(selection.$from);
|
|
65
|
+
if (!cell) {
|
|
66
|
+
// cursor position may be changed by mouse to be outside of table;
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
var $currentCell = state.doc.resolve(resizeHandlePos);
|
|
70
|
+
if (!$currentCell) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
var tableNode = $currentCell.node(-1);
|
|
74
|
+
var closestTable = findTableClosestToPos($currentCell);
|
|
75
|
+
var tableMap = TableMap.get(tableNode);
|
|
76
|
+
if (!tableNode || !closestTable || !tableMap) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
var currentCellRect = tableMap.findCell($currentCell.pos - $currentCell.start(-1));
|
|
80
|
+
var $nextCell = nextCell($currentCell, 'horiz', direction);
|
|
81
|
+
if ($nextCell) {
|
|
82
|
+
// we are somewhere in between the side columns of the table
|
|
83
|
+
var offset = $nextCell.pos - $nextCell.start(-1);
|
|
84
|
+
var rectForNextCell = tableMap.findCell(offset);
|
|
85
|
+
updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch);
|
|
86
|
+
} else {
|
|
87
|
+
// current position is in the one of the side columns of the table(left or right)
|
|
88
|
+
if (currentCellRect.left === 0) {
|
|
89
|
+
var lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
|
|
90
|
+
var $lastCell = state.doc.resolve(lastCellInCurrentRow);
|
|
91
|
+
updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch);
|
|
92
|
+
} else if (tableMap.width === currentCellRect.right) {
|
|
93
|
+
var firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
|
|
94
|
+
var _$nextCell = state.doc.resolve(firsCellInCurrentRow);
|
|
95
|
+
updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export var changeColumnWidthByStep = function changeColumnWidthByStep(stepSize, getEditorContainerWidth) {
|
|
102
|
+
return function (state, dispatch, view) {
|
|
103
|
+
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
var _getTableResizingPlug = getTableResizingPluginState(state),
|
|
107
|
+
resizeHandlePos = _getTableResizingPlug.resizeHandlePos,
|
|
108
|
+
dragging = _getTableResizingPlug.dragging;
|
|
109
|
+
if (!view || !resizeHandlePos || !dragging) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
var $cell = state.doc.resolve(resizeHandlePos);
|
|
113
|
+
var tableStartPosition = $cell.start(-1);
|
|
114
|
+
var originalTable = $cell.node(-1);
|
|
115
|
+
var map = TableMap.get(originalTable);
|
|
116
|
+
var domAtPos = view.domAtPos.bind(view);
|
|
117
|
+
var colIndex = map.colCount($cell.pos - tableStartPosition) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
|
|
118
|
+
var dom = domAtPos(tableStartPosition).node;
|
|
119
|
+
if (dom && dom.nodeName !== 'TABLE') {
|
|
120
|
+
dom = dom.closest('table');
|
|
121
|
+
}
|
|
122
|
+
var maxSize = getTableMaxWidth({
|
|
123
|
+
table: originalTable,
|
|
124
|
+
tableStart: tableStartPosition,
|
|
125
|
+
state: state,
|
|
126
|
+
layout: originalTable.attrs.layout,
|
|
127
|
+
getEditorContainerWidth: getEditorContainerWidth
|
|
128
|
+
});
|
|
129
|
+
var initialResizeState = getResizeState({
|
|
130
|
+
minWidth: tableCellMinWidth,
|
|
131
|
+
maxSize: maxSize,
|
|
132
|
+
table: originalTable,
|
|
133
|
+
tableRef: dom,
|
|
134
|
+
start: tableStartPosition,
|
|
135
|
+
domAtPos: domAtPos
|
|
136
|
+
});
|
|
137
|
+
updateControls()(state);
|
|
138
|
+
var selectionRect = getSelectionRect(state.selection);
|
|
139
|
+
var selectedColumns = selectionRect ? getSelectedColumnIndexes(selectionRect) : [];
|
|
140
|
+
// only selected (or selected - 1) columns should be distributed
|
|
141
|
+
var resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
142
|
+
var newResizeState = resizeColumn(initialResizeState, colIndex, stepSize, dom, resizingSelectedColumns ? selectedColumns : undefined);
|
|
143
|
+
var tr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(state.tr);
|
|
144
|
+
if (dispatch) {
|
|
145
|
+
dispatch(tr);
|
|
146
|
+
}
|
|
147
|
+
return true;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
@@ -4,7 +4,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import { goToNextCell as baseGotoNextCell, findTable } from '@atlaskit/editor-tables/utils';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { insertRowWithAnalytics } from '../commands-with-analytics';
|
|
9
|
+
import { getPluginState as getResizePluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
|
|
10
|
+
import { hideResizeHandleLine } from './hover';
|
|
8
11
|
var TAB_FORWARD_DIRECTION = 1;
|
|
9
12
|
var TAB_BACKWARD_DIRECTION = -1;
|
|
10
13
|
export var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
|
|
@@ -14,6 +17,18 @@ export var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
|
|
|
14
17
|
if (!table) {
|
|
15
18
|
return false;
|
|
16
19
|
}
|
|
20
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
21
|
+
var _getResizePluginState;
|
|
22
|
+
var isColumnResizing = !!((_getResizePluginState = getResizePluginState(state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
|
|
23
|
+
if (isColumnResizing) {
|
|
24
|
+
tableResizingPluginCreateCommand({
|
|
25
|
+
type: 'STOP_RESIZING'
|
|
26
|
+
}, function (originalTr) {
|
|
27
|
+
return (state.tr || originalTr).setMeta('scrollIntoView', false);
|
|
28
|
+
})(state, dispatch);
|
|
29
|
+
hideResizeHandleLine()(state, dispatch);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
17
32
|
var map = TableMap.get(table.node);
|
|
18
33
|
var _state$schema$nodes = state.schema.nodes,
|
|
19
34
|
tableCell = _state$schema$nodes.tableCell,
|
|
@@ -3,7 +3,9 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import { findTable, isColumnSelected, isRowSelected, isTableSelected, selectedRect } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { selectColumn, selectRow } from '../commands/misc';
|
|
8
|
+
import { getPluginState as getResizePluginState } from '../pm-plugins/table-resizing/plugin-factory';
|
|
7
9
|
import { getClosestSelectionRect } from '../toolbar';
|
|
8
10
|
export var TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
|
|
9
11
|
TableSelectionDirection["TopToBottom"] = "TopToBottom";
|
|
@@ -192,9 +194,14 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
|
|
|
192
194
|
var table = findTable(selection);
|
|
193
195
|
if (table) {
|
|
194
196
|
var $from = selection.$from;
|
|
197
|
+
var isColumnResizing = false;
|
|
198
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
199
|
+
var columResizePluginState = getResizePluginState(state) || {};
|
|
200
|
+
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
|
|
201
|
+
}
|
|
195
202
|
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
|
|
196
203
|
// + 3 for: row, cell & paragraph nodes
|
|
197
|
-
editorSelectionAPI) {
|
|
204
|
+
editorSelectionAPI && !isColumnResizing) {
|
|
198
205
|
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
199
206
|
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
|
|
200
207
|
// we have a text selection at start of first table cell, directly inside a top level paragraph,
|
|
@@ -221,8 +228,14 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
|
|
|
221
228
|
var table = findTable(selection);
|
|
222
229
|
if (table) {
|
|
223
230
|
var $to = selection.$to;
|
|
224
|
-
|
|
225
|
-
) {
|
|
231
|
+
var isColumnResizing = false;
|
|
232
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
233
|
+
var columResizePluginState = getResizePluginState(state) || {};
|
|
234
|
+
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
|
|
235
|
+
}
|
|
236
|
+
if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
|
|
237
|
+
// + 3 for: row, cell & paragraph nodes
|
|
238
|
+
!isColumnResizing) {
|
|
226
239
|
// we have a text selection at end of last table cell, directly inside a top level paragraph,
|
|
227
240
|
// and want to set a full table cell selection
|
|
228
241
|
return selectFullTable(editorSelectionAPI)({
|
|
@@ -45,7 +45,8 @@ export var ExternalDropTargets = function ExternalDropTargets(_ref) {
|
|
|
45
45
|
top: "-".concat(dropTargetExtendedWidth - tableMarginTop, "px"),
|
|
46
46
|
pointerEvents: 'auto',
|
|
47
47
|
zIndex: "".concat(dropTargetsZIndex)
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"data-testid": "table-floating-column-extended-drop-targets"
|
|
49
50
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
51
|
style: {
|
|
51
52
|
display: 'flex',
|
package/dist/esm/plugin.js
CHANGED
|
@@ -355,7 +355,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
355
355
|
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
356
356
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
357
357
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
358
|
-
stickyHeaders: stickyHeader
|
|
358
|
+
stickyHeaders: stickyHeader,
|
|
359
|
+
pluginConfig: pluginConfig
|
|
359
360
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
360
361
|
editorView: editorView,
|
|
361
362
|
selection: editorView.state.selection,
|
|
@@ -17,7 +17,7 @@ export var getDecorations = function getDecorations(state) {
|
|
|
17
17
|
export var updatePluginStateDecorations = function updatePluginStateDecorations(state, decorations, key) {
|
|
18
18
|
return updateDecorations(state.doc, getDecorations(state), decorations, key);
|
|
19
19
|
};
|
|
20
|
-
export var setDropTarget = function setDropTarget(type, index, tr) {
|
|
20
|
+
export var setDropTarget = function setDropTarget(type, index, hasMergedCells, tr) {
|
|
21
21
|
return createCommand(function (state) {
|
|
22
22
|
var _getPluginState = getPluginState(state),
|
|
23
23
|
dropTargetType = _getPluginState.dropTargetType,
|
|
@@ -27,9 +27,9 @@ export var setDropTarget = function setDropTarget(type, index, tr) {
|
|
|
27
27
|
}
|
|
28
28
|
var decorationSet = DecorationSet.empty;
|
|
29
29
|
if (type === 'column') {
|
|
30
|
-
decorationSet = updatePluginStateDecorations(state, createColumnInsertLine(index, state.selection), TableDecorations.COLUMN_INSERT_LINE);
|
|
30
|
+
decorationSet = updatePluginStateDecorations(state, createColumnInsertLine(index, state.selection, hasMergedCells), TableDecorations.COLUMN_INSERT_LINE);
|
|
31
31
|
} else if (type === 'row') {
|
|
32
|
-
decorationSet = updatePluginStateDecorations(state, createRowInsertLine(index, state.selection), TableDecorations.ROW_INSERT_LINE);
|
|
32
|
+
decorationSet = updatePluginStateDecorations(state, createRowInsertLine(index, state.selection, hasMergedCells), TableDecorations.ROW_INSERT_LINE);
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
type: DragAndDropActionType.SET_DROP_TARGET,
|
|
@@ -131,7 +131,8 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
|
|
|
131
131
|
var sourceType = data.sourceType,
|
|
132
132
|
targetAdjustedIndex = data.targetAdjustedIndex;
|
|
133
133
|
var dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
|
|
134
|
-
|
|
134
|
+
var hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
135
|
+
setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
135
136
|
},
|
|
136
137
|
onDrop: function onDrop(event) {
|
|
137
138
|
var _cell$row, _cell$col;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, nextCell, previousCell, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
|
|
6
7
|
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
|
+
import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing } from '../commands/column-resize';
|
|
7
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
8
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
9
11
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
@@ -42,6 +44,13 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
42
44
|
bindKeymapWithCommand(deleteColumn.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
43
45
|
bindKeymapWithCommand(deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
44
46
|
}
|
|
47
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
48
|
+
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing, list);
|
|
49
|
+
bindKeymapWithCommand(moveRight.common, activateNextResizeArea(1), list);
|
|
50
|
+
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea(-1), list);
|
|
51
|
+
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStep(-10, getEditorContainerWidth), list);
|
|
52
|
+
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStep(10, getEditorContainerWidth), list);
|
|
53
|
+
}
|
|
45
54
|
return keymap(list);
|
|
46
55
|
}
|
|
47
56
|
export default keymapPlugin;
|
|
@@ -11,7 +11,7 @@ import { getSelectedColumnIndexes } from '../../utils';
|
|
|
11
11
|
import { META_KEYS } from '../table-analytics';
|
|
12
12
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
13
|
import { getPluginState } from './plugin-factory';
|
|
14
|
-
import { currentColWidth, getLayoutSize, getResizeState, pointsAtCell, resizeColumn, updateControls } from './utils';
|
|
14
|
+
import { currentColWidth, getLayoutSize, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, updateControls } from './utils';
|
|
15
15
|
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) {
|
|
16
16
|
var state = view.state,
|
|
17
17
|
dispatch = view.dispatch;
|
|
@@ -35,13 +35,24 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
35
35
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
36
36
|
dom = dom.closest('table');
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
var maxSize;
|
|
39
|
+
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
40
|
+
var containerWidth = getEditorContainerWidth();
|
|
41
|
+
var parentWidth = getParentNodeWidth(start, state, containerWidth);
|
|
42
|
+
maxSize = getBooleanFF('platform.editor.custom-table-width') ? parentWidth ||
|
|
43
|
+
// its safe to reference table width from node as this will not have changed
|
|
44
|
+
originalTable.attrs.width || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {}) : parentWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
|
|
45
|
+
if (originalTable.attrs.isNumberColumnEnabled) {
|
|
46
|
+
maxSize -= akEditorTableNumberColumnWidth;
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
maxSize = getTableMaxWidth({
|
|
50
|
+
table: originalTable,
|
|
51
|
+
tableStart: start,
|
|
52
|
+
state: state,
|
|
53
|
+
layout: originalTable.attrs.layout,
|
|
54
|
+
getEditorContainerWidth: getEditorContainerWidth
|
|
55
|
+
});
|
|
45
56
|
}
|
|
46
57
|
var resizeState = getResizeState({
|
|
47
58
|
minWidth: tableCellMinWidth,
|
|
@@ -3,7 +3,7 @@ export { contentWidth } from './content-width';
|
|
|
3
3
|
export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateColumnWidth, addContainerLeftRightPadding } from './column-state';
|
|
4
4
|
export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
|
|
5
5
|
export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths } from './resize-state';
|
|
6
|
-
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround } from './misc';
|
|
6
|
+
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth } from './misc';
|
|
7
7
|
export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
8
8
|
export { scale, scaleWithParent, scaleTable, previewScaleTable } from './scale-table';
|
|
9
9
|
export { resizeColumn } from './resize-column';
|