@atlaskit/editor-plugin-table 10.13.2 → 10.13.3
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 +8 -0
- package/dist/cjs/pm-plugins/commands/delete.js +7 -10
- package/dist/cjs/pm-plugins/decorations/plugin.js +10 -13
- package/dist/cjs/pm-plugins/transforms/delete-rows.js +7 -10
- package/dist/cjs/ui/toolbar.js +5 -6
- package/dist/es2019/pm-plugins/commands/delete.js +7 -10
- package/dist/es2019/pm-plugins/decorations/plugin.js +10 -13
- package/dist/es2019/pm-plugins/transforms/delete-rows.js +7 -10
- package/dist/es2019/ui/toolbar.js +5 -6
- package/dist/esm/pm-plugins/commands/delete.js +7 -10
- package/dist/esm/pm-plugins/decorations/plugin.js +10 -13
- package/dist/esm/pm-plugins/transforms/delete-rows.js +7 -10
- package/dist/esm/ui/toolbar.js +5 -6
- package/dist/types/ui/ContentComponent.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentComponent.d.ts +1 -1
- package/package.json +3 -6
- package/src/pm-plugins/commands/delete.ts +7 -10
- package/src/pm-plugins/commands/go-to-next-cell.ts +1 -1
- package/src/pm-plugins/decorations/plugin.ts +13 -16
- package/src/pm-plugins/transforms/delete-rows.ts +7 -10
- package/src/ui/ContentComponent.tsx +1 -1
- package/src/ui/toolbar.tsx +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.13.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#181594](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181594)
|
|
8
|
+
[`f7fa55cd505ce`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f7fa55cd505ce) -
|
|
9
|
+
Avoid using tables commands directly in floating toolbar plugin.
|
|
10
|
+
|
|
3
11
|
## 10.13.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deleteColumnsCommand = void 0;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
var _pluginKey = require("../plugin-key");
|
|
9
8
|
var _deleteColumns = require("../transforms/delete-columns");
|
|
10
9
|
var _getAllowAddColumnCustomStep = require("../utils/get-allow-add-column-custom-step");
|
|
@@ -16,15 +15,13 @@ var deleteColumnsCommand = exports.deleteColumnsCommand = function deleteColumns
|
|
|
16
15
|
return function (state, dispatch, view) {
|
|
17
16
|
var tr = (0, _deleteColumns.deleteColumns)(rect, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
18
17
|
// If we delete a column we should also clean up the hover selection
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
}
|
|
18
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
19
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
20
|
+
data: {
|
|
21
|
+
isInDanger: false,
|
|
22
|
+
isWholeTableInDanger: false
|
|
23
|
+
}
|
|
24
|
+
});
|
|
28
25
|
if (dispatch) {
|
|
29
26
|
dispatch(tr);
|
|
30
27
|
return true;
|
|
@@ -10,7 +10,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
11
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _pluginKey = require("../plugin-key");
|
|
15
14
|
var _tableWidth = require("../table-width");
|
|
16
15
|
var _columnControls = require("./utils/column-controls");
|
|
@@ -41,6 +40,7 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
|
|
|
41
40
|
}
|
|
42
41
|
});
|
|
43
42
|
} else if (tr.selectionSet) {
|
|
43
|
+
var _findTable, _findTable2;
|
|
44
44
|
var isTransactionFromMouseClick = !tr.docChanged && tr.selectionSet && tr.getMeta('pointer');
|
|
45
45
|
if (isTransactionFromMouseClick || oldState.selection instanceof _cellSelection.CellSelection) {
|
|
46
46
|
return (0, _columnControls.maybeUpdateColumnControlsSelectedDecoration)({
|
|
@@ -48,18 +48,15 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
|
|
|
48
48
|
tr: tr
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
51
|
+
// We're exiting a table with an existing decorations so we should clean it up
|
|
52
|
+
if ((isInDanger || isTableHovered) && (!(0, _coreUtils.insideTable)(newState) || ((_findTable = (0, _utils.findTable)(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = (0, _utils.findTable)(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
|
|
53
|
+
return (0, _columnControls.buildColumnControlsDecorations)({
|
|
54
|
+
decorationSet: decorationSet,
|
|
55
|
+
tr: tr,
|
|
56
|
+
options: {
|
|
57
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
58
|
+
}
|
|
59
|
+
});
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
return decorationSet;
|
|
@@ -10,7 +10,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _pluginKey = require("../plugin-key");
|
|
15
14
|
var _merge = require("./merge");
|
|
16
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -120,15 +119,13 @@ var deleteRows = exports.deleteRows = function deleteRows(rect) {
|
|
|
120
119
|
var cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
121
120
|
|
|
122
121
|
// If we delete a row we should also clean up the hover selection
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
}
|
|
122
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
123
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
124
|
+
data: {
|
|
125
|
+
isInDanger: false,
|
|
126
|
+
isWholeTableInDanger: false
|
|
127
|
+
}
|
|
128
|
+
});
|
|
132
129
|
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
133
130
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
134
131
|
.setSelection(_state.Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -428,7 +428,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
428
428
|
return element;
|
|
429
429
|
};
|
|
430
430
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
431
|
-
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth,
|
|
431
|
+
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
432
432
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
433
433
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
434
434
|
var colorPicker = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
@@ -718,7 +718,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
718
718
|
}
|
|
719
719
|
return false;
|
|
720
720
|
};
|
|
721
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth,
|
|
721
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
722
722
|
var formatMessage = _ref6.formatMessage;
|
|
723
723
|
var tableObject = (0, _utils3.findTable)(editorState.selection);
|
|
724
724
|
if (!tableObject) {
|
|
@@ -765,7 +765,7 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
765
765
|
title: formatMessage(layoutToMessages[value]),
|
|
766
766
|
selected: (0, _alignment.normaliseAlignment)(currentLayout) === value,
|
|
767
767
|
onClick: (0, _commandsWithAnalytics.setTableAlignmentWithAnalytics)(editorAnalyticsAPI, isCommentEditor || false)(value, currentLayout, _analytics.INPUT_METHOD.FLOATING_TB, _analytics.CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED)
|
|
768
|
-
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth,
|
|
768
|
+
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) && {
|
|
769
769
|
disabled: value !== 'center'
|
|
770
770
|
});
|
|
771
771
|
});
|
|
@@ -797,15 +797,14 @@ var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmentIcons,
|
|
|
797
797
|
return icon.value === (0, _alignment.normaliseAlignment)(selectedAlignment);
|
|
798
798
|
});
|
|
799
799
|
};
|
|
800
|
-
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth,
|
|
800
|
+
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
801
801
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
802
802
|
lineLength = _getEditorContainerWi.lineLength;
|
|
803
803
|
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(selectedNode);
|
|
804
804
|
|
|
805
805
|
// table may be scaled, use the scale percent to calculate the table width
|
|
806
806
|
if (editorView) {
|
|
807
|
-
var
|
|
808
|
-
var tableWrapperWidth = (0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions') ? tableContainerWidth : ((_getDomRef = getDomRef(editorView)) === null || _getDomRef === void 0 ? void 0 : _getDomRef.clientWidth) || tableContainerWidth;
|
|
807
|
+
var tableWrapperWidth = tableContainerWidth;
|
|
809
808
|
var scalePercent = (0, _misc.getStaticTableScalingPercent)(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
|
|
810
809
|
tableContainerWidth = tableContainerWidth * scalePercent;
|
|
811
810
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { pluginKey } from '../plugin-key';
|
|
3
2
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
4
3
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
5
4
|
export const deleteColumnsCommand = (rect, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (state, dispatch, view) => {
|
|
6
5
|
const tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
7
6
|
// If we delete a column we should also clean up the hover selection
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
}
|
|
7
|
+
tr.setMeta(pluginKey, {
|
|
8
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
9
|
+
data: {
|
|
10
|
+
isInDanger: false,
|
|
11
|
+
isWholeTableInDanger: false
|
|
12
|
+
}
|
|
13
|
+
});
|
|
17
14
|
if (dispatch) {
|
|
18
15
|
dispatch(tr);
|
|
19
16
|
return true;
|
|
@@ -4,7 +4,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
6
6
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
9
8
|
import { pluginKey as tableWidthPluginKey } from '../table-width';
|
|
10
9
|
import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils/column-controls';
|
|
@@ -33,6 +32,7 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
|
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
} else if (tr.selectionSet) {
|
|
35
|
+
var _findTable, _findTable2;
|
|
36
36
|
const isTransactionFromMouseClick = !tr.docChanged && tr.selectionSet && tr.getMeta('pointer');
|
|
37
37
|
if (isTransactionFromMouseClick || oldState.selection instanceof CellSelection) {
|
|
38
38
|
return maybeUpdateColumnControlsSelectedDecoration({
|
|
@@ -40,18 +40,15 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
|
|
|
40
40
|
tr
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
43
|
+
// We're exiting a table with an existing decorations so we should clean it up
|
|
44
|
+
if ((isInDanger || isTableHovered) && (!insideTable(newState) || ((_findTable = findTable(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = findTable(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
|
|
45
|
+
return buildColumnControlsDecorations({
|
|
46
|
+
decorationSet,
|
|
47
|
+
tr,
|
|
48
|
+
options: {
|
|
49
|
+
isDragAndDropEnabled
|
|
50
|
+
}
|
|
51
|
+
});
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
return decorationSet;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { pluginKey } from '../plugin-key';
|
|
6
5
|
import { mergeEmptyColumns } from './merge';
|
|
7
6
|
export const deleteRows = (rect, isHeaderRowRequired = false) => tr => {
|
|
@@ -101,15 +100,13 @@ export const deleteRows = (rect, isHeaderRowRequired = false) => tr => {
|
|
|
101
100
|
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
102
101
|
|
|
103
102
|
// If we delete a row we should also clean up the hover selection
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
112
|
-
}
|
|
103
|
+
tr.setMeta(pluginKey, {
|
|
104
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
105
|
+
data: {
|
|
106
|
+
isInDanger: false,
|
|
107
|
+
isWholeTableInDanger: false
|
|
108
|
+
}
|
|
109
|
+
});
|
|
113
110
|
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
114
111
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
115
112
|
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
@@ -407,7 +407,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
407
407
|
return element;
|
|
408
408
|
};
|
|
409
409
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
410
|
-
const alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth,
|
|
410
|
+
const alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
411
411
|
const cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
412
412
|
const columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
413
413
|
const colorPicker = editorExperiment('platform_editor_controls', 'control') ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
@@ -672,7 +672,7 @@ const highlightColumnsHandler = (state, dispatch) => {
|
|
|
672
672
|
};
|
|
673
673
|
const getAlignmentOptionsConfig = (editorState, {
|
|
674
674
|
formatMessage
|
|
675
|
-
}, editorAnalyticsAPI, getEditorContainerWidth,
|
|
675
|
+
}, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) => {
|
|
676
676
|
const tableObject = findTable(editorState.selection);
|
|
677
677
|
if (!tableObject) {
|
|
678
678
|
return [];
|
|
@@ -716,7 +716,7 @@ const getAlignmentOptionsConfig = (editorState, {
|
|
|
716
716
|
title: formatMessage(layoutToMessages[value]),
|
|
717
717
|
selected: normaliseAlignment(currentLayout) === value,
|
|
718
718
|
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI, isCommentEditor || false)(value, currentLayout, INPUT_METHOD.FLOATING_TB, CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED),
|
|
719
|
-
...(isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth,
|
|
719
|
+
...(isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) && {
|
|
720
720
|
disabled: value !== 'center'
|
|
721
721
|
})
|
|
722
722
|
};
|
|
@@ -747,7 +747,7 @@ const getSelectedAlignmentIcon = (alignmentIcons, selectedNode) => {
|
|
|
747
747
|
const selectedAlignment = selectedNode.attrs.layout;
|
|
748
748
|
return alignmentIcons.find(icon => icon.value === normaliseAlignment(selectedAlignment));
|
|
749
749
|
};
|
|
750
|
-
const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth,
|
|
750
|
+
const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) => {
|
|
751
751
|
const {
|
|
752
752
|
lineLength
|
|
753
753
|
} = getEditorContainerWidth();
|
|
@@ -755,8 +755,7 @@ const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth, getDomRef
|
|
|
755
755
|
|
|
756
756
|
// table may be scaled, use the scale percent to calculate the table width
|
|
757
757
|
if (editorView) {
|
|
758
|
-
|
|
759
|
-
const tableWrapperWidth = fg('platform_editor_remove_slow_table_transactions') ? tableContainerWidth : ((_getDomRef = getDomRef(editorView)) === null || _getDomRef === void 0 ? void 0 : _getDomRef.clientWidth) || tableContainerWidth;
|
|
758
|
+
const tableWrapperWidth = tableContainerWidth;
|
|
760
759
|
const scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
|
|
761
760
|
tableContainerWidth = tableContainerWidth * scalePercent;
|
|
762
761
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { pluginKey } from '../plugin-key';
|
|
3
2
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
4
3
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
@@ -10,15 +9,13 @@ export var deleteColumnsCommand = function deleteColumnsCommand(rect, api) {
|
|
|
10
9
|
return function (state, dispatch, view) {
|
|
11
10
|
var tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
12
11
|
// If we delete a column we should also clean up the hover selection
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
12
|
+
tr.setMeta(pluginKey, {
|
|
13
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
14
|
+
data: {
|
|
15
|
+
isInDanger: false,
|
|
16
|
+
isWholeTableInDanger: false
|
|
17
|
+
}
|
|
18
|
+
});
|
|
22
19
|
if (dispatch) {
|
|
23
20
|
dispatch(tr);
|
|
24
21
|
return true;
|
|
@@ -4,7 +4,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
6
6
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
9
8
|
import { pluginKey as tableWidthPluginKey } from '../table-width';
|
|
10
9
|
import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils/column-controls';
|
|
@@ -35,6 +34,7 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
|
|
|
35
34
|
}
|
|
36
35
|
});
|
|
37
36
|
} else if (tr.selectionSet) {
|
|
37
|
+
var _findTable, _findTable2;
|
|
38
38
|
var isTransactionFromMouseClick = !tr.docChanged && tr.selectionSet && tr.getMeta('pointer');
|
|
39
39
|
if (isTransactionFromMouseClick || oldState.selection instanceof CellSelection) {
|
|
40
40
|
return maybeUpdateColumnControlsSelectedDecoration({
|
|
@@ -42,18 +42,15 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
|
|
|
42
42
|
tr: tr
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
45
|
+
// We're exiting a table with an existing decorations so we should clean it up
|
|
46
|
+
if ((isInDanger || isTableHovered) && (!insideTable(newState) || ((_findTable = findTable(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = findTable(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
|
|
47
|
+
return buildColumnControlsDecorations({
|
|
48
|
+
decorationSet: decorationSet,
|
|
49
|
+
tr: tr,
|
|
50
|
+
options: {
|
|
51
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
52
|
+
}
|
|
53
|
+
});
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
return decorationSet;
|
|
@@ -5,7 +5,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { pluginKey } from '../plugin-key';
|
|
10
9
|
import { mergeEmptyColumns } from './merge';
|
|
11
10
|
export var deleteRows = function deleteRows(rect) {
|
|
@@ -113,15 +112,13 @@ export var deleteRows = function deleteRows(rect) {
|
|
|
113
112
|
var cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
114
113
|
|
|
115
114
|
// If we delete a row we should also clean up the hover selection
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
}
|
|
115
|
+
tr.setMeta(pluginKey, {
|
|
116
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
117
|
+
data: {
|
|
118
|
+
isInDanger: false,
|
|
119
|
+
isWholeTableInDanger: false
|
|
120
|
+
}
|
|
121
|
+
});
|
|
125
122
|
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
126
123
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
127
124
|
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -421,7 +421,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
421
421
|
return element;
|
|
422
422
|
};
|
|
423
423
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
424
|
-
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth,
|
|
424
|
+
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
425
425
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
426
426
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
427
427
|
var colorPicker = editorExperiment('platform_editor_controls', 'control') ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
@@ -711,7 +711,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
711
711
|
}
|
|
712
712
|
return false;
|
|
713
713
|
};
|
|
714
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth,
|
|
714
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
715
715
|
var formatMessage = _ref6.formatMessage;
|
|
716
716
|
var tableObject = findTable(editorState.selection);
|
|
717
717
|
if (!tableObject) {
|
|
@@ -758,7 +758,7 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
758
758
|
title: formatMessage(layoutToMessages[value]),
|
|
759
759
|
selected: normaliseAlignment(currentLayout) === value,
|
|
760
760
|
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI, isCommentEditor || false)(value, currentLayout, INPUT_METHOD.FLOATING_TB, CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED)
|
|
761
|
-
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth,
|
|
761
|
+
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) && {
|
|
762
762
|
disabled: value !== 'center'
|
|
763
763
|
});
|
|
764
764
|
});
|
|
@@ -790,15 +790,14 @@ var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmentIcons,
|
|
|
790
790
|
return icon.value === normaliseAlignment(selectedAlignment);
|
|
791
791
|
});
|
|
792
792
|
};
|
|
793
|
-
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth,
|
|
793
|
+
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
794
794
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
795
795
|
lineLength = _getEditorContainerWi.lineLength;
|
|
796
796
|
var tableContainerWidth = getTableContainerWidth(selectedNode);
|
|
797
797
|
|
|
798
798
|
// table may be scaled, use the scale percent to calculate the table width
|
|
799
799
|
if (editorView) {
|
|
800
|
-
var
|
|
801
|
-
var tableWrapperWidth = fg('platform_editor_remove_slow_table_transactions') ? tableContainerWidth : ((_getDomRef = getDomRef(editorView)) === null || _getDomRef === void 0 ? void 0 : _getDomRef.clientWidth) || tableContainerWidth;
|
|
800
|
+
var tableWrapperWidth = tableContainerWidth;
|
|
802
801
|
var scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
|
|
803
802
|
tableContainerWidth = tableContainerWidth * scalePercent;
|
|
804
803
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { type ExtractInjectionAPI, type GetEditorContainerWidth, type GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { type TablePlugin, type TablePluginOptions } from '../tablePluginType';
|
|
6
6
|
export type ContentComponentProps = {
|
|
7
7
|
api: ExtractInjectionAPI<TablePlugin> | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { type ExtractInjectionAPI, type GetEditorContainerWidth, type GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { type TablePlugin, type TablePluginOptions } from '../tablePluginType';
|
|
6
6
|
export type ContentComponentProps = {
|
|
7
7
|
api: ExtractInjectionAPI<TablePlugin> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.13.
|
|
3
|
+
"version": "10.13.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
32
32
|
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
34
|
-
"@atlaskit/editor-common": "^107.
|
|
34
|
+
"@atlaskit/editor-common": "^107.6.0",
|
|
35
35
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
55
55
|
"@atlaskit/primitives": "^14.10.0",
|
|
56
56
|
"@atlaskit/theme": "^18.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^8.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^8.7.0",
|
|
58
58
|
"@atlaskit/toggle": "^15.0.0",
|
|
59
59
|
"@atlaskit/tokens": "^5.4.0",
|
|
60
60
|
"@atlaskit/tooltip": "^20.3.0",
|
|
@@ -180,9 +180,6 @@
|
|
|
180
180
|
"platform_editor_tables_table_selector": {
|
|
181
181
|
"type": "boolean"
|
|
182
182
|
},
|
|
183
|
-
"platform_editor_remove_slow_table_transactions": {
|
|
184
|
-
"type": "boolean"
|
|
185
|
-
},
|
|
186
183
|
"platform_editor_fix_table_resizing_undo": {
|
|
187
184
|
"type": "boolean"
|
|
188
185
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
|
|
5
4
|
import type { PluginInjectionAPI } from '../../types';
|
|
6
5
|
import { pluginKey } from '../plugin-key';
|
|
@@ -28,15 +27,13 @@ export const deleteColumnsCommand =
|
|
|
28
27
|
isCommentEditor,
|
|
29
28
|
)(state.tr);
|
|
30
29
|
// If we delete a column we should also clean up the hover selection
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
30
|
+
tr.setMeta(pluginKey, {
|
|
31
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
32
|
+
data: {
|
|
33
|
+
isInDanger: false,
|
|
34
|
+
isWholeTableInDanger: false,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
40
37
|
if (dispatch) {
|
|
41
38
|
dispatch(tr);
|
|
42
39
|
return true;
|
|
@@ -4,7 +4,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
|
|
6
6
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
7
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -10,7 +10,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
|
|
15
14
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
16
15
|
import { pluginKey as tableWidthPluginKey } from '../table-width';
|
|
@@ -59,21 +58,19 @@ export const handleDocOrSelectionChanged = (
|
|
|
59
58
|
tr,
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
}
|
|
61
|
+
// We're exiting a table with an existing decorations so we should clean it up
|
|
62
|
+
if (
|
|
63
|
+
(isInDanger || isTableHovered) &&
|
|
64
|
+
(!insideTable(newState) ||
|
|
65
|
+
findTable(newState.selection)?.node !== findTable(oldState.selection)?.node)
|
|
66
|
+
) {
|
|
67
|
+
return buildColumnControlsDecorations({
|
|
68
|
+
decorationSet,
|
|
69
|
+
tr,
|
|
70
|
+
options: {
|
|
71
|
+
isDragAndDropEnabled,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
|
|
@@ -5,7 +5,6 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
|
|
10
9
|
import { pluginKey } from '../plugin-key';
|
|
11
10
|
|
|
@@ -131,15 +130,13 @@ export const deleteRows =
|
|
|
131
130
|
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
132
131
|
|
|
133
132
|
// If we delete a row we should also clean up the hover selection
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
}
|
|
133
|
+
tr.setMeta(pluginKey, {
|
|
134
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
135
|
+
data: {
|
|
136
|
+
isInDanger: false,
|
|
137
|
+
isWholeTableInDanger: false,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
143
140
|
|
|
144
141
|
return (
|
|
145
142
|
tr
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type GetEditorContainerWidth,
|
|
14
14
|
type GetEditorFeatureFlags,
|
|
15
15
|
} from '@atlaskit/editor-common/types';
|
|
16
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
16
|
+
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
17
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
18
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
19
19
|
|
package/src/ui/toolbar.tsx
CHANGED
|
@@ -566,7 +566,6 @@ export const getToolbarConfig =
|
|
|
566
566
|
intl,
|
|
567
567
|
editorAnalyticsAPI,
|
|
568
568
|
getEditorContainerWidth,
|
|
569
|
-
getDomRef,
|
|
570
569
|
editorView,
|
|
571
570
|
shouldUseIncreasedScalingPercent,
|
|
572
571
|
options?.fullWidthEnabled,
|
|
@@ -1013,7 +1012,6 @@ const getAlignmentOptionsConfig = (
|
|
|
1013
1012
|
{ formatMessage }: ToolbarMenuContext,
|
|
1014
1013
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
1015
1014
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
1016
|
-
getDomRef: (editorView: EditorView) => HTMLElement | undefined,
|
|
1017
1015
|
editorView: EditorView | null,
|
|
1018
1016
|
shouldUseIncreasedScalingPercent: boolean,
|
|
1019
1017
|
isFullWidthEditor?: boolean,
|
|
@@ -1077,7 +1075,6 @@ const getAlignmentOptionsConfig = (
|
|
|
1077
1075
|
...(isLayoutOptionDisabled(
|
|
1078
1076
|
tableObject.node,
|
|
1079
1077
|
getEditorContainerWidth,
|
|
1080
|
-
getDomRef,
|
|
1081
1078
|
editorView,
|
|
1082
1079
|
shouldUseIncreasedScalingPercent,
|
|
1083
1080
|
isFullWidthEditor,
|
|
@@ -1127,7 +1124,6 @@ const getSelectedAlignmentIcon = (alignmentIcons: AlignmentIcon[], selectedNode:
|
|
|
1127
1124
|
const isLayoutOptionDisabled = (
|
|
1128
1125
|
selectedNode: PMNode,
|
|
1129
1126
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
1130
|
-
getDomRef: (editorView: EditorView) => HTMLElement | undefined,
|
|
1131
1127
|
editorView: EditorView | null,
|
|
1132
1128
|
shouldUseIncreasedScalingPercent: boolean,
|
|
1133
1129
|
isFullWidthEditor: boolean | undefined,
|
|
@@ -1137,9 +1133,7 @@ const isLayoutOptionDisabled = (
|
|
|
1137
1133
|
|
|
1138
1134
|
// table may be scaled, use the scale percent to calculate the table width
|
|
1139
1135
|
if (editorView) {
|
|
1140
|
-
const tableWrapperWidth =
|
|
1141
|
-
? tableContainerWidth
|
|
1142
|
-
: getDomRef(editorView)?.clientWidth || tableContainerWidth;
|
|
1136
|
+
const tableWrapperWidth = tableContainerWidth;
|
|
1143
1137
|
const scalePercent = getStaticTableScalingPercent(
|
|
1144
1138
|
selectedNode,
|
|
1145
1139
|
tableWrapperWidth,
|