@atlaskit/editor-plugin-table 27.0.1 → 27.0.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 +15 -0
- package/dist/cjs/pm-plugins/decorations/utils/column-controls.js +0 -2
- package/dist/cjs/pm-plugins/handlers.js +0 -1
- package/dist/cjs/pm-plugins/table-resizing/plugin-factory.js +1 -2
- package/dist/cjs/pm-plugins/utils/collapse.js +0 -2
- package/dist/cjs/pm-plugins/utils/decoration.js +0 -2
- package/dist/cjs/ui/toolbar.js +27 -1
- package/dist/es2019/pm-plugins/decorations/utils/column-controls.js +0 -2
- package/dist/es2019/pm-plugins/handlers.js +0 -3
- package/dist/es2019/pm-plugins/table-resizing/plugin-factory.js +0 -1
- package/dist/es2019/pm-plugins/utils/collapse.js +0 -2
- package/dist/es2019/pm-plugins/utils/decoration.js +0 -3
- package/dist/es2019/ui/toolbar.js +27 -1
- package/dist/esm/pm-plugins/decorations/utils/column-controls.js +0 -2
- package/dist/esm/pm-plugins/handlers.js +0 -3
- package/dist/esm/pm-plugins/table-resizing/plugin-factory.js +0 -1
- package/dist/esm/pm-plugins/utils/collapse.js +0 -2
- package/dist/esm/pm-plugins/utils/decoration.js +0 -3
- package/dist/esm/ui/toolbar.js +27 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 27.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ce7484d621739`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ce7484d621739) -
|
|
8
|
+
Fix table controls after editor remounts by refreshing stale toolbar anchors and publishing the
|
|
9
|
+
selected table ref before the first interaction, behind the
|
|
10
|
+
`platform_editor_table_toolbar_position_fix` experiment.
|
|
11
|
+
|
|
12
|
+
## 27.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 27.0.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -8,8 +8,6 @@ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
|
8
8
|
var _types = require("../../../types");
|
|
9
9
|
var _decoration = require("../../utils/decoration");
|
|
10
10
|
var _composeDecorations = require("./compose-decorations");
|
|
11
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
12
|
-
|
|
13
11
|
var isColumnSelected = function isColumnSelected(tr) {
|
|
14
12
|
return tr.selection instanceof _cellSelection.CellSelection && tr.selection.isColSelection();
|
|
15
13
|
};
|
|
@@ -19,7 +19,6 @@ var _collapse = require("./utils/collapse");
|
|
|
19
19
|
var _nodes = require("./utils/nodes");
|
|
20
20
|
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; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // #region Imports
|
|
22
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
23
22
|
var nextTableSorting = function nextTableSorting(tr, table) {
|
|
24
23
|
var tableSortStep = tr.steps.find(function (step) {
|
|
25
24
|
return step instanceof _customSteps.TableSortStep;
|
|
@@ -10,8 +10,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
10
10
|
var _pluginKey = require("./plugin-key");
|
|
11
11
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
12
12
|
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; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } //
|
|
14
|
-
// eslint-disable-next-line import/order
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line import/order
|
|
15
14
|
// eslint-disable-next-line import/order
|
|
16
15
|
|
|
17
16
|
// eslint-disable-next-line import/order
|
|
@@ -7,8 +7,6 @@ exports.isTableCollapsible = exports.collapseSelectedTable = void 0;
|
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
8
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
9
9
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
10
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
11
|
-
|
|
12
10
|
var bail = function bail() {
|
|
13
11
|
return {
|
|
14
12
|
tableIsCollapsible: false
|
|
@@ -17,8 +17,6 @@ var _types = require("../../types");
|
|
|
17
17
|
var _ColumnResizeWidget = require("../../ui/ColumnResizeWidget");
|
|
18
18
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
19
19
|
|
|
20
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
21
|
-
|
|
22
20
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
23
21
|
return decorationSet.find(undefined, undefined, function (spec) {
|
|
24
22
|
return spec.key.indexOf(key) > -1;
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -35,6 +35,7 @@ var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize")
|
|
|
35
35
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
36
36
|
var _shrinkHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/shrink-horizontal"));
|
|
37
37
|
var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/core/table-columns-distribute"));
|
|
38
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
38
39
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
39
40
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
40
41
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -371,7 +372,32 @@ var getTableWrapperFromParentImpl = function getTableWrapperFromParentImpl(paren
|
|
|
371
372
|
}
|
|
372
373
|
return (0, _utils.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
|
|
373
374
|
};
|
|
375
|
+
var cachedTableWrapperParent;
|
|
376
|
+
var cachedTableWrapperEditorRoot;
|
|
377
|
+
var cachedTableWrapper;
|
|
378
|
+
var getCachedTableWrapperFromParent = function getCachedTableWrapperFromParent(parent, editorView) {
|
|
379
|
+
var _cachedTableWrapper;
|
|
380
|
+
var editorRoot = editorView.dom;
|
|
381
|
+
if (parent && parent === cachedTableWrapperParent && editorRoot === cachedTableWrapperEditorRoot && (_cachedTableWrapper = cachedTableWrapper) !== null && _cachedTableWrapper !== void 0 && _cachedTableWrapper.isConnected && editorRoot.isConnected && editorRoot.contains(parent) && editorRoot.contains(cachedTableWrapper) && parent.contains(cachedTableWrapper) && cachedTableWrapper.querySelector('table')) {
|
|
382
|
+
return cachedTableWrapper;
|
|
383
|
+
}
|
|
384
|
+
cachedTableWrapperParent = parent;
|
|
385
|
+
cachedTableWrapperEditorRoot = editorRoot;
|
|
386
|
+
cachedTableWrapper = undefined;
|
|
387
|
+
if (!parent || !parent.isConnected || !editorRoot.isConnected || !editorRoot.contains(parent)) {
|
|
388
|
+
return undefined;
|
|
389
|
+
}
|
|
390
|
+
if (!(parent instanceof HTMLElement)) {
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
var tableWrapper = getTableWrapperFromParentImpl(parent);
|
|
394
|
+
if (tableWrapper !== null && tableWrapper !== void 0 && tableWrapper.isConnected && editorRoot.contains(tableWrapper) && parent.contains(tableWrapper)) {
|
|
395
|
+
cachedTableWrapper = tableWrapper;
|
|
396
|
+
}
|
|
397
|
+
return cachedTableWrapper;
|
|
398
|
+
};
|
|
374
399
|
|
|
400
|
+
// Remove this function when cleaning up `platform_editor_table_toolbar_position_fix`
|
|
375
401
|
// Create memoized version ONCE - reused across all calls
|
|
376
402
|
var getMemoizedTableWrapperFromParent = (0, _memoizeOne.default)(getTableWrapperFromParentImpl);
|
|
377
403
|
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, api, editorAnalyticsAPI, getEditorView, options) {
|
|
@@ -422,7 +448,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
422
448
|
var getDomRef = function getDomRef(editorView) {
|
|
423
449
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
424
450
|
var parent = (0, _utils2.findParentDomRefOfType)(nodeType, domAtPos)(state.selection);
|
|
425
|
-
return getMemoizedTableWrapperFromParent(parent);
|
|
451
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_toolbar_position_fix') ? getCachedTableWrapperFromParent(parent, editorView) : getMemoizedTableWrapperFromParent(parent);
|
|
426
452
|
};
|
|
427
453
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
428
454
|
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
2
|
-
|
|
3
1
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
2
|
import { TableDecorations } from '../../../types';
|
|
5
3
|
import { createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../utils/decoration';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// #region Imports
|
|
2
2
|
import { TableSortStep } from '@atlaskit/custom-steps';
|
|
3
3
|
import { isTextInput } from '@atlaskit/editor-common/utils';
|
|
4
|
-
|
|
5
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
6
|
-
|
|
7
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
9
6
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
3
|
-
|
|
4
2
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
5
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
6
4
|
const bail = () => ({
|
|
@@ -3,9 +3,6 @@ import { RawIntlProvider } from 'react-intl';
|
|
|
3
3
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
4
|
import uuid from 'uuid/v4';
|
|
5
5
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
6
|
-
|
|
7
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
8
|
-
|
|
9
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
7
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
8
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
@@ -29,6 +29,7 @@ import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
|
29
29
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
30
30
|
import ShrinkHorizontalIcon from '@atlaskit/icon/core/shrink-horizontal';
|
|
31
31
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
32
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
32
33
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
33
34
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
34
35
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -354,7 +355,32 @@ const getTableWrapperFromParentImpl = parent => {
|
|
|
354
355
|
}
|
|
355
356
|
return closestElement(tableRef, `.${TableCssClassName.TABLE_NODE_WRAPPER}`) || undefined;
|
|
356
357
|
};
|
|
358
|
+
let cachedTableWrapperParent;
|
|
359
|
+
let cachedTableWrapperEditorRoot;
|
|
360
|
+
let cachedTableWrapper;
|
|
361
|
+
const getCachedTableWrapperFromParent = (parent, editorView) => {
|
|
362
|
+
var _cachedTableWrapper;
|
|
363
|
+
const editorRoot = editorView.dom;
|
|
364
|
+
if (parent && parent === cachedTableWrapperParent && editorRoot === cachedTableWrapperEditorRoot && (_cachedTableWrapper = cachedTableWrapper) !== null && _cachedTableWrapper !== void 0 && _cachedTableWrapper.isConnected && editorRoot.isConnected && editorRoot.contains(parent) && editorRoot.contains(cachedTableWrapper) && parent.contains(cachedTableWrapper) && cachedTableWrapper.querySelector('table')) {
|
|
365
|
+
return cachedTableWrapper;
|
|
366
|
+
}
|
|
367
|
+
cachedTableWrapperParent = parent;
|
|
368
|
+
cachedTableWrapperEditorRoot = editorRoot;
|
|
369
|
+
cachedTableWrapper = undefined;
|
|
370
|
+
if (!parent || !parent.isConnected || !editorRoot.isConnected || !editorRoot.contains(parent)) {
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
373
|
+
if (!(parent instanceof HTMLElement)) {
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
const tableWrapper = getTableWrapperFromParentImpl(parent);
|
|
377
|
+
if (tableWrapper !== null && tableWrapper !== void 0 && tableWrapper.isConnected && editorRoot.contains(tableWrapper) && parent.contains(tableWrapper)) {
|
|
378
|
+
cachedTableWrapper = tableWrapper;
|
|
379
|
+
}
|
|
380
|
+
return cachedTableWrapper;
|
|
381
|
+
};
|
|
357
382
|
|
|
383
|
+
// Remove this function when cleaning up `platform_editor_table_toolbar_position_fix`
|
|
358
384
|
// Create memoized version ONCE - reused across all calls
|
|
359
385
|
const getMemoizedTableWrapperFromParent = memoizeOne(getTableWrapperFromParentImpl);
|
|
360
386
|
export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAPI, getEditorView, options, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => config => (state, intl) => {
|
|
@@ -400,7 +426,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
400
426
|
const getDomRef = editorView => {
|
|
401
427
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
402
428
|
const parent = findParentDomRefOfType(nodeType, domAtPos)(state.selection);
|
|
403
|
-
return getMemoizedTableWrapperFromParent(parent);
|
|
429
|
+
return isExperimentEnabled('platform_editor_table_toolbar_position_fix') ? getCachedTableWrapperFromParent(parent, editorView) : getMemoizedTableWrapperFromParent(parent);
|
|
404
430
|
};
|
|
405
431
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
406
432
|
const alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
2
|
-
|
|
3
1
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
2
|
import { TableDecorations } from '../../../types';
|
|
5
3
|
import { createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../utils/decoration';
|
|
@@ -4,9 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
// #region Imports
|
|
5
5
|
import { TableSortStep } from '@atlaskit/custom-steps';
|
|
6
6
|
import { isTextInput } from '@atlaskit/editor-common/utils';
|
|
7
|
-
|
|
8
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
9
|
-
|
|
10
7
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
11
8
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
12
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
5
4
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
6
5
|
import { pluginKey } from './plugin-key';
|
|
7
6
|
// eslint-disable-next-line import/order
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
3
|
-
|
|
4
2
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
5
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
6
4
|
var bail = function bail() {
|
|
@@ -4,9 +4,6 @@ import { RawIntlProvider } from 'react-intl';
|
|
|
4
4
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
5
|
import uuid from 'uuid/v4';
|
|
6
6
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
7
|
-
|
|
8
|
-
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
9
|
-
|
|
10
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
11
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
9
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -35,6 +35,7 @@ import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
|
35
35
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
36
36
|
import ShrinkHorizontalIcon from '@atlaskit/icon/core/shrink-horizontal';
|
|
37
37
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
38
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
38
39
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
39
40
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
40
41
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -364,7 +365,32 @@ var getTableWrapperFromParentImpl = function getTableWrapperFromParentImpl(paren
|
|
|
364
365
|
}
|
|
365
366
|
return closestElement(tableRef, ".".concat(TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
|
|
366
367
|
};
|
|
368
|
+
var cachedTableWrapperParent;
|
|
369
|
+
var cachedTableWrapperEditorRoot;
|
|
370
|
+
var cachedTableWrapper;
|
|
371
|
+
var getCachedTableWrapperFromParent = function getCachedTableWrapperFromParent(parent, editorView) {
|
|
372
|
+
var _cachedTableWrapper;
|
|
373
|
+
var editorRoot = editorView.dom;
|
|
374
|
+
if (parent && parent === cachedTableWrapperParent && editorRoot === cachedTableWrapperEditorRoot && (_cachedTableWrapper = cachedTableWrapper) !== null && _cachedTableWrapper !== void 0 && _cachedTableWrapper.isConnected && editorRoot.isConnected && editorRoot.contains(parent) && editorRoot.contains(cachedTableWrapper) && parent.contains(cachedTableWrapper) && cachedTableWrapper.querySelector('table')) {
|
|
375
|
+
return cachedTableWrapper;
|
|
376
|
+
}
|
|
377
|
+
cachedTableWrapperParent = parent;
|
|
378
|
+
cachedTableWrapperEditorRoot = editorRoot;
|
|
379
|
+
cachedTableWrapper = undefined;
|
|
380
|
+
if (!parent || !parent.isConnected || !editorRoot.isConnected || !editorRoot.contains(parent)) {
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
if (!(parent instanceof HTMLElement)) {
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
var tableWrapper = getTableWrapperFromParentImpl(parent);
|
|
387
|
+
if (tableWrapper !== null && tableWrapper !== void 0 && tableWrapper.isConnected && editorRoot.contains(tableWrapper) && parent.contains(tableWrapper)) {
|
|
388
|
+
cachedTableWrapper = tableWrapper;
|
|
389
|
+
}
|
|
390
|
+
return cachedTableWrapper;
|
|
391
|
+
};
|
|
367
392
|
|
|
393
|
+
// Remove this function when cleaning up `platform_editor_table_toolbar_position_fix`
|
|
368
394
|
// Create memoized version ONCE - reused across all calls
|
|
369
395
|
var getMemoizedTableWrapperFromParent = memoizeOne(getTableWrapperFromParentImpl);
|
|
370
396
|
export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, api, editorAnalyticsAPI, getEditorView, options) {
|
|
@@ -415,7 +441,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
415
441
|
var getDomRef = function getDomRef(editorView) {
|
|
416
442
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
417
443
|
var parent = findParentDomRefOfType(nodeType, domAtPos)(state.selection);
|
|
418
|
-
return getMemoizedTableWrapperFromParent(parent);
|
|
444
|
+
return isExperimentEnabled('platform_editor_table_toolbar_position_fix') ? getCachedTableWrapperFromParent(parent, editorView) : getMemoizedTableWrapperFromParent(parent);
|
|
419
445
|
};
|
|
420
446
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
421
447
|
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"singleton": true
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaskit/adf-schema": "^
|
|
23
|
+
"@atlaskit/adf-schema": "^57.0.0",
|
|
24
24
|
"@atlaskit/button": "^25.0.0",
|
|
25
25
|
"@atlaskit/custom-steps": "^1.0.0",
|
|
26
26
|
"@atlaskit/editor-palette": "^3.4.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^15.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-content-insertion": "^15.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-editor-viewmode": "^17.0.0",
|
|
32
|
-
"@atlaskit/editor-plugin-extension": "18.0.
|
|
32
|
+
"@atlaskit/editor-plugin-extension": "18.0.1",
|
|
33
33
|
"@atlaskit/editor-plugin-guideline": "^15.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-interaction": "^26.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-limited-mode": "^12.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
44
44
|
"@atlaskit/editor-toolbar": "^2.4.0",
|
|
45
|
-
"@atlaskit/editor-ui-control-model": "^2.
|
|
45
|
+
"@atlaskit/editor-ui-control-model": "^2.7.0",
|
|
46
46
|
"@atlaskit/icon": "^37.3.0",
|
|
47
47
|
"@atlaskit/icon-lab": "^7.5.0",
|
|
48
48
|
"@atlaskit/insm": "^2.0.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"uuid": "^3.1.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@atlaskit/editor-common": "^119.
|
|
71
|
+
"@atlaskit/editor-common": "^119.4.0",
|
|
72
72
|
"react": "^18.2.0 || ^19.2.0",
|
|
73
73
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
74
74
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|