@atlaskit/editor-plugin-table 2.1.7 → 2.3.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 +20 -0
- package/dist/cjs/plugins/table/handlers.js +1 -0
- package/dist/cjs/plugins/table/index.js +41 -35
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +50 -47
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +72 -28
- package/dist/cjs/plugins/table/nodeviews/table.js +12 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +14 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +2 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/{table-add-width.js → table-width.js} +27 -4
- package/dist/cjs/plugins/table/toolbar.js +6 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -2
- package/dist/cjs/plugins/table/utils/collapse.js +2 -0
- package/dist/cjs/plugins/table/utils/decoration.js +2 -0
- package/dist/cjs/plugins/table/utils/guidelines.js +12 -0
- package/dist/cjs/plugins/table/utils/snapping.js +37 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/handlers.js +1 -0
- package/dist/es2019/plugins/table/index.js +19 -10
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +25 -23
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +71 -29
- package/dist/es2019/plugins/table/nodeviews/table.js +12 -5
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +18 -6
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/{table-add-width.js → table-width.js} +25 -3
- package/dist/es2019/plugins/table/toolbar.js +6 -1
- package/dist/es2019/plugins/table/ui/consts.js +3 -1
- package/dist/es2019/plugins/table/utils/collapse.js +2 -0
- package/dist/es2019/plugins/table/utils/decoration.js +2 -0
- package/dist/es2019/plugins/table/utils/guidelines.js +4 -0
- package/dist/es2019/plugins/table/utils/snapping.js +27 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/handlers.js +1 -0
- package/dist/esm/plugins/table/index.js +41 -35
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +50 -47
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +69 -28
- package/dist/esm/plugins/table/nodeviews/table.js +12 -5
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +18 -6
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/{table-add-width.js → table-width.js} +25 -3
- package/dist/esm/plugins/table/toolbar.js +6 -1
- package/dist/esm/plugins/table/ui/consts.js +3 -1
- package/dist/esm/plugins/table/utils/collapse.js +2 -0
- package/dist/esm/plugins/table/utils/decoration.js +2 -0
- package/dist/esm/plugins/table/utils/guidelines.js +4 -0
- package/dist/esm/plugins/table/utils/snapping.js +30 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/index.d.ts +3 -1
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +3 -2
- package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +5 -2
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +2 -1
- package/dist/types/plugins/table/nodeviews/types.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-width.d.ts +16 -0
- package/dist/types/plugins/table/types.d.ts +3 -0
- package/dist/types/plugins/table/ui/consts.d.ts +2 -0
- package/dist/types/plugins/table/utils/guidelines.d.ts +3 -0
- package/dist/types/plugins/table/utils/snapping.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +5 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +8 -0
- package/package.json +4 -3
- package/report.api.md +2 -0
- package/src/__tests__/unit/analytics.ts +2 -0
- package/src/__tests__/unit/collab.ts +2 -0
- package/src/__tests__/unit/commands/go-to-next-cell.ts +2 -0
- package/src/__tests__/unit/commands/insert.ts +2 -0
- package/src/__tests__/unit/commands/misc.ts +2 -0
- package/src/__tests__/unit/commands/sort.ts +4 -0
- package/src/__tests__/unit/commands.ts +2 -0
- package/src/__tests__/unit/copy-paste.ts +2 -0
- package/src/__tests__/unit/event-handlers/index.ts +3 -0
- package/src/__tests__/unit/event-handlers.ts +3 -0
- package/src/__tests__/unit/fix-tables.ts +2 -0
- package/src/__tests__/unit/get-toolbar-config.ts +2 -0
- package/src/__tests__/unit/handlers.ts +2 -0
- package/src/__tests__/unit/hover-selection.ts +2 -0
- package/src/__tests__/unit/index.ts +2 -0
- package/src/__tests__/unit/layout.ts +2 -0
- package/src/__tests__/unit/nodeviews/cell.ts +2 -0
- package/src/__tests__/unit/nodeviews/table.ts +2 -0
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +68 -0
- package/src/__tests__/unit/pm-plugins/main.ts +2 -0
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -0
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +3 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +2 -0
- package/src/__tests__/unit/sort-column.ts +2 -0
- package/src/__tests__/unit/toolbar.ts +2 -0
- package/src/__tests__/unit/transforms/delete-columns.ts +2 -0
- package/src/__tests__/unit/transforms/delete-rows.ts +2 -0
- package/src/__tests__/unit/transforms/merging.ts +2 -0
- package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -0
- package/src/__tests__/unit/ui/CornerControls.tsx +2 -0
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +2 -0
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +2 -0
- package/src/__tests__/unit/ui/RowControls.tsx +2 -0
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +2 -0
- package/src/__tests__/unit/undo-redo.ts +2 -0
- package/src/__tests__/unit/utils/collapse.ts +2 -0
- package/src/__tests__/unit/utils/nodes.ts +2 -0
- package/src/__tests__/unit/utils/row-controls.ts +2 -0
- package/src/__tests__/unit/utils.ts +2 -0
- package/src/plugins/table/handlers.ts +1 -0
- package/src/plugins/table/index.tsx +38 -23
- package/src/plugins/table/nodeviews/TableComponent.tsx +6 -5
- package/src/plugins/table/nodeviews/TableContainer.tsx +31 -22
- package/src/plugins/table/nodeviews/TableResizer.tsx +107 -34
- package/src/plugins/table/nodeviews/table.tsx +16 -2
- package/src/plugins/table/nodeviews/types.ts +2 -0
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +27 -4
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -0
- package/src/plugins/table/pm-plugins/decorations/utils/types.ts +1 -0
- package/src/plugins/table/pm-plugins/main.ts +3 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin-factory.ts +1 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +1 -0
- package/src/plugins/table/pm-plugins/{table-add-width.ts → table-width.ts} +33 -3
- package/src/plugins/table/toolbar.tsx +7 -1
- package/src/plugins/table/types.ts +4 -0
- package/src/plugins/table/ui/consts.ts +3 -0
- package/src/plugins/table/utils/collapse.ts +1 -0
- package/src/plugins/table/utils/decoration.ts +1 -0
- package/src/plugins/table/utils/guidelines.ts +17 -0
- package/src/plugins/table/utils/snapping.ts +38 -0
- package/tmp/api-report-tmp.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/table-add-width.d.ts +0 -7
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-add-width.d.ts +0 -7
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey
|
|
2
|
+
import { PluginKey
|
|
3
|
+
|
|
4
|
+
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
5
|
+
} from 'prosemirror-state';
|
|
3
6
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
7
|
import { DecorationSet } from 'prosemirror-view';
|
|
5
8
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
9
|
+
import { pluginKey as tableWidthPluginKey } from '../table-width';
|
|
6
10
|
import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils';
|
|
7
11
|
export const pluginKey = new PluginKey('tableDecorationsPlugin');
|
|
8
12
|
export const getDecorations = state => pluginKey.getState(state);
|
|
9
|
-
export const handleDocOrSelectionChanged = (tr, decorationSet, oldState) => {
|
|
10
|
-
|
|
13
|
+
export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newState) => {
|
|
14
|
+
var _tableWidthPluginKey$, _tableWidthPluginKey$2;
|
|
15
|
+
const isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
16
|
+
const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
|
|
17
|
+
const changedResizing = isResizing !== wasResizing;
|
|
18
|
+
|
|
19
|
+
// Remove column controls when resizing
|
|
20
|
+
if (isResizing) {
|
|
21
|
+
return DecorationSet.empty;
|
|
22
|
+
} else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing) {
|
|
11
23
|
return buildColumnControlsDecorations({
|
|
12
24
|
decorationSet,
|
|
13
25
|
tr
|
|
@@ -27,15 +39,15 @@ export const createPlugin = () => {
|
|
|
27
39
|
return new SafePlugin({
|
|
28
40
|
state: {
|
|
29
41
|
init: () => DecorationSet.empty,
|
|
30
|
-
apply: (tr, decorationSet, oldState) => {
|
|
42
|
+
apply: (tr, decorationSet, oldState, newState) => {
|
|
31
43
|
let pluginState = decorationSet;
|
|
32
44
|
const meta = tr.getMeta(tablePluginKey);
|
|
33
45
|
if (meta && meta.data && meta.data.decorationSet) {
|
|
34
46
|
pluginState = meta.data.decorationSet;
|
|
35
47
|
}
|
|
36
|
-
if (tr.docChanged || tr.selectionSet) {
|
|
48
|
+
if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)) {
|
|
37
49
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
38
|
-
return handleDocOrSelectionChanged(tr, pluginState, oldState);
|
|
50
|
+
return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
|
|
39
51
|
}
|
|
40
52
|
return pluginState;
|
|
41
53
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
2
|
+
|
|
1
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
2
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
3
5
|
import { TableDecorations } from '../../../types';
|
|
@@ -24,7 +24,7 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
24
24
|
let isBreakoutEnabled;
|
|
25
25
|
let isFullWidthModeEnabled;
|
|
26
26
|
let wasFullWidthModeEnabled;
|
|
27
|
-
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI) => {
|
|
27
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
|
|
28
28
|
var _window;
|
|
29
29
|
isBreakoutEnabled = breakoutEnabled;
|
|
30
30
|
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
@@ -232,7 +232,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
232
232
|
isBreakoutEnabled,
|
|
233
233
|
isFullWidthModeEnabled,
|
|
234
234
|
wasFullWidthModeEnabled
|
|
235
|
-
}, getEditorContainerWidth, getEditorFeatureFlags)
|
|
235
|
+
}, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi)
|
|
236
236
|
},
|
|
237
237
|
handleDOMEvents: {
|
|
238
238
|
focus: handleFocus,
|
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A plugin for
|
|
3
|
-
*
|
|
2
|
+
* A plugin for handle table custom widths
|
|
3
|
+
* Has login to scan the document, add width value to table's width attribute when necessary
|
|
4
|
+
* Also holds resizing state to hide / show table controls
|
|
4
5
|
*/
|
|
5
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
7
|
import { akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
7
8
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
8
9
|
import { ReplaceStep } from 'prosemirror-transform';
|
|
9
|
-
|
|
10
|
+
import { PluginKey } from 'prosemirror-state';
|
|
11
|
+
export const pluginKey = new PluginKey('tableWidthPlugin');
|
|
12
|
+
const createPlugin = (dispatch, fullWidthEnabled) => new SafePlugin({
|
|
13
|
+
key: pluginKey,
|
|
14
|
+
state: {
|
|
15
|
+
init() {
|
|
16
|
+
return {
|
|
17
|
+
resizing: false
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
apply(tr, pluginState) {
|
|
21
|
+
const meta = tr.getMeta(pluginKey);
|
|
22
|
+
if (meta && meta.resizing !== pluginState.resizing) {
|
|
23
|
+
const newState = {
|
|
24
|
+
resizing: meta.resizing
|
|
25
|
+
};
|
|
26
|
+
dispatch(pluginKey, newState);
|
|
27
|
+
return newState;
|
|
28
|
+
}
|
|
29
|
+
return pluginState;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
10
32
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
11
33
|
// When document first load in Confluence, initially it is an empty document
|
|
12
34
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
@@ -7,6 +7,7 @@ import { clearHoverSelection, hoverTable, hoverColumns, hoverRows, removeDescend
|
|
|
7
7
|
import { deleteTableWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, insertRowWithAnalytics, deleteRowsWithAnalytics, mergeCellsWithAnalytics, splitCellWithAnalytics, deleteColumnsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, wrapTableInExpandWithAnalytics, sortColumnWithAnalytics, setColorWithAnalytics, distributeColumnsWidthsWithAnalytics } from './commands-with-analytics';
|
|
8
8
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
9
9
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
10
|
+
import { pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
10
11
|
import { TableCssClassName } from './types';
|
|
11
12
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from './utils';
|
|
12
13
|
import { isReferencedSource, getChildrenInfo, getNodeName } from '@atlaskit/editor-common/utils';
|
|
@@ -294,7 +295,11 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
|
|
|
294
295
|
const tableObject = findTable(state.selection);
|
|
295
296
|
const pluginState = getPluginState(state);
|
|
296
297
|
const resizeState = tableResizingPluginKey.getState(state);
|
|
297
|
-
|
|
298
|
+
const tableWidthState = tableWidthPluginKey.getState(state);
|
|
299
|
+
|
|
300
|
+
// We don't want to show floating toolbar while resizing the table
|
|
301
|
+
const isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
|
|
302
|
+
if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
|
|
298
303
|
const nodeType = state.schema.nodes.table;
|
|
299
304
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
|
|
300
305
|
const {
|
|
@@ -62,4 +62,6 @@ export const contextualMenuTriggerSize = 16;
|
|
|
62
62
|
export const contextualMenuDropdownWidth = 180;
|
|
63
63
|
export const stickyRowZIndex = resizeHandlerZIndex + 2;
|
|
64
64
|
export const stickyRowOffsetTop = 8;
|
|
65
|
-
export const stickyHeaderBorderBottomWidth = 1;
|
|
65
|
+
export const stickyHeaderBorderBottomWidth = 1;
|
|
66
|
+
export const TABLE_SNAP_GAP = 5;
|
|
67
|
+
export const TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { NodeRange } from 'prosemirror-model';
|
|
2
|
+
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
3
|
+
|
|
2
4
|
import { findWrapping } from 'prosemirror-transform';
|
|
3
5
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
6
|
const bail = () => ({
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
2
|
+
|
|
1
3
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
4
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
3
5
|
import { Decoration } from 'prosemirror-view';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createFixedGuidelinesFromLengths } from '@atlaskit/editor-common/guideline';
|
|
2
|
+
import { akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
export const defaultGuidelineWidths = [akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth];
|
|
4
|
+
export const defaultGuidelines = createFixedGuidelinesFromLengths(defaultGuidelineWidths);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns keys of guidelines that are closest to the table and withthin the snapGap
|
|
3
|
+
*/
|
|
4
|
+
export const findClosestSnap = (currentWidth, snapWidths, guidelines, snapGap = 0) => {
|
|
5
|
+
const closestGapIndex = snapWidths.reduce((prev, curr, index) => Math.abs(curr - currentWidth) < Math.abs(snapWidths[prev] - currentWidth) ? index : prev, 0);
|
|
6
|
+
const gap = Math.abs(snapWidths[closestGapIndex] - currentWidth);
|
|
7
|
+
if (gap < snapGap) {
|
|
8
|
+
const snappingWidth = Math.round(snapWidths[closestGapIndex]);
|
|
9
|
+
const guidelineKeys = guidelines.reduce((acc, guideline) => {
|
|
10
|
+
// NOTE: The snap points are based on the guidelines, however their formatted as a length value whereas the guidelines
|
|
11
|
+
// are point based. The point base x coords are calculated by halving the lengths. This means we can convert the
|
|
12
|
+
// point base position to length by simply multiplying by 2.
|
|
13
|
+
if (Math.round(Math.abs(guideline.position.x) * 2) === snappingWidth) {
|
|
14
|
+
acc.push(guideline.key);
|
|
15
|
+
}
|
|
16
|
+
return acc;
|
|
17
|
+
}, []);
|
|
18
|
+
return {
|
|
19
|
+
gap,
|
|
20
|
+
keys: guidelineKeys
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
gap,
|
|
25
|
+
keys: []
|
|
26
|
+
};
|
|
27
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
// #region Imports
|
|
5
|
+
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
5
6
|
|
|
6
7
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
7
8
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -11,7 +11,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
11
11
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
12
12
|
import { pluginConfig } from './create-plugin-config';
|
|
13
13
|
import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
|
|
14
|
-
import { createPlugin as
|
|
14
|
+
import { pluginKey as tableWidthPluginKey, createPlugin as createTableWidthPlugin } from './pm-plugins/table-width';
|
|
15
15
|
import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
|
|
16
16
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
17
17
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
@@ -96,7 +96,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
96
96
|
breakoutEnabled = _ref2.breakoutEnabled,
|
|
97
97
|
tableOptions = _ref2.tableOptions,
|
|
98
98
|
getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
|
|
99
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
99
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
|
|
100
100
|
}
|
|
101
101
|
}, {
|
|
102
102
|
name: 'tablePMColResizing',
|
|
@@ -165,9 +165,11 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
165
165
|
return createTableLocalIdPlugin(dispatch);
|
|
166
166
|
}
|
|
167
167
|
}, {
|
|
168
|
-
name: '
|
|
169
|
-
plugin: function plugin() {
|
|
170
|
-
|
|
168
|
+
name: 'tableWidth',
|
|
169
|
+
plugin: function plugin(_ref8) {
|
|
170
|
+
var _options$fullWidthEna;
|
|
171
|
+
var dispatch = _ref8.dispatch;
|
|
172
|
+
return getBooleanFF('platform.editor.custom-table-width') ? createTableWidthPlugin(dispatch, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
171
173
|
}
|
|
172
174
|
}, {
|
|
173
175
|
name: 'tableGetEditorViewReferencePlugin',
|
|
@@ -197,12 +199,12 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
197
199
|
}
|
|
198
200
|
return plugins;
|
|
199
201
|
},
|
|
200
|
-
contentComponent: function contentComponent(
|
|
201
|
-
var editorView =
|
|
202
|
-
popupsMountPoint =
|
|
203
|
-
popupsBoundariesElement =
|
|
204
|
-
popupsScrollableElement =
|
|
205
|
-
dispatchAnalyticsEvent =
|
|
202
|
+
contentComponent: function contentComponent(_ref9) {
|
|
203
|
+
var editorView = _ref9.editorView,
|
|
204
|
+
popupsMountPoint = _ref9.popupsMountPoint,
|
|
205
|
+
popupsBoundariesElement = _ref9.popupsBoundariesElement,
|
|
206
|
+
popupsScrollableElement = _ref9.popupsScrollableElement,
|
|
207
|
+
dispatchAnalyticsEvent = _ref9.dispatchAnalyticsEvent;
|
|
206
208
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
207
209
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
208
210
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -210,28 +212,32 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
210
212
|
}, /*#__PURE__*/React.createElement(WithPluginState, {
|
|
211
213
|
plugins: {
|
|
212
214
|
tablePluginState: pluginKey,
|
|
215
|
+
tableWidthPluginState: tableWidthPluginKey,
|
|
213
216
|
tableResizingPluginState: tableResizingPluginKey,
|
|
214
217
|
stickyHeadersState: stickyHeadersPluginKey
|
|
215
218
|
},
|
|
216
|
-
render: function render(
|
|
217
|
-
var resizingPluginState =
|
|
218
|
-
stickyHeadersState =
|
|
219
|
-
tablePluginState =
|
|
219
|
+
render: function render(_ref10) {
|
|
220
|
+
var resizingPluginState = _ref10.tableResizingPluginState,
|
|
221
|
+
stickyHeadersState = _ref10.stickyHeadersState,
|
|
222
|
+
tablePluginState = _ref10.tablePluginState,
|
|
223
|
+
tableWidthPluginState = _ref10.tableWidthPluginState;
|
|
220
224
|
var state = editorView.state;
|
|
221
|
-
var
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
225
|
+
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
226
|
+
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
227
|
+
var isResizing = isColumnResizing || isTableResizing;
|
|
228
|
+
var _ref11 = tablePluginState,
|
|
229
|
+
tableNode = _ref11.tableNode,
|
|
230
|
+
tablePos = _ref11.tablePos,
|
|
231
|
+
targetCellPosition = _ref11.targetCellPosition,
|
|
232
|
+
isContextualMenuOpen = _ref11.isContextualMenuOpen,
|
|
233
|
+
layout = _ref11.layout,
|
|
234
|
+
tableRef = _ref11.tableRef,
|
|
235
|
+
pluginConfig = _ref11.pluginConfig,
|
|
236
|
+
insertColumnButtonIndex = _ref11.insertColumnButtonIndex,
|
|
237
|
+
insertRowButtonIndex = _ref11.insertRowButtonIndex,
|
|
238
|
+
isHeaderColumnEnabled = _ref11.isHeaderColumnEnabled,
|
|
239
|
+
isHeaderRowEnabled = _ref11.isHeaderRowEnabled,
|
|
240
|
+
tableWrapperTarget = _ref11.tableWrapperTarget;
|
|
235
241
|
var allowControls = pluginConfig.allowControls;
|
|
236
242
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
237
243
|
var LayoutContent = getBooleanFF('platform.editor.custom-table-width') ? null : isLayoutSupported(state) && options && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -245,7 +251,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
245
251
|
stickyHeader: stickyHeader,
|
|
246
252
|
editorAnalyticsAPI: editorAnalyticsAPI
|
|
247
253
|
}) : null;
|
|
248
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !
|
|
254
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
249
255
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
250
256
|
editorView: editorView,
|
|
251
257
|
tableNode: tableNode,
|
|
@@ -272,17 +278,17 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
272
278
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
273
279
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
274
280
|
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
275
|
-
}), /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
281
|
+
}), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
276
282
|
editorView: editorView,
|
|
277
283
|
mountPoint: popupsMountPoint,
|
|
278
284
|
boundariesElement: popupsBoundariesElement,
|
|
279
285
|
targetCellPosition: targetCellPosition,
|
|
280
|
-
isOpen: Boolean(isContextualMenuOpen),
|
|
286
|
+
isOpen: Boolean(isContextualMenuOpen) && !isResizing,
|
|
281
287
|
pluginConfig: pluginConfig,
|
|
282
288
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
283
289
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
284
290
|
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
285
|
-
}), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
291
|
+
}), allowControls && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
286
292
|
editorView: editorView,
|
|
287
293
|
selection: editorView.state.selection,
|
|
288
294
|
tableRef: tableRef,
|
|
@@ -297,8 +303,8 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
297
303
|
}));
|
|
298
304
|
},
|
|
299
305
|
pluginsOptions: {
|
|
300
|
-
quickInsert: function quickInsert(
|
|
301
|
-
var formatMessage =
|
|
306
|
+
quickInsert: function quickInsert(_ref12) {
|
|
307
|
+
var formatMessage = _ref12.formatMessage;
|
|
302
308
|
return [{
|
|
303
309
|
id: 'table',
|
|
304
310
|
title: formatMessage(messages.table),
|
|
@@ -378,7 +378,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
378
378
|
var _this$props8 = this.props,
|
|
379
379
|
view = _this$props8.view,
|
|
380
380
|
getNode = _this$props8.getNode,
|
|
381
|
-
|
|
381
|
+
isResizing = _this$props8.isResizing,
|
|
382
382
|
_this$props8$allowCon = _this$props8.allowControls,
|
|
383
383
|
allowControls = _this$props8$allowCon === void 0 ? true : _this$props8$allowCon,
|
|
384
384
|
isHeaderRowEnabled = _this$props8.isHeaderRowEnabled,
|
|
@@ -387,7 +387,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
387
387
|
tableActive = _this$props8.tableActive,
|
|
388
388
|
containerWidth = _this$props8.containerWidth,
|
|
389
389
|
options = _this$props8.options,
|
|
390
|
-
getPos = _this$props8.getPos
|
|
390
|
+
getPos = _this$props8.getPos,
|
|
391
|
+
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
391
392
|
var _this$state = this.state,
|
|
392
393
|
isLoading = _this$state.isLoading,
|
|
393
394
|
showBeforeShadow = _this$state.showBeforeShadow,
|
|
@@ -403,7 +404,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
403
404
|
tableRenderOptimization = _this$props$getEditor4.tableRenderOptimization,
|
|
404
405
|
tableOverflowShadowsOptimization = _this$props$getEditor4.tableOverflowShadowsOptimization;
|
|
405
406
|
var tableRef = this.table || undefined;
|
|
406
|
-
var isResizing = !!tableResizingPluginState && !!tableResizingPluginState.dragging;
|
|
407
407
|
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
408
408
|
|
|
409
409
|
//dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
|
|
@@ -447,7 +447,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
447
447
|
containerWidth: containerWidth,
|
|
448
448
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.isFullWidthModeEnabled,
|
|
449
449
|
isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
|
|
450
|
-
isNested: isNested
|
|
450
|
+
isNested: isNested,
|
|
451
|
+
pluginInjectionApi: pluginInjectionApi
|
|
451
452
|
}, stickyHeadersOptimization && /*#__PURE__*/React.createElement("div", {
|
|
452
453
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
453
454
|
"data-testid": "sticky-sentinel-top"
|
|
@@ -5,9 +5,7 @@ import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
|
5
5
|
import { TableCssClassName as ClassName } from '../types';
|
|
6
6
|
import { TableResizer } from './TableResizer';
|
|
7
7
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
8
|
-
var getMarginLeft = function getMarginLeft(
|
|
9
|
-
var lineLength = _ref.lineLength,
|
|
10
|
-
tableWidth = _ref.tableWidth;
|
|
8
|
+
var getMarginLeft = function getMarginLeft(lineLength, tableWidth) {
|
|
11
9
|
var marginLeft;
|
|
12
10
|
if (tableWidth !== 'inherit' && lineLength) {
|
|
13
11
|
var containerWidth = tableWidth;
|
|
@@ -17,11 +15,11 @@ var getMarginLeft = function getMarginLeft(_ref) {
|
|
|
17
15
|
}
|
|
18
16
|
return marginLeft;
|
|
19
17
|
};
|
|
20
|
-
export var InnerContainer = /*#__PURE__*/forwardRef(function (
|
|
21
|
-
var className =
|
|
22
|
-
style =
|
|
23
|
-
node =
|
|
24
|
-
children =
|
|
18
|
+
export var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
19
|
+
var className = _ref.className,
|
|
20
|
+
style = _ref.style,
|
|
21
|
+
node = _ref.node,
|
|
22
|
+
children = _ref.children;
|
|
25
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
24
|
ref: ref,
|
|
27
25
|
style: style,
|
|
@@ -31,42 +29,47 @@ export var InnerContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
31
29
|
"data-test-id": "table-container"
|
|
32
30
|
}, children);
|
|
33
31
|
});
|
|
34
|
-
export var ResizableTableContainer = function ResizableTableContainer(
|
|
35
|
-
var children =
|
|
36
|
-
className =
|
|
37
|
-
node =
|
|
38
|
-
lineLength =
|
|
39
|
-
containerWidth =
|
|
40
|
-
editorView =
|
|
41
|
-
getPos =
|
|
42
|
-
tableRef =
|
|
32
|
+
export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
33
|
+
var children = _ref2.children,
|
|
34
|
+
className = _ref2.className,
|
|
35
|
+
node = _ref2.node,
|
|
36
|
+
lineLength = _ref2.lineLength,
|
|
37
|
+
containerWidth = _ref2.containerWidth,
|
|
38
|
+
editorView = _ref2.editorView,
|
|
39
|
+
getPos = _ref2.getPos,
|
|
40
|
+
tableRef = _ref2.tableRef,
|
|
41
|
+
pluginInjectionApi = _ref2.pluginInjectionApi;
|
|
43
42
|
var containerRef = useRef(null);
|
|
44
43
|
var innerContainerRef = useRef(null);
|
|
44
|
+
var marginLeftRef = useRef(0);
|
|
45
45
|
var updateWidth = useCallback(function (width) {
|
|
46
46
|
if (!containerRef.current || !innerContainerRef.current) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
var marginLeft = getMarginLeft(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
var marginLeft = getMarginLeft(lineLength, width);
|
|
50
|
+
if (marginLeftRef.current !== marginLeft) {
|
|
51
|
+
marginLeftRef.current = marginLeft;
|
|
52
|
+
if (Number.isFinite(marginLeft)) {
|
|
53
|
+
containerRef.current.style.marginLeft = "".concat(marginLeft, "px");
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
}, [lineLength]);
|
|
57
|
+
var displayGuideline = useCallback(function (guidelines) {
|
|
58
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
59
|
+
return (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.guideline) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.displayGuideline(editorView)({
|
|
60
|
+
guidelines: guidelines
|
|
61
|
+
})) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : false;
|
|
62
|
+
}, [pluginInjectionApi, editorView]);
|
|
57
63
|
var tableWidth = getTableContainerWidth(node);
|
|
58
64
|
|
|
59
65
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
60
66
|
var responsiveContainerWidth = containerWidth - 76;
|
|
61
67
|
var width = Math.min(tableWidth, responsiveContainerWidth);
|
|
62
|
-
|
|
63
|
-
lineLength: lineLength,
|
|
64
|
-
tableWidth: width
|
|
65
|
-
});
|
|
68
|
+
marginLeftRef.current = getMarginLeft(lineLength, width);
|
|
66
69
|
var maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
67
70
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
71
|
style: {
|
|
69
|
-
marginLeft:
|
|
72
|
+
marginLeft: marginLeftRef.current,
|
|
70
73
|
width: width
|
|
71
74
|
},
|
|
72
75
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
@@ -78,26 +81,28 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref3) {
|
|
|
78
81
|
editorView: editorView,
|
|
79
82
|
getPos: getPos,
|
|
80
83
|
node: node,
|
|
81
|
-
tableRef: tableRef
|
|
84
|
+
tableRef: tableRef,
|
|
85
|
+
displayGuideline: displayGuideline
|
|
82
86
|
}, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
83
87
|
ref: innerContainerRef,
|
|
84
88
|
className: className,
|
|
85
89
|
node: node
|
|
86
90
|
}, children)));
|
|
87
91
|
};
|
|
88
|
-
export var TableContainer = function TableContainer(
|
|
89
|
-
var children =
|
|
90
|
-
node =
|
|
91
|
-
className =
|
|
92
|
-
|
|
93
|
-
lineLength =
|
|
94
|
-
editorWidth =
|
|
95
|
-
isFullWidthModeEnabled =
|
|
96
|
-
isBreakoutEnabled =
|
|
97
|
-
editorView =
|
|
98
|
-
getPos =
|
|
99
|
-
tableRef =
|
|
100
|
-
isNested =
|
|
92
|
+
export var TableContainer = function TableContainer(_ref3) {
|
|
93
|
+
var children = _ref3.children,
|
|
94
|
+
node = _ref3.node,
|
|
95
|
+
className = _ref3.className,
|
|
96
|
+
_ref3$containerWidth = _ref3.containerWidth,
|
|
97
|
+
lineLength = _ref3$containerWidth.lineLength,
|
|
98
|
+
editorWidth = _ref3$containerWidth.width,
|
|
99
|
+
isFullWidthModeEnabled = _ref3.isFullWidthModeEnabled,
|
|
100
|
+
isBreakoutEnabled = _ref3.isBreakoutEnabled,
|
|
101
|
+
editorView = _ref3.editorView,
|
|
102
|
+
getPos = _ref3.getPos,
|
|
103
|
+
tableRef = _ref3.tableRef,
|
|
104
|
+
isNested = _ref3.isNested,
|
|
105
|
+
pluginInjectionApi = _ref3.pluginInjectionApi;
|
|
101
106
|
if ((isFullWidthModeEnabled || isBreakoutEnabled) && getBooleanFF('platform.editor.custom-table-width') && !isNested) {
|
|
102
107
|
return /*#__PURE__*/React.createElement(ResizableTableContainer, {
|
|
103
108
|
className: className,
|
|
@@ -106,7 +111,8 @@ export var TableContainer = function TableContainer(_ref4) {
|
|
|
106
111
|
containerWidth: editorWidth,
|
|
107
112
|
editorView: editorView,
|
|
108
113
|
getPos: getPos,
|
|
109
|
-
tableRef: tableRef
|
|
114
|
+
tableRef: tableRef,
|
|
115
|
+
pluginInjectionApi: pluginInjectionApi
|
|
110
116
|
}, children);
|
|
111
117
|
}
|
|
112
118
|
var tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
|
|
@@ -115,10 +121,7 @@ export var TableContainer = function TableContainer(_ref4) {
|
|
|
115
121
|
className: className,
|
|
116
122
|
style: {
|
|
117
123
|
width: tableWidth,
|
|
118
|
-
marginLeft: getMarginLeft(
|
|
119
|
-
lineLength: lineLength,
|
|
120
|
-
tableWidth: tableWidth
|
|
121
|
-
})
|
|
124
|
+
marginLeft: getMarginLeft(lineLength, tableWidth)
|
|
122
125
|
}
|
|
123
126
|
}, children);
|
|
124
127
|
};
|