@atlaskit/editor-plugin-table 27.0.2 → 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 +9 -0
- package/dist/cjs/ui/toolbar.js +27 -1
- package/dist/es2019/ui/toolbar.js +27 -1
- package/dist/esm/ui/toolbar.js +27 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
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
|
+
|
|
3
12
|
## 27.0.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
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) : [];
|
|
@@ -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) : [];
|
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/"
|
|
@@ -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",
|