@atlaskit/editor-plugin-table 7.4.7 → 7.4.9
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 +12 -0
- package/dist/cjs/commands/insert.js +5 -12
- package/dist/cjs/plugin.js +17 -11
- package/dist/cjs/pm-plugins/table-width.js +53 -34
- package/dist/cjs/ui/FloatingContextualMenu/index.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +53 -8
- package/dist/cjs/ui/FloatingDragMenu/index.js +9 -5
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/cjs/utils/create.js +28 -0
- package/dist/cjs/utils/index.js +8 -1
- package/dist/es2019/commands/insert.js +7 -14
- package/dist/es2019/plugin.js +16 -10
- package/dist/es2019/pm-plugins/table-width.js +133 -114
- package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +42 -8
- package/dist/es2019/ui/FloatingDragMenu/index.js +10 -6
- package/dist/es2019/ui/consts.js +1 -0
- package/dist/es2019/utils/create.js +18 -0
- package/dist/es2019/utils/index.js +2 -1
- package/dist/esm/commands/insert.js +7 -14
- package/dist/esm/plugin.js +16 -10
- package/dist/esm/pm-plugins/table-width.js +53 -34
- package/dist/esm/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +50 -9
- package/dist/esm/ui/FloatingDragMenu/index.js +10 -6
- package/dist/esm/ui/consts.js +1 -0
- package/dist/esm/utils/create.js +21 -0
- package/dist/esm/utils/index.js +2 -1
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/plugin.d.ts +4 -0
- package/dist/types/pm-plugins/table-width.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +6 -1
- package/dist/types/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types/utils/create.d.ts +6 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/commands/insert.d.ts +3 -3
- package/dist/types-ts4.5/plugin.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +6 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/utils/create.d.ts +6 -0
- package/dist/types-ts4.5/utils/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/commands/insert.ts +35 -19
- package/src/plugin.tsx +32 -9
- package/src/pm-plugins/table-width.ts +71 -38
- package/src/ui/FloatingContextualMenu/index.tsx +2 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +16 -1
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +94 -50
- package/src/ui/FloatingDragMenu/index.tsx +8 -3
- package/src/ui/consts.ts +1 -0
- package/src/utils/create.ts +32 -0
- package/src/utils/index.ts +1 -0
|
@@ -13,7 +13,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
13
13
|
|
|
14
14
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
15
15
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
16
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
16
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
17
17
|
|
|
18
18
|
import DragMenu from './DragMenu';
|
|
19
19
|
|
|
@@ -63,7 +63,7 @@ const FloatingDragMenu = ({
|
|
|
63
63
|
? document.querySelector('#drag-handle-button-row')
|
|
64
64
|
: document.querySelector('#drag-handle-button-column');
|
|
65
65
|
|
|
66
|
-
const offset = direction === 'row' ? [-9,
|
|
66
|
+
const offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
67
67
|
|
|
68
68
|
if (
|
|
69
69
|
!targetHandleRef ||
|
|
@@ -72,7 +72,6 @@ const FloatingDragMenu = ({
|
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
|
|
76
75
|
return (
|
|
77
76
|
<Popup
|
|
78
77
|
alignX={direction === 'row' ? 'right' : undefined}
|
|
@@ -82,6 +81,7 @@ const FloatingDragMenu = ({
|
|
|
82
81
|
boundariesElement={boundariesElement}
|
|
83
82
|
scrollableElement={scrollableElement}
|
|
84
83
|
fitWidth={dragMenuDropdownWidth}
|
|
84
|
+
fitHeight={tablePopupMenuFitHeight}
|
|
85
85
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
86
86
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
87
87
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -105,6 +105,11 @@ const FloatingDragMenu = ({
|
|
|
105
105
|
getEditorContainerWidth={getEditorContainerWidth}
|
|
106
106
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
107
107
|
pluginConfig={pluginConfig}
|
|
108
|
+
fitWidth={dragMenuDropdownWidth}
|
|
109
|
+
fitHeight={tablePopupMenuFitHeight}
|
|
110
|
+
mountPoint={mountPoint}
|
|
111
|
+
boundariesElement={boundariesElement}
|
|
112
|
+
scrollableElement={scrollableElement}
|
|
108
113
|
/>
|
|
109
114
|
</Popup>
|
|
110
115
|
);
|
package/src/ui/consts.ts
CHANGED
|
@@ -125,6 +125,7 @@ export const stickyRowOffsetTop = 8;
|
|
|
125
125
|
export const stickyHeaderBorderBottomWidth = 1;
|
|
126
126
|
export const tableOverflowShadowWidth = 8;
|
|
127
127
|
export const tableOverflowShadowWidthWide = 32;
|
|
128
|
+
export const tablePopupMenuFitHeight = 188;
|
|
128
129
|
|
|
129
130
|
export const dropTargetsZIndex = 14;
|
|
130
131
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
|
|
5
|
+
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
6
|
+
|
|
7
|
+
export const createTableWithWidth =
|
|
8
|
+
(
|
|
9
|
+
isFullWidthModeEnabled?: boolean,
|
|
10
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags,
|
|
11
|
+
createTableProps?: {
|
|
12
|
+
rowsCount?: number;
|
|
13
|
+
colsCount?: number;
|
|
14
|
+
},
|
|
15
|
+
) =>
|
|
16
|
+
(schema: Schema) => {
|
|
17
|
+
const { tablePreserveWidth = false } = getEditorFeatureFlags
|
|
18
|
+
? getEditorFeatureFlags()
|
|
19
|
+
: {};
|
|
20
|
+
|
|
21
|
+
if (tablePreserveWidth && isFullWidthModeEnabled) {
|
|
22
|
+
return createTable({
|
|
23
|
+
schema,
|
|
24
|
+
tableWidth: TABLE_MAX_WIDTH,
|
|
25
|
+
...createTableProps,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return createTable({
|
|
29
|
+
schema,
|
|
30
|
+
...createTableProps,
|
|
31
|
+
});
|
|
32
|
+
};
|
package/src/utils/index.ts
CHANGED