@atlaskit/editor-plugin-table 21.0.0 → 22.1.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 +52 -0
- package/dist/cjs/nodeviews/TableComponent.js +20 -4
- package/dist/cjs/nodeviews/table.js +15 -13
- package/dist/cjs/nodeviews/toDOM.js +8 -5
- package/dist/cjs/pm-plugins/keymap.js +12 -12
- package/dist/cjs/pm-plugins/main.js +3 -3
- package/dist/cjs/pm-plugins/table-width.js +8 -5
- package/dist/cjs/pm-plugins/utils/tableMode.js +15 -34
- package/dist/cjs/tablePlugin.js +40 -45
- package/dist/cjs/ui/ContentComponent.js +0 -1
- package/dist/cjs/ui/global-styles.js +1 -2
- package/dist/cjs/ui/toolbar.js +5 -11
- package/dist/es2019/nodeviews/TableComponent.js +18 -2
- package/dist/es2019/nodeviews/table.js +14 -14
- package/dist/es2019/nodeviews/toDOM.js +8 -5
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/pm-plugins/main.js +3 -3
- package/dist/es2019/pm-plugins/table-width.js +8 -5
- package/dist/es2019/pm-plugins/utils/tableMode.js +6 -24
- package/dist/es2019/tablePlugin.js +4 -10
- package/dist/es2019/ui/ContentComponent.js +0 -1
- package/dist/es2019/ui/global-styles.js +1 -2
- package/dist/es2019/ui/toolbar.js +4 -10
- package/dist/esm/nodeviews/TableComponent.js +18 -2
- package/dist/esm/nodeviews/table.js +16 -14
- package/dist/esm/nodeviews/toDOM.js +8 -5
- package/dist/esm/pm-plugins/keymap.js +12 -12
- package/dist/esm/pm-plugins/main.js +3 -3
- package/dist/esm/pm-plugins/table-width.js +8 -5
- package/dist/esm/pm-plugins/utils/tableMode.js +14 -33
- package/dist/esm/tablePlugin.js +40 -45
- package/dist/esm/ui/ContentComponent.js +0 -1
- package/dist/esm/ui/global-styles.js +1 -2
- package/dist/esm/ui/toolbar.js +5 -11
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/utils/tableMode.d.ts +3 -6
- package/dist/types/tablePluginType.d.ts +0 -6
- package/dist/types/ui/global-styles.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/tableMode.d.ts +3 -6
- package/dist/types-ts4.5/tablePluginType.d.ts +0 -6
- package/dist/types-ts4.5/ui/global-styles.d.ts +1 -2
- package/package.json +4 -4
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -419,17 +419,11 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
419
419
|
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
420
420
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
421
421
|
var _api$editorViewMode;
|
|
422
|
-
var
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
isDragMenuOpen = _getDragDropPluginSta2 === void 0 ? false : _getDragDropPluginSta2,
|
|
428
|
-
_getDragDropPluginSta3 = _getDragDropPluginSta.isDragging,
|
|
429
|
-
isDragging = _getDragDropPluginSta3 === void 0 ? false : _getDragDropPluginSta3;
|
|
430
|
-
isDragHandleMenuOpened = isDragMenuOpen;
|
|
431
|
-
isTableRowOrColumnDragged = isDragging;
|
|
432
|
-
}
|
|
422
|
+
var _getDragDropPluginSta = (0, _pluginFactory.getPluginState)(state),
|
|
423
|
+
_getDragDropPluginSta2 = _getDragDropPluginSta.isDragMenuOpen,
|
|
424
|
+
isDragHandleMenuOpened = _getDragDropPluginSta2 === void 0 ? false : _getDragDropPluginSta2,
|
|
425
|
+
_getDragDropPluginSta3 = _getDragDropPluginSta.isDragging,
|
|
426
|
+
isTableRowOrColumnDragged = _getDragDropPluginSta3 === void 0 ? false : _getDragDropPluginSta3;
|
|
433
427
|
var isTableOrColumnResizing = !!(resizeState !== null && resizeState !== void 0 && resizeState.dragging || tableWidthState !== null && tableWidthState !== void 0 && tableWidthState.resizing);
|
|
434
428
|
var isTableMenuOpened = pluginState.isContextualMenuOpen || isDragHandleMenuOpened;
|
|
435
429
|
var isTableState = isTableRowOrColumnDragged || isTableOrColumnResizing || isTableMenuOpened;
|
|
@@ -8,6 +8,7 @@ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
|
8
8
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
9
9
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
10
10
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
11
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
11
12
|
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
12
13
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
13
14
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
@@ -26,6 +27,7 @@ import { getResizeState, updateColgroup } from '../pm-plugins/table-resizing/uti
|
|
|
26
27
|
import { scaleTable } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
27
28
|
import { containsHeaderRow, isTableNested, isTableNestedInMoreThanOneNode, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, tablesHaveDifferentNoOfRows } from '../pm-plugins/utils/nodes';
|
|
28
29
|
import { getAssistiveMessage } from '../pm-plugins/utils/table';
|
|
30
|
+
import { isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
29
31
|
import { TableCssClassName as ClassName } from '../types';
|
|
30
32
|
import { handleMouseOut, handleMouseOver, isTableInFocus, withCellTracking } from '../ui/event-handlers';
|
|
31
33
|
import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
|
|
@@ -700,10 +702,24 @@ class TableComponent extends React.Component {
|
|
|
700
702
|
} = this.props;
|
|
701
703
|
const shouldRecreateResizeCols = !allowTableResizing || !isResizing || isNoOfColumnsChanged && isResizing;
|
|
702
704
|
if (shouldRecreateResizeCols) {
|
|
705
|
+
var _this$table7, _this$props$options12, _this$props$options13;
|
|
703
706
|
const start = getPos() || 0;
|
|
704
707
|
const depth = view.state.doc.resolve(start).depth;
|
|
705
708
|
shouldScale = depth === 0 && shouldScale;
|
|
706
709
|
insertColgroupFromNode(this.table, currentTable, shouldScale, undefined, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
710
|
+
|
|
711
|
+
// Deferred from setDomAttrs — remove only once colgroup is updated and table has left content mode.
|
|
712
|
+
if ((_this$table7 = this.table) !== null && _this$table7 !== void 0 && _this$table7.hasAttribute('data-initial-width-mode') && !isTableInContentMode({
|
|
713
|
+
tableNode: currentTable,
|
|
714
|
+
isSupported: isContentModeSupported({
|
|
715
|
+
allowColumnResizing: !!allowColumnResizing,
|
|
716
|
+
allowTableResizing: !!allowTableResizing,
|
|
717
|
+
isFullPageEditor: !((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor) && !((_this$props$options13 = this.props.options) !== null && _this$props$options13 !== void 0 && _this$props$options13.isChromelessEditor)
|
|
718
|
+
}),
|
|
719
|
+
isTableNested: isTableNested(view.state, getPos())
|
|
720
|
+
})) {
|
|
721
|
+
this.table.removeAttribute('data-initial-width-mode');
|
|
722
|
+
}
|
|
707
723
|
}
|
|
708
724
|
updateControls()(view.state);
|
|
709
725
|
}
|
|
@@ -724,7 +740,7 @@ class TableComponent extends React.Component {
|
|
|
724
740
|
}
|
|
725
741
|
}
|
|
726
742
|
render() {
|
|
727
|
-
var _this$props$
|
|
743
|
+
var _this$props$options14;
|
|
728
744
|
const {
|
|
729
745
|
view,
|
|
730
746
|
getNode,
|
|
@@ -829,7 +845,7 @@ class TableComponent extends React.Component {
|
|
|
829
845
|
const {
|
|
830
846
|
tableWithFixedColumnWidthsOption = false
|
|
831
847
|
} = getEditorFeatureFlags();
|
|
832
|
-
const shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$
|
|
848
|
+
const shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options14 = this.props.options) !== null && _this$props$options14 !== void 0 && _this$props$options14.isCommentEditor));
|
|
833
849
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
834
850
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
835
851
|
, {
|
|
@@ -2,18 +2,18 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
4
4
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
5
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
8
9
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
12
|
import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
|
|
13
13
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
14
14
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
15
15
|
import { isTableNested, tablesHaveDifferentColumnWidths } from '../pm-plugins/utils/nodes';
|
|
16
|
-
import {
|
|
16
|
+
import { isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
17
17
|
import { TableComponentWithSharedState } from './TableComponentWithSharedState';
|
|
18
18
|
import { tableNodeSpecWithFixedToDOM } from './toDOM';
|
|
19
19
|
const tableAttributes = node => {
|
|
@@ -178,24 +178,24 @@ export default class TableView extends ReactNodeView {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
setDomAttrs(node) {
|
|
181
|
-
var _this$reactComponentP8, _this$getEditorFeatur2, _this$options3, _this$options4;
|
|
181
|
+
var _this$reactComponentP6, _this$reactComponentP7, _this$reactComponentP8, _this$getEditorFeatur2, _this$options3, _this$options4;
|
|
182
182
|
if (!this.table) {
|
|
183
183
|
return; // width / attribute application to actual table will happen later when table is set
|
|
184
184
|
}
|
|
185
185
|
const attrs = tableAttributes(node);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
|
|
187
|
+
// render table with content-mode attribute which removes all width constraints from the table
|
|
188
|
+
// fire exposure here
|
|
189
|
+
if (isTableInContentMode({
|
|
190
|
+
tableNode: node,
|
|
191
|
+
isSupported: isContentModeSupported({
|
|
190
192
|
allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
|
|
191
193
|
allowTableResizing: !!this.reactComponentProps.allowTableResizing,
|
|
192
|
-
isFullPageEditor: !((_this$reactComponentP6 = this.reactComponentProps.options) !== null && _this$reactComponentP6 !== void 0 && _this$reactComponentP6.isCommentEditor) && !((_this$reactComponentP7 = this.reactComponentProps.options) !== null && _this$reactComponentP7 !== void 0 && _this$reactComponentP7.isChromelessEditor)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
this.table.removeAttribute('data-initial-width-mode');
|
|
198
|
-
}
|
|
194
|
+
isFullPageEditor: !((_this$reactComponentP6 = this.reactComponentProps.options) !== null && _this$reactComponentP6 !== void 0 && _this$reactComponentP6.isCommentEditor) && !((_this$reactComponentP7 = this.reactComponentProps.options) !== null && _this$reactComponentP7 !== void 0 && _this$reactComponentP7.isChromelessEditor)
|
|
195
|
+
}),
|
|
196
|
+
isTableNested: isTableNested(this.view.state, this.getPos())
|
|
197
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
|
|
198
|
+
attrs['data-initial-width-mode'] = 'content';
|
|
199
199
|
}
|
|
200
200
|
Object.keys(attrs).forEach(attr => {
|
|
201
201
|
// Ignored via go/ees005
|
|
@@ -2,11 +2,12 @@ import classNames from 'classnames';
|
|
|
2
2
|
import kebabCase from 'lodash/kebabCase';
|
|
3
3
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
4
4
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
5
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
5
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
7
8
|
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
8
9
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
9
|
-
import {
|
|
10
|
+
import { isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
10
11
|
import { getAlignmentStyle } from './table-container-styles';
|
|
11
12
|
export const tableNodeSpecWithFixedToDOM = config => {
|
|
12
13
|
const tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
@@ -15,10 +16,12 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
15
16
|
toDOM: node => {
|
|
16
17
|
const isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
|
|
17
18
|
const isInContentMode = isTableInContentMode({
|
|
18
|
-
node,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
tableNode: node,
|
|
20
|
+
isSupported: isContentModeSupported({
|
|
21
|
+
allowColumnResizing: config.allowColumnResizing,
|
|
22
|
+
allowTableResizing: config.tableResizingEnabled,
|
|
23
|
+
isFullPageEditor
|
|
24
|
+
}),
|
|
22
25
|
isTableNested: config.isNested
|
|
23
26
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
24
27
|
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`).join(';');
|
|
@@ -10,7 +10,7 @@ import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardCol
|
|
|
10
10
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from './commands/commands-with-analytics';
|
|
11
11
|
import { goToNextCellVertical } from './commands/go-to-next-cell';
|
|
12
12
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, insertTableWithNestingSupport } from './commands/insert';
|
|
13
|
-
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI,
|
|
13
|
+
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
14
14
|
var _pluginInjectionApi$a;
|
|
15
15
|
const list = {};
|
|
16
16
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
@@ -82,7 +82,7 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
82
82
|
// Ignored via go/ees005
|
|
83
83
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
84
84
|
addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
85
|
-
if (
|
|
85
|
+
if (moveRowDown.common && moveRowUp.common && moveColumnLeft.common && moveColumnRight.common) {
|
|
86
86
|
const isNewKeyMapExperiment = expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
87
87
|
// Move row/column shortcuts
|
|
88
88
|
/**
|
|
@@ -26,7 +26,7 @@ import { replaceSelectedTable } from './transforms/replace-table';
|
|
|
26
26
|
import { findControlsHoverDecoration } from './utils/decoration';
|
|
27
27
|
import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
|
|
28
28
|
import { applyMeasuredWidthToAllTables, isContentModeSupported } from './utils/tableMode';
|
|
29
|
-
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled,
|
|
29
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) => {
|
|
30
30
|
var _accessibilityUtils;
|
|
31
31
|
const state = createPluginState(dispatch, {
|
|
32
32
|
pluginConfig,
|
|
@@ -39,7 +39,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
39
39
|
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
40
40
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
41
41
|
isHeaderColumnEnabled: false,
|
|
42
|
-
isDragAndDropEnabled:
|
|
42
|
+
isDragAndDropEnabled: true,
|
|
43
43
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
44
44
|
...defaultHoveredCell,
|
|
45
45
|
...defaultTableSelection,
|
|
@@ -73,7 +73,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
73
73
|
tableRow: tableRowView({
|
|
74
74
|
eventDispatcher,
|
|
75
75
|
pluginInjectionApi,
|
|
76
|
-
isDragAndDropEnabled:
|
|
76
|
+
isDragAndDropEnabled: true
|
|
77
77
|
}),
|
|
78
78
|
tableCell: tableCellView({
|
|
79
79
|
eventDispatcher,
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
9
10
|
import { isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
|
|
10
11
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
12
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
12
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
14
|
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from './table-resizing/utils/consts';
|
|
14
15
|
import { ALIGN_START } from './utils/alignment';
|
|
15
|
-
import {
|
|
16
|
+
import { isContentModeSupported } from './utils/tableMode';
|
|
16
17
|
export const pluginKey = new PluginKey('tableWidthPlugin');
|
|
17
18
|
const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) => {
|
|
18
19
|
return new SafePlugin({
|
|
@@ -63,10 +64,12 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
|
|
|
63
64
|
if (isReplaceDocumentOperation && !isCommentEditor) {
|
|
64
65
|
newState.doc.forEach((node, offset) => {
|
|
65
66
|
if (isTableInContentMode({
|
|
66
|
-
node,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
tableNode: node,
|
|
68
|
+
isSupported: isContentModeSupported({
|
|
69
|
+
allowColumnResizing: true,
|
|
70
|
+
allowTableResizing: true,
|
|
71
|
+
isFullPageEditor: true
|
|
72
|
+
}),
|
|
70
73
|
isTableNested: false
|
|
71
74
|
})) {
|
|
72
75
|
return;
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
3
|
+
import { hasTableBeenResized } from '@atlaskit/editor-common/table';
|
|
3
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
|
-
import { hasTableColumnBeenResized } from '../table-resizing/utils/colgroup';
|
|
6
5
|
import { applyTableMeasurement, getTableMeasurement } from '../transforms/content-mode';
|
|
7
|
-
import { ALIGN_START } from './alignment';
|
|
8
|
-
export const isTableInContentMode = ({
|
|
9
|
-
allowColumnResizing,
|
|
10
|
-
allowTableResizing,
|
|
11
|
-
isFullPageEditor,
|
|
12
|
-
isTableNested,
|
|
13
|
-
node
|
|
14
|
-
}) => {
|
|
15
|
-
if (!expValEqualsNoExposure('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if (!node || isTableNested) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return isContentModeSupported({
|
|
22
|
-
allowColumnResizing,
|
|
23
|
-
allowTableResizing,
|
|
24
|
-
isFullPageEditor
|
|
25
|
-
}) && !hasTableBeenResized(node) && node.attrs.layout === ALIGN_START;
|
|
26
|
-
};
|
|
27
6
|
export const isContentModeSupported = ({
|
|
28
7
|
allowColumnResizing,
|
|
29
8
|
allowTableResizing,
|
|
@@ -31,7 +10,6 @@ export const isContentModeSupported = ({
|
|
|
31
10
|
}) => {
|
|
32
11
|
return allowColumnResizing && allowTableResizing && isFullPageEditor;
|
|
33
12
|
};
|
|
34
|
-
export const hasTableBeenResized = node => node.attrs.width !== null || hasTableColumnBeenResized(node);
|
|
35
13
|
|
|
36
14
|
/**
|
|
37
15
|
* Iterates all top-level tables in the document, and for those in content mode,
|
|
@@ -54,7 +32,7 @@ export const applyMeasuredWidthToAllTables = (view, pluginInjectionApi) => {
|
|
|
54
32
|
|
|
55
33
|
// modify only top-level tables
|
|
56
34
|
doc.forEach((node, offset) => {
|
|
57
|
-
if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !==
|
|
35
|
+
if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
|
|
58
36
|
return;
|
|
59
37
|
}
|
|
60
38
|
const domNode = view.domAtPos(offset + 1).node;
|
|
@@ -98,6 +76,10 @@ export const applyMeasuredWidthToAllTables = (view, pluginInjectionApi) => {
|
|
|
98
76
|
view.dispatch(tr.setMeta('addToHistory', false));
|
|
99
77
|
}
|
|
100
78
|
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Used to measure a selected table width with it's content being laid out natively by the browser
|
|
82
|
+
*/
|
|
101
83
|
export const applyMeasuredWidthToSelectedTable = (view, api) => {
|
|
102
84
|
var _api$analytics, _api$analytics$action, _api$width$sharedStat, _api$width, _api$width$sharedStat2;
|
|
103
85
|
const tableObject = findTable(view.state.selection);
|
|
@@ -63,7 +63,6 @@ const tablePlugin = ({
|
|
|
63
63
|
const options = {
|
|
64
64
|
...config,
|
|
65
65
|
tableOptions: (_config$tableOptions = config === null || config === void 0 ? void 0 : config.tableOptions) !== null && _config$tableOptions !== void 0 ? _config$tableOptions : {},
|
|
66
|
-
dragAndDropEnabled: (config === null || config === void 0 ? void 0 : config.dragAndDropEnabled) || fg('platform_editor_enable_table_dnd'),
|
|
67
66
|
isTableScalingEnabled: (config === null || config === void 0 ? void 0 : config.isTableScalingEnabled) || fg('platform_editor_enable_table_scaling')
|
|
68
67
|
};
|
|
69
68
|
const defaultGetEditorContainerWidth = () => {
|
|
@@ -280,12 +279,11 @@ const tablePlugin = ({
|
|
|
280
279
|
wasFullWidthEnabled,
|
|
281
280
|
tableOptions,
|
|
282
281
|
getEditorFeatureFlags,
|
|
283
|
-
dragAndDropEnabled,
|
|
284
282
|
isTableScalingEnabled,
|
|
285
283
|
isCommentEditor,
|
|
286
284
|
isChromelessEditor
|
|
287
285
|
} = options || {};
|
|
288
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled,
|
|
286
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
289
287
|
}
|
|
290
288
|
}, {
|
|
291
289
|
name: 'tablePMColResizing',
|
|
@@ -319,14 +317,13 @@ const tablePlugin = ({
|
|
|
319
317
|
nodeViewPortalProviderAPI
|
|
320
318
|
}) => {
|
|
321
319
|
const {
|
|
322
|
-
dragAndDropEnabled,
|
|
323
320
|
isTableScalingEnabled = false,
|
|
324
321
|
fullWidthEnabled = false,
|
|
325
322
|
isCommentEditor = false,
|
|
326
323
|
isChromelessEditor = false,
|
|
327
324
|
tableOptions
|
|
328
325
|
} = options || {};
|
|
329
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI,
|
|
326
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableAlignment, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableResizing);
|
|
330
327
|
}
|
|
331
328
|
}, {
|
|
332
329
|
name: 'tableSelectionKeymap',
|
|
@@ -336,9 +333,6 @@ const tablePlugin = ({
|
|
|
336
333
|
}, {
|
|
337
334
|
name: 'tableEditing',
|
|
338
335
|
plugin: () => {
|
|
339
|
-
const {
|
|
340
|
-
dragAndDropEnabled
|
|
341
|
-
} = options || {};
|
|
342
336
|
return tableEditing({
|
|
343
337
|
reportFixedTable: ({
|
|
344
338
|
tr,
|
|
@@ -354,7 +348,7 @@ const tablePlugin = ({
|
|
|
354
348
|
eventType: EVENT_TYPE.TRACK
|
|
355
349
|
})(tr);
|
|
356
350
|
},
|
|
357
|
-
dragAndDropEnabled
|
|
351
|
+
dragAndDropEnabled: true
|
|
358
352
|
});
|
|
359
353
|
}
|
|
360
354
|
}, {
|
|
@@ -367,7 +361,7 @@ const tablePlugin = ({
|
|
|
367
361
|
plugin: ({
|
|
368
362
|
dispatch
|
|
369
363
|
}) => {
|
|
370
|
-
return
|
|
364
|
+
return createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api);
|
|
371
365
|
}
|
|
372
366
|
}, {
|
|
373
367
|
name: 'tableViewModeSort',
|
|
@@ -215,7 +215,6 @@ export const ContentComponent = ({
|
|
|
215
215
|
fallbackComponent: null
|
|
216
216
|
}, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
|
|
217
217
|
featureFlags: api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState(),
|
|
218
|
-
isDragAndDropEnabledOption: options === null || options === void 0 ? void 0 : options.dragAndDropEnabled,
|
|
219
218
|
api: api
|
|
220
219
|
}), /*#__PURE__*/React.createElement(ContentComponentInternal, {
|
|
221
220
|
api: api,
|
|
@@ -8,7 +8,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
8
8
|
import { tableStyles } from './common-styles';
|
|
9
9
|
export const GlobalStylesWrapper = ({
|
|
10
10
|
featureFlags,
|
|
11
|
-
isDragAndDropEnabledOption,
|
|
12
11
|
api
|
|
13
12
|
}) => {
|
|
14
13
|
const {
|
|
@@ -23,7 +22,7 @@ export const GlobalStylesWrapper = ({
|
|
|
23
22
|
return jsx(Global, {
|
|
24
23
|
styles: tableStyles({
|
|
25
24
|
featureFlags,
|
|
26
|
-
isDragAndDropEnabled:
|
|
25
|
+
isDragAndDropEnabled: !isLivePageViewMode
|
|
27
26
|
})
|
|
28
27
|
});
|
|
29
28
|
};
|
|
@@ -397,16 +397,10 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
397
397
|
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
398
398
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
399
399
|
var _api$editorViewMode, _api$editorViewMode$s;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
isDragMenuOpen = false,
|
|
405
|
-
isDragging = false
|
|
406
|
-
} = getDragDropPluginState(state);
|
|
407
|
-
isDragHandleMenuOpened = isDragMenuOpen;
|
|
408
|
-
isTableRowOrColumnDragged = isDragging;
|
|
409
|
-
}
|
|
400
|
+
const {
|
|
401
|
+
isDragMenuOpen: isDragHandleMenuOpened = false,
|
|
402
|
+
isDragging: isTableRowOrColumnDragged = false
|
|
403
|
+
} = getDragDropPluginState(state);
|
|
410
404
|
const isTableOrColumnResizing = !!(resizeState !== null && resizeState !== void 0 && resizeState.dragging || tableWidthState !== null && tableWidthState !== void 0 && tableWidthState.resizing);
|
|
411
405
|
const isTableMenuOpened = pluginState.isContextualMenuOpen || isDragHandleMenuOpened;
|
|
412
406
|
const isTableState = isTableRowOrColumnDragged || isTableOrColumnResizing || isTableMenuOpened;
|
|
@@ -21,6 +21,7 @@ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
|
21
21
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
22
22
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
23
23
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
24
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
24
25
|
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
25
26
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
26
27
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
@@ -39,6 +40,7 @@ import { getResizeState, updateColgroup } from '../pm-plugins/table-resizing/uti
|
|
|
39
40
|
import { scaleTable } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
40
41
|
import { containsHeaderRow, isTableNested, isTableNestedInMoreThanOneNode, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, tablesHaveDifferentNoOfRows } from '../pm-plugins/utils/nodes';
|
|
41
42
|
import { getAssistiveMessage } from '../pm-plugins/utils/table';
|
|
43
|
+
import { isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
42
44
|
import { TableCssClassName as ClassName } from '../types';
|
|
43
45
|
import { handleMouseOut, handleMouseOver, isTableInFocus, withCellTracking } from '../ui/event-handlers';
|
|
44
46
|
import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
|
|
@@ -731,10 +733,24 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
731
733
|
var view = this.props.view;
|
|
732
734
|
var shouldRecreateResizeCols = !allowTableResizing || !isResizing || isNoOfColumnsChanged && isResizing;
|
|
733
735
|
if (shouldRecreateResizeCols) {
|
|
736
|
+
var _this$table7, _this$props$options10, _this$props$options11;
|
|
734
737
|
var start = getPos() || 0;
|
|
735
738
|
var depth = view.state.doc.resolve(start).depth;
|
|
736
739
|
shouldScale = depth === 0 && shouldScale;
|
|
737
740
|
insertColgroupFromNode(this.table, currentTable, shouldScale, undefined, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
741
|
+
|
|
742
|
+
// Deferred from setDomAttrs — remove only once colgroup is updated and table has left content mode.
|
|
743
|
+
if ((_this$table7 = this.table) !== null && _this$table7 !== void 0 && _this$table7.hasAttribute('data-initial-width-mode') && !isTableInContentMode({
|
|
744
|
+
tableNode: currentTable,
|
|
745
|
+
isSupported: isContentModeSupported({
|
|
746
|
+
allowColumnResizing: !!allowColumnResizing,
|
|
747
|
+
allowTableResizing: !!allowTableResizing,
|
|
748
|
+
isFullPageEditor: !((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor) && !((_this$props$options11 = this.props.options) !== null && _this$props$options11 !== void 0 && _this$props$options11.isChromelessEditor)
|
|
749
|
+
}),
|
|
750
|
+
isTableNested: isTableNested(view.state, getPos())
|
|
751
|
+
})) {
|
|
752
|
+
this.table.removeAttribute('data-initial-width-mode');
|
|
753
|
+
}
|
|
738
754
|
}
|
|
739
755
|
updateControls()(view.state);
|
|
740
756
|
}
|
|
@@ -762,7 +778,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
762
778
|
key: "render",
|
|
763
779
|
value: function render() {
|
|
764
780
|
var _this5 = this,
|
|
765
|
-
_this$props$
|
|
781
|
+
_this$props$options12;
|
|
766
782
|
var _this$props10 = this.props,
|
|
767
783
|
view = _this$props10.view,
|
|
768
784
|
getNode = _this$props10.getNode,
|
|
@@ -866,7 +882,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
866
882
|
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
867
883
|
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
868
884
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
869
|
-
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$
|
|
885
|
+
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor));
|
|
870
886
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
871
887
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
872
888
|
, {
|
|
@@ -12,18 +12,18 @@ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prot
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
14
14
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
15
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
15
16
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
16
17
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
17
18
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
18
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
19
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
21
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
22
22
|
import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
|
|
23
23
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
24
24
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
25
25
|
import { isTableNested, tablesHaveDifferentColumnWidths } from '../pm-plugins/utils/nodes';
|
|
26
|
-
import {
|
|
26
|
+
import { isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
27
27
|
import { TableComponentWithSharedState } from './TableComponentWithSharedState';
|
|
28
28
|
import { tableNodeSpecWithFixedToDOM } from './toDOM';
|
|
29
29
|
var tableAttributes = function tableAttributes(node) {
|
|
@@ -199,7 +199,9 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
199
199
|
}, {
|
|
200
200
|
key: "setDomAttrs",
|
|
201
201
|
value: function setDomAttrs(node) {
|
|
202
|
-
var
|
|
202
|
+
var _this$reactComponentP6,
|
|
203
|
+
_this$reactComponentP7,
|
|
204
|
+
_this3 = this,
|
|
203
205
|
_this$reactComponentP8,
|
|
204
206
|
_this$getEditorFeatur2,
|
|
205
207
|
_this$options3,
|
|
@@ -208,19 +210,19 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
208
210
|
return; // width / attribute application to actual table will happen later when table is set
|
|
209
211
|
}
|
|
210
212
|
var attrs = tableAttributes(node);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
|
|
214
|
+
// render table with content-mode attribute which removes all width constraints from the table
|
|
215
|
+
// fire exposure here
|
|
216
|
+
if (isTableInContentMode({
|
|
217
|
+
tableNode: node,
|
|
218
|
+
isSupported: isContentModeSupported({
|
|
215
219
|
allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
|
|
216
220
|
allowTableResizing: !!this.reactComponentProps.allowTableResizing,
|
|
217
|
-
isFullPageEditor: !((_this$reactComponentP6 = this.reactComponentProps.options) !== null && _this$reactComponentP6 !== void 0 && _this$reactComponentP6.isCommentEditor) && !((_this$reactComponentP7 = this.reactComponentProps.options) !== null && _this$reactComponentP7 !== void 0 && _this$reactComponentP7.isChromelessEditor)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
this.table.removeAttribute('data-initial-width-mode');
|
|
223
|
-
}
|
|
221
|
+
isFullPageEditor: !((_this$reactComponentP6 = this.reactComponentProps.options) !== null && _this$reactComponentP6 !== void 0 && _this$reactComponentP6.isCommentEditor) && !((_this$reactComponentP7 = this.reactComponentProps.options) !== null && _this$reactComponentP7 !== void 0 && _this$reactComponentP7.isChromelessEditor)
|
|
222
|
+
}),
|
|
223
|
+
isTableNested: isTableNested(this.view.state, this.getPos())
|
|
224
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
|
|
225
|
+
attrs['data-initial-width-mode'] = 'content';
|
|
224
226
|
}
|
|
225
227
|
Object.keys(attrs).forEach(function (attr) {
|
|
226
228
|
// Ignored via go/ees005
|
|
@@ -7,11 +7,12 @@ import classNames from 'classnames';
|
|
|
7
7
|
import kebabCase from 'lodash/kebabCase';
|
|
8
8
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
9
9
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
10
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
10
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
12
|
import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
12
13
|
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
13
14
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
14
|
-
import {
|
|
15
|
+
import { isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
15
16
|
import { getAlignmentStyle } from './table-container-styles';
|
|
16
17
|
export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
17
18
|
var tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
@@ -19,10 +20,12 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
19
20
|
toDOM: function toDOM(node) {
|
|
20
21
|
var isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
|
|
21
22
|
var isInContentMode = isTableInContentMode({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
tableNode: node,
|
|
24
|
+
isSupported: isContentModeSupported({
|
|
25
|
+
allowColumnResizing: config.allowColumnResizing,
|
|
26
|
+
allowTableResizing: config.tableResizingEnabled,
|
|
27
|
+
isFullPageEditor: isFullPageEditor
|
|
28
|
+
}),
|
|
26
29
|
isTableNested: config.isNested
|
|
27
30
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
28
31
|
var alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(function (_ref) {
|