@atlaskit/editor-plugin-table 7.6.14 → 7.7.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 +6 -0
- package/dist/cjs/commands/misc.js +0 -2
- package/dist/cjs/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/cjs/nodeviews/TableComponent.js +3 -18
- package/dist/cjs/nodeviews/TableContainer.js +2 -18
- package/dist/cjs/nodeviews/table.js +0 -2
- package/dist/cjs/plugin.js +3 -20
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -21
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -57
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +16 -28
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/cjs/reducer.js +0 -2
- package/dist/cjs/transforms/column-width.js +3 -5
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/cjs/ui/common-styles.js +5 -12
- package/dist/cjs/ui/ui-styles.js +7 -12
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/utils/nodes.js +5 -18
- package/dist/es2019/commands/misc.js +0 -2
- package/dist/es2019/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/es2019/nodeviews/TableComponent.js +3 -18
- package/dist/es2019/nodeviews/TableContainer.js +1 -16
- package/dist/es2019/nodeviews/table.js +0 -2
- package/dist/es2019/plugin.js +5 -24
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +8 -22
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +30 -53
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +14 -24
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/es2019/reducer.js +0 -5
- package/dist/es2019/transforms/column-width.js +3 -5
- package/dist/es2019/types.js +0 -1
- package/dist/es2019/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/es2019/ui/common-styles.js +15 -46
- package/dist/es2019/ui/ui-styles.js +34 -41
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/nodes.js +0 -15
- package/dist/esm/commands/misc.js +0 -2
- package/dist/esm/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/esm/nodeviews/TableComponent.js +3 -18
- package/dist/esm/nodeviews/TableContainer.js +2 -18
- package/dist/esm/nodeviews/table.js +0 -2
- package/dist/esm/plugin.js +5 -22
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +8 -22
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -57
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +16 -28
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/esm/reducer.js +0 -2
- package/dist/esm/transforms/column-width.js +3 -5
- package/dist/esm/types.js +0 -1
- package/dist/esm/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/esm/ui/common-styles.js +6 -13
- package/dist/esm/ui/ui-styles.js +7 -12
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/nodes.js +0 -13
- package/dist/types/nodeviews/TableContainer.d.ts +1 -2
- package/dist/types/nodeviews/types.d.ts +0 -1
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types/types.d.ts +0 -9
- package/dist/types/ui/FloatingContextualButton/index.d.ts +0 -2
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/nodes.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/types.d.ts +0 -1
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -9
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +0 -2
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes.d.ts +0 -1
- package/package.json +2 -5
- package/src/commands/misc.ts +0 -2
- package/src/nodeviews/OverflowShadowsObserver.ts +1 -6
- package/src/nodeviews/TableComponent.tsx +2 -25
- package/src/nodeviews/TableContainer.tsx +2 -26
- package/src/nodeviews/table.tsx +0 -2
- package/src/nodeviews/types.ts +0 -1
- package/src/plugin.tsx +4 -43
- package/src/pm-plugins/main.ts +0 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +8 -37
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +40 -61
- package/src/pm-plugins/table-resizing/utils/misc.ts +4 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -29
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +2 -13
- package/src/reducer.ts +0 -3
- package/src/transforms/column-width.ts +2 -10
- package/src/types.ts +0 -8
- package/src/ui/ColumnResizeWidget/index.tsx +10 -1
- package/src/ui/FloatingContextualButton/index.tsx +0 -2
- package/src/ui/common-styles.ts +15 -53
- package/src/ui/ui-styles.ts +34 -47
- package/src/utils/index.ts +0 -1
- package/src/utils/nodes.ts +0 -23
- package/dist/cjs/ui/LayoutButton/index.js +0 -206
- package/dist/es2019/ui/LayoutButton/index.js +0 -168
- package/dist/esm/ui/LayoutButton/index.js +0 -196
- package/dist/types/ui/LayoutButton/index.d.ts +0 -21
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +0 -21
- package/src/ui/LayoutButton/index.tsx +0 -217
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated, } from './selection';
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
|
-
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled,
|
|
3
|
+
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
5
|
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
@@ -6,7 +6,6 @@ export declare const containsHeaderRow: (table: PmNode) => boolean;
|
|
|
6
6
|
export declare const checkIfHeaderColumnEnabled: (selection: Selection) => boolean;
|
|
7
7
|
export declare const checkIfHeaderRowEnabled: (selection: Selection) => boolean;
|
|
8
8
|
export declare const checkIfNumberColumnEnabled: (selection: Selection) => boolean;
|
|
9
|
-
export declare const isLayoutSupported: (state: EditorState) => boolean;
|
|
10
9
|
export declare const getTableWidth: (node: PmNode) => number;
|
|
11
10
|
export declare const tablesHaveDifferentColumnWidths: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
12
11
|
export declare const tablesHaveDifferentNoOfColumns: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
@@ -34,7 +34,6 @@ type TableContainerProps = {
|
|
|
34
34
|
className: string;
|
|
35
35
|
containerWidth: EditorContainerWidth;
|
|
36
36
|
isTableResizingEnabled: boolean | undefined;
|
|
37
|
-
isBreakoutEnabled: boolean | undefined;
|
|
38
37
|
editorView: EditorView;
|
|
39
38
|
getPos: () => number | undefined;
|
|
40
39
|
tableRef: HTMLTableElement;
|
|
@@ -45,5 +44,5 @@ type TableContainerProps = {
|
|
|
45
44
|
tableWrapperHeight?: number;
|
|
46
45
|
isWholeTableInDanger?: boolean;
|
|
47
46
|
};
|
|
48
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: {
|
|
47
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth }, isTableResizingEnabled, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isTableScalingEnabled, isWholeTableInDanger, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
49
48
|
export {};
|
|
@@ -6,7 +6,6 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { PluginInjectionAPI } from '../types';
|
|
8
8
|
export type TableOptions = {
|
|
9
|
-
isBreakoutEnabled?: boolean;
|
|
10
9
|
isFullWidthModeEnabled?: boolean;
|
|
11
10
|
wasFullWidthModeEnabled?: boolean;
|
|
12
11
|
isTableResizingEnabled?: boolean;
|
|
@@ -13,7 +13,6 @@ export interface TablePluginOptions {
|
|
|
13
13
|
tableOptions: PluginConfig;
|
|
14
14
|
tableResizingEnabled?: boolean;
|
|
15
15
|
dragAndDropEnabled?: boolean;
|
|
16
|
-
breakoutEnabled?: boolean;
|
|
17
16
|
allowContextualMenu?: boolean;
|
|
18
17
|
fullWidthEnabled?: boolean;
|
|
19
18
|
wasFullWidthEnabled?: boolean;
|
|
@@ -5,4 +5,4 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider'
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape,
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -90,7 +90,6 @@ export interface TablePluginState {
|
|
|
90
90
|
insertColumnButtonIndex?: number;
|
|
91
91
|
insertRowButtonIndex?: number;
|
|
92
92
|
isFullWidthModeEnabled?: boolean;
|
|
93
|
-
layout?: TableLayout;
|
|
94
93
|
ordering?: TableColumnOrdering;
|
|
95
94
|
isResizeHandleWidgetAdded?: boolean;
|
|
96
95
|
resizeHandleRowIndex?: number;
|
|
@@ -101,7 +100,6 @@ export interface TablePluginState {
|
|
|
101
100
|
canCollapseTable?: boolean;
|
|
102
101
|
widthToWidest?: WidthToWidest;
|
|
103
102
|
getIntl: () => IntlShape;
|
|
104
|
-
isBreakoutEnabled?: boolean;
|
|
105
103
|
wasFullWidthModeEnabled?: boolean;
|
|
106
104
|
isTableResizingEnabled?: boolean;
|
|
107
105
|
isDragAndDropEnabled?: boolean;
|
|
@@ -128,7 +126,6 @@ export type TablePluginAction = {
|
|
|
128
126
|
tableRef?: HTMLTableElement;
|
|
129
127
|
tableNode?: PmNode;
|
|
130
128
|
tableWrapperTarget?: HTMLElement;
|
|
131
|
-
layout: TableLayout;
|
|
132
129
|
isHeaderRowEnabled: boolean;
|
|
133
130
|
isHeaderColumnEnabled: boolean;
|
|
134
131
|
};
|
|
@@ -236,11 +233,6 @@ export type TablePluginAction = {
|
|
|
236
233
|
targetCellPosition: number;
|
|
237
234
|
decorationSet: DecorationSet;
|
|
238
235
|
};
|
|
239
|
-
} | {
|
|
240
|
-
type: 'SET_TABLE_LAYOUT';
|
|
241
|
-
data: {
|
|
242
|
-
layout: TableLayout;
|
|
243
|
-
};
|
|
244
236
|
} | {
|
|
245
237
|
type: 'SHOW_INSERT_ROW_BUTTON';
|
|
246
238
|
data: {
|
|
@@ -315,7 +307,6 @@ export declare const TableCssClassName: {
|
|
|
315
307
|
CONTROLS_INSERT_BUTTON_WRAP: string;
|
|
316
308
|
CONTROLS_INSERT_LINE: string;
|
|
317
309
|
CONTROLS_BUTTON_OVERLAY: string;
|
|
318
|
-
LAYOUT_BUTTON: string;
|
|
319
310
|
DRAG_CONTROLS_INSERT_BUTTON: string;
|
|
320
311
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: string;
|
|
321
312
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
3
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -13,7 +12,6 @@ export interface Props {
|
|
|
13
12
|
mountPoint?: HTMLElement;
|
|
14
13
|
boundariesElement?: HTMLElement;
|
|
15
14
|
scrollableElement?: HTMLElement;
|
|
16
|
-
layout?: TableLayout;
|
|
17
15
|
isNumberColumnEnabled?: boolean;
|
|
18
16
|
stickyHeader?: RowStickyState;
|
|
19
17
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated, } from './selection';
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
|
-
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled,
|
|
3
|
+
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
5
|
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
@@ -6,7 +6,6 @@ export declare const containsHeaderRow: (table: PmNode) => boolean;
|
|
|
6
6
|
export declare const checkIfHeaderColumnEnabled: (selection: Selection) => boolean;
|
|
7
7
|
export declare const checkIfHeaderRowEnabled: (selection: Selection) => boolean;
|
|
8
8
|
export declare const checkIfNumberColumnEnabled: (selection: Selection) => boolean;
|
|
9
|
-
export declare const isLayoutSupported: (state: EditorState) => boolean;
|
|
10
9
|
export declare const getTableWidth: (node: PmNode) => number;
|
|
11
10
|
export declare const tablesHaveDifferentColumnWidths: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
12
11
|
export declare const tablesHaveDifferentNoOfColumns: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.8.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.17",
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
33
|
+
"@atlaskit/editor-common": "^78.26.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.3",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
@@ -103,9 +103,6 @@
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"platform-feature-flags": {
|
|
106
|
-
"platform.editor.custom-table-width": {
|
|
107
|
-
"type": "boolean"
|
|
108
|
-
},
|
|
109
106
|
"platform.editor.table.column-controls-styles-updated": {
|
|
110
107
|
"type": "boolean"
|
|
111
108
|
},
|
package/src/commands/misc.ts
CHANGED
|
@@ -79,7 +79,6 @@ export const setTableRef = (ref?: HTMLTableElement) =>
|
|
|
79
79
|
const tableWrapperTarget =
|
|
80
80
|
closestElement(tableRef, `.${ClassName.TABLE_NODE_WRAPPER}`) ||
|
|
81
81
|
undefined;
|
|
82
|
-
const layout = tableNode ? tableNode.attrs.layout : undefined;
|
|
83
82
|
const { isDragAndDropEnabled } = getPluginState(state);
|
|
84
83
|
|
|
85
84
|
return {
|
|
@@ -89,7 +88,6 @@ export const setTableRef = (ref?: HTMLTableElement) =>
|
|
|
89
88
|
tableNode,
|
|
90
89
|
tablePos,
|
|
91
90
|
tableWrapperTarget,
|
|
92
|
-
layout: layout || 'default',
|
|
93
91
|
isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
|
|
94
92
|
isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
|
|
95
93
|
isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import rafSchedule from 'raf-schd';
|
|
2
2
|
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
|
|
5
3
|
import { TableCssClassName as ClassName, ShadowEvent } from '../types';
|
|
6
|
-
import { tableInsertColumnButtonSize } from '../ui/consts';
|
|
7
4
|
|
|
8
5
|
import { updateShadowListForStickyStyles } from './update-overflow-shadows';
|
|
9
6
|
|
|
@@ -67,9 +64,7 @@ export class OverflowShadowsObserver {
|
|
|
67
64
|
{
|
|
68
65
|
threshold: [0, 1],
|
|
69
66
|
root: this.wrapper,
|
|
70
|
-
rootMargin:
|
|
71
|
-
? '0px'
|
|
72
|
-
: `0px ${tableInsertColumnButtonSize / 2}px 0px 0px`,
|
|
67
|
+
rootMargin: '0px',
|
|
73
68
|
},
|
|
74
69
|
);
|
|
75
70
|
return;
|
|
@@ -700,7 +700,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
700
700
|
node={node}
|
|
701
701
|
tableRef={tableRef!}
|
|
702
702
|
containerWidth={containerWidth}
|
|
703
|
-
isBreakoutEnabled={options?.isBreakoutEnabled}
|
|
704
703
|
isNested={isNested}
|
|
705
704
|
pluginInjectionApi={pluginInjectionApi}
|
|
706
705
|
tableWrapperHeight={this.state.tableWrapperHeight}
|
|
@@ -795,12 +794,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
795
794
|
<div
|
|
796
795
|
style={{
|
|
797
796
|
position: 'absolute',
|
|
798
|
-
right:
|
|
799
|
-
? `${
|
|
800
|
-
token('space.400', '32px') // tableOverflowShadowWidthWide
|
|
801
|
-
}`
|
|
802
|
-
: // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
803
|
-
'22px',
|
|
797
|
+
right: token('space.400', '32px'), // tableOverflowShadowWidthWide
|
|
804
798
|
}}
|
|
805
799
|
>
|
|
806
800
|
<div
|
|
@@ -866,10 +860,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
866
860
|
const prevAttrs = prevNode.attrs;
|
|
867
861
|
|
|
868
862
|
const isNested = isTableNested(this.props.view.state, this.props.getPos());
|
|
869
|
-
// We only consider a layout change valid if it's done outside of an autoSize.
|
|
870
|
-
const layoutChanged =
|
|
871
|
-
prevAttrs.layout !== node.attrs.layout &&
|
|
872
|
-
prevAttrs.__autoSize === node.attrs.__autoSize;
|
|
873
863
|
|
|
874
864
|
const parentWidth = this.getParentNodeWidth();
|
|
875
865
|
const parentWidthChanged =
|
|
@@ -887,8 +877,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
887
877
|
const noOfColumnsChanged = tablesHaveDifferentNoOfColumns(node, prevNode);
|
|
888
878
|
|
|
889
879
|
if (
|
|
890
|
-
// Breakout mode/layout changed
|
|
891
|
-
layoutChanged ||
|
|
892
880
|
// We need to react if our parent changes
|
|
893
881
|
// Scales the cols widths relative to the new parent width.
|
|
894
882
|
parentWidthChanged ||
|
|
@@ -909,7 +897,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
909
897
|
if (shouldScaleTable) {
|
|
910
898
|
this.scaleTable({
|
|
911
899
|
parentWidth,
|
|
912
|
-
layoutChanged,
|
|
913
900
|
});
|
|
914
901
|
}
|
|
915
902
|
|
|
@@ -918,7 +905,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
918
905
|
if (!hasTableBeenResized(prevNode)) {
|
|
919
906
|
this.scaleTable({
|
|
920
907
|
parentWidth: node.attrs.width,
|
|
921
|
-
layoutChanged,
|
|
922
908
|
});
|
|
923
909
|
}
|
|
924
910
|
}
|
|
@@ -931,10 +917,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
931
917
|
this.layoutSize = layoutSize;
|
|
932
918
|
};
|
|
933
919
|
|
|
934
|
-
private scaleTable = (scaleOptions: {
|
|
935
|
-
layoutChanged: boolean;
|
|
936
|
-
parentWidth?: number;
|
|
937
|
-
}) => {
|
|
920
|
+
private scaleTable = (scaleOptions: { parentWidth?: number }) => {
|
|
938
921
|
const { view, getNode, getPos, containerWidth, options } = this.props;
|
|
939
922
|
const node = getNode();
|
|
940
923
|
const { state, dispatch } = view;
|
|
@@ -1006,12 +989,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1006
989
|
private handleWindowResize = () => {
|
|
1007
990
|
const { getNode, containerWidth } = this.props;
|
|
1008
991
|
const node = getNode();
|
|
1009
|
-
const prevNode = this.node;
|
|
1010
992
|
const layoutSize = this.tableNodeLayoutSize(node);
|
|
1011
|
-
const prevAttrs = prevNode?.attrs;
|
|
1012
|
-
const layoutChanged =
|
|
1013
|
-
prevAttrs?.layout !== node?.attrs?.layout &&
|
|
1014
|
-
prevAttrs?.__autoSize === node?.attrs?.__autoSize;
|
|
1015
993
|
|
|
1016
994
|
if (containerWidth.width > layoutSize) {
|
|
1017
995
|
return;
|
|
@@ -1019,7 +997,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1019
997
|
|
|
1020
998
|
const parentWidth = this.getParentNodeWidth();
|
|
1021
999
|
this.scaleTableDebounced({
|
|
1022
|
-
layoutChanged: layoutChanged,
|
|
1023
1000
|
parentWidth: parentWidth,
|
|
1024
1001
|
});
|
|
1025
1002
|
};
|
|
@@ -7,7 +7,6 @@ import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
|
|
|
7
7
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
8
8
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
10
|
-
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
11
10
|
import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
12
11
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
13
12
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -26,22 +25,6 @@ import { TableCssClassName as ClassName } from '../types';
|
|
|
26
25
|
import { TableResizer } from './TableResizer';
|
|
27
26
|
import type { TableResizerImprovementProps } from './TableResizer';
|
|
28
27
|
|
|
29
|
-
const getMarginLeft = (
|
|
30
|
-
lineLength: number | undefined,
|
|
31
|
-
tableWidth: number | 'inherit',
|
|
32
|
-
) => {
|
|
33
|
-
let marginLeft;
|
|
34
|
-
if (tableWidth !== 'inherit' && lineLength) {
|
|
35
|
-
const containerWidth = tableWidth;
|
|
36
|
-
|
|
37
|
-
if (containerWidth) {
|
|
38
|
-
marginLeft = (lineLength - containerWidth) / 2;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return marginLeft;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
28
|
type InnerContainerProps = {
|
|
46
29
|
className: string;
|
|
47
30
|
style?: {
|
|
@@ -265,7 +248,6 @@ type TableContainerProps = {
|
|
|
265
248
|
className: string;
|
|
266
249
|
containerWidth: EditorContainerWidth;
|
|
267
250
|
isTableResizingEnabled: boolean | undefined;
|
|
268
|
-
isBreakoutEnabled: boolean | undefined;
|
|
269
251
|
editorView: EditorView;
|
|
270
252
|
getPos: () => number | undefined;
|
|
271
253
|
tableRef: HTMLTableElement;
|
|
@@ -281,9 +263,8 @@ export const TableContainer = ({
|
|
|
281
263
|
children,
|
|
282
264
|
node,
|
|
283
265
|
className,
|
|
284
|
-
containerWidth: {
|
|
266
|
+
containerWidth: { width: editorWidth },
|
|
285
267
|
isTableResizingEnabled,
|
|
286
|
-
isBreakoutEnabled,
|
|
287
268
|
editorView,
|
|
288
269
|
getPos,
|
|
289
270
|
tableRef,
|
|
@@ -314,10 +295,6 @@ export const TableContainer = ({
|
|
|
314
295
|
);
|
|
315
296
|
}
|
|
316
297
|
|
|
317
|
-
const tableWidth = isBreakoutEnabled
|
|
318
|
-
? calcTableWidth(node.attrs.layout, editorWidth)
|
|
319
|
-
: 'inherit';
|
|
320
|
-
|
|
321
298
|
return (
|
|
322
299
|
<InnerContainer
|
|
323
300
|
node={node}
|
|
@@ -325,8 +302,7 @@ export const TableContainer = ({
|
|
|
325
302
|
'less-padding': editorWidth < akEditorMobileBreakoutPoint && !isNested,
|
|
326
303
|
})}
|
|
327
304
|
style={{
|
|
328
|
-
width:
|
|
329
|
-
marginLeft: getMarginLeft(lineLength!, tableWidth),
|
|
305
|
+
width: 'inherit',
|
|
330
306
|
}}
|
|
331
307
|
>
|
|
332
308
|
{children}
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -376,7 +376,6 @@ export const createTableView = (
|
|
|
376
376
|
): NodeView => {
|
|
377
377
|
const {
|
|
378
378
|
pluginConfig,
|
|
379
|
-
isBreakoutEnabled,
|
|
380
379
|
isFullWidthModeEnabled,
|
|
381
380
|
wasFullWidthModeEnabled,
|
|
382
381
|
isTableResizingEnabled,
|
|
@@ -395,7 +394,6 @@ export const createTableView = (
|
|
|
395
394
|
eventDispatcher,
|
|
396
395
|
getPos: getPos as getPosHandlerNode,
|
|
397
396
|
options: {
|
|
398
|
-
isBreakoutEnabled,
|
|
399
397
|
isFullWidthModeEnabled,
|
|
400
398
|
wasFullWidthModeEnabled,
|
|
401
399
|
isTableResizingEnabled,
|
package/src/nodeviews/types.ts
CHANGED
|
@@ -11,7 +11,6 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
11
11
|
import type { PluginInjectionAPI } from '../types';
|
|
12
12
|
|
|
13
13
|
export type TableOptions = {
|
|
14
|
-
isBreakoutEnabled?: boolean;
|
|
15
14
|
isFullWidthModeEnabled?: boolean;
|
|
16
15
|
wasFullWidthModeEnabled?: boolean;
|
|
17
16
|
isTableResizingEnabled?: boolean;
|
package/src/plugin.tsx
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
table,
|
|
5
|
-
tableCell,
|
|
6
|
-
tableHeader,
|
|
7
|
-
tableRow,
|
|
8
|
-
tableWithCustomWidth,
|
|
9
|
-
} from '@atlaskit/adf-schema';
|
|
3
|
+
import { table, tableCell, tableHeader, tableRow } from '@atlaskit/adf-schema';
|
|
10
4
|
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
11
5
|
import {
|
|
12
6
|
ACTION,
|
|
@@ -86,16 +80,12 @@ import FloatingContextualMenu from './ui/FloatingContextualMenu';
|
|
|
86
80
|
import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
87
81
|
import FloatingDragMenu from './ui/FloatingDragMenu';
|
|
88
82
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
89
|
-
import
|
|
90
|
-
import { createTableWithWidth, isLayoutSupported } from './utils';
|
|
83
|
+
import { createTableWithWidth } from './utils';
|
|
91
84
|
|
|
92
85
|
export interface TablePluginOptions {
|
|
93
86
|
tableOptions: PluginConfig;
|
|
94
|
-
// experimental custom table resizing experience, set inside editor-core behind a feature flag
|
|
95
|
-
// will eventually replace breakoutEnabled
|
|
96
87
|
tableResizingEnabled?: boolean;
|
|
97
88
|
dragAndDropEnabled?: boolean;
|
|
98
|
-
breakoutEnabled?: boolean;
|
|
99
89
|
allowContextualMenu?: boolean;
|
|
100
90
|
// TODO these two need to be rethought
|
|
101
91
|
fullWidthEnabled?: boolean;
|
|
@@ -233,12 +223,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
233
223
|
},
|
|
234
224
|
|
|
235
225
|
nodes() {
|
|
236
|
-
const tableNode = options?.tableResizingEnabled
|
|
237
|
-
? tableWithCustomWidth
|
|
238
|
-
: table;
|
|
239
|
-
|
|
240
226
|
return [
|
|
241
|
-
{ name: 'table', node:
|
|
227
|
+
{ name: 'table', node: table },
|
|
242
228
|
{ name: 'tableHeader', node: tableHeader },
|
|
243
229
|
{ name: 'tableRow', node: tableRow },
|
|
244
230
|
{ name: 'tableCell', node: tableCell },
|
|
@@ -260,7 +246,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
260
246
|
fullWidthEnabled,
|
|
261
247
|
wasFullWidthEnabled,
|
|
262
248
|
tableResizingEnabled,
|
|
263
|
-
|
|
249
|
+
|
|
264
250
|
tableOptions,
|
|
265
251
|
getEditorFeatureFlags,
|
|
266
252
|
dragAndDropEnabled,
|
|
@@ -275,7 +261,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
275
261
|
defaultGetEditorContainerWidth,
|
|
276
262
|
getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
277
263
|
getIntl,
|
|
278
|
-
breakoutEnabled,
|
|
279
264
|
tableResizingEnabled,
|
|
280
265
|
fullWidthEnabled,
|
|
281
266
|
wasFullWidthEnabled,
|
|
@@ -466,7 +451,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
466
451
|
tableWidthPluginState,
|
|
467
452
|
dragAndDropState,
|
|
468
453
|
}) => {
|
|
469
|
-
const { state } = editorView;
|
|
470
454
|
const isColumnResizing = resizingPluginState?.dragging;
|
|
471
455
|
const isTableResizing = tableWidthPluginState?.resizing;
|
|
472
456
|
const isResizing = isColumnResizing || isTableResizing;
|
|
@@ -476,7 +460,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
476
460
|
tablePos,
|
|
477
461
|
targetCellPosition,
|
|
478
462
|
isContextualMenuOpen,
|
|
479
|
-
layout,
|
|
480
463
|
tableRef,
|
|
481
464
|
pluginConfig,
|
|
482
465
|
insertColumnButtonIndex,
|
|
@@ -493,26 +476,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
493
476
|
? findStickyHeaderForTable(stickyHeadersState, tablePos)
|
|
494
477
|
: undefined;
|
|
495
478
|
|
|
496
|
-
const LayoutContent =
|
|
497
|
-
options &&
|
|
498
|
-
!options.tableResizingEnabled &&
|
|
499
|
-
isLayoutSupported(state) &&
|
|
500
|
-
options.breakoutEnabled ? (
|
|
501
|
-
<LayoutButton
|
|
502
|
-
editorView={editorView}
|
|
503
|
-
mountPoint={popupsMountPoint}
|
|
504
|
-
boundariesElement={popupsBoundariesElement}
|
|
505
|
-
scrollableElement={popupsScrollableElement}
|
|
506
|
-
targetRef={tableWrapperTarget!}
|
|
507
|
-
layout={layout}
|
|
508
|
-
isResizing={
|
|
509
|
-
!!resizingPluginState && !!resizingPluginState.dragging
|
|
510
|
-
}
|
|
511
|
-
stickyHeader={stickyHeader}
|
|
512
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
513
|
-
/>
|
|
514
|
-
) : null;
|
|
515
|
-
|
|
516
479
|
return (
|
|
517
480
|
<>
|
|
518
481
|
{targetCellPosition &&
|
|
@@ -531,7 +494,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
531
494
|
scrollableElement={popupsScrollableElement}
|
|
532
495
|
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
533
496
|
isContextualMenuOpen={isContextualMenuOpen}
|
|
534
|
-
layout={layout}
|
|
535
497
|
stickyHeader={stickyHeader}
|
|
536
498
|
tableWrapper={tableWrapperTarget}
|
|
537
499
|
/>
|
|
@@ -603,7 +565,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
603
565
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
604
566
|
/>
|
|
605
567
|
)}
|
|
606
|
-
{LayoutContent}
|
|
607
568
|
</>
|
|
608
569
|
);
|
|
609
570
|
}}
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -107,7 +107,6 @@ export const createPlugin = (
|
|
|
107
107
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
108
108
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
109
109
|
getIntl: () => IntlShape,
|
|
110
|
-
breakoutEnabled?: boolean,
|
|
111
110
|
tableResizingEnabled?: boolean,
|
|
112
111
|
fullWidthModeEnabled?: boolean,
|
|
113
112
|
previousFullWidthModeEnabled?: boolean,
|
|
@@ -122,7 +121,6 @@ export const createPlugin = (
|
|
|
122
121
|
insertColumnButtonIndex: undefined,
|
|
123
122
|
insertRowButtonIndex: undefined,
|
|
124
123
|
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
125
|
-
isBreakoutEnabled: breakoutEnabled,
|
|
126
124
|
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
127
125
|
isTableResizingEnabled: tableResizingEnabled,
|
|
128
126
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CellAttributes
|
|
1
|
+
import type { CellAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import {
|
|
3
3
|
ACTION_SUBJECT,
|
|
4
4
|
EVENT_TYPE,
|
|
@@ -7,14 +7,12 @@ import {
|
|
|
7
7
|
TABLE_OVERFLOW_CHANGE_TRIGGER,
|
|
8
8
|
} from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
|
|
11
10
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
12
11
|
import type {
|
|
13
12
|
GetEditorContainerWidth,
|
|
14
13
|
GetEditorFeatureFlags,
|
|
15
14
|
} from '@atlaskit/editor-common/types';
|
|
16
15
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
|
-
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
18
16
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
19
17
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
20
18
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -30,7 +28,6 @@ import { evenColumns, setDragging, stopResizing } from './commands';
|
|
|
30
28
|
import { getPluginState } from './plugin-factory';
|
|
31
29
|
import {
|
|
32
30
|
currentColWidth,
|
|
33
|
-
getLayoutSize,
|
|
34
31
|
getResizeState,
|
|
35
32
|
getTableMaxWidth,
|
|
36
33
|
pointsAtCell,
|
|
@@ -80,39 +77,13 @@ export const handleMouseDown = (
|
|
|
80
77
|
dom = dom.closest('table') as HTMLTableElement;
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// its safe to reference table width from node as this will not have changed
|
|
91
|
-
originalTable.attrs.width ||
|
|
92
|
-
getLayoutSize(
|
|
93
|
-
dom.getAttribute('data-layout') as TableLayout,
|
|
94
|
-
containerWidth.width,
|
|
95
|
-
{},
|
|
96
|
-
)
|
|
97
|
-
: parentWidth ||
|
|
98
|
-
getLayoutSize(
|
|
99
|
-
dom.getAttribute('data-layout') as TableLayout,
|
|
100
|
-
containerWidth.width,
|
|
101
|
-
{},
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
if (originalTable.attrs.isNumberColumnEnabled) {
|
|
105
|
-
maxSize -= akEditorTableNumberColumnWidth;
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
maxSize = getTableMaxWidth({
|
|
109
|
-
table: originalTable,
|
|
110
|
-
tableStart: start,
|
|
111
|
-
state,
|
|
112
|
-
layout: originalTable.attrs.layout,
|
|
113
|
-
getEditorContainerWidth,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
80
|
+
const maxSize = getTableMaxWidth({
|
|
81
|
+
table: originalTable,
|
|
82
|
+
tableStart: start,
|
|
83
|
+
state,
|
|
84
|
+
layout: originalTable.attrs.layout,
|
|
85
|
+
getEditorContainerWidth,
|
|
86
|
+
});
|
|
116
87
|
|
|
117
88
|
const shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
118
89
|
const resizeState = getResizeState({
|