@atlaskit/editor-plugin-block-controls 23.0.3 → 23.0.4
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 +13 -0
- package/dist/cjs/blockControlsPlugin.js +1 -2
- package/dist/cjs/pm-plugins/handle-mouse-over.js +0 -5
- package/dist/cjs/pm-plugins/handle-sparse-mouse-over.js +0 -4
- package/dist/cjs/ui/block-controls-surface-drag-handle-utils.js +3 -11
- package/dist/cjs/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/cjs/ui/drag-handle.js +7 -11
- package/dist/cjs/ui/should-use-nested-drag-handle-icon.js +2 -6
- package/dist/es2019/blockControlsPlugin.js +1 -2
- package/dist/es2019/pm-plugins/handle-mouse-over.js +0 -5
- package/dist/es2019/pm-plugins/handle-sparse-mouse-over.js +0 -4
- package/dist/es2019/ui/block-controls-surface-drag-handle-utils.js +0 -4
- package/dist/es2019/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/es2019/ui/drag-handle.js +4 -8
- package/dist/es2019/ui/should-use-nested-drag-handle-icon.js +2 -7
- package/dist/esm/blockControlsPlugin.js +1 -2
- package/dist/esm/pm-plugins/handle-mouse-over.js +0 -5
- package/dist/esm/pm-plugins/handle-sparse-mouse-over.js +0 -4
- package/dist/esm/ui/block-controls-surface-drag-handle-utils.js +3 -10
- package/dist/esm/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/esm/ui/drag-handle.js +7 -11
- package/dist/esm/ui/should-use-nested-drag-handle-icon.js +2 -7
- package/dist/types/ui/block-controls-surface-drag-handle-utils.d.ts +0 -1
- package/package.json +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 23.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a4fe8636fa0ec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a4fe8636fa0ec) -
|
|
8
|
+
Clean up the fully rolled out `platform_editor_layout_column_menu` experiment and the
|
|
9
|
+
`platform_editor_layout_column_menu_kill_switch_1` feature gate, retaining their shipped behavior.
|
|
10
|
+
Consumers must remove any direct `@atlaskit/tmp-editor-statsig` experiment override for
|
|
11
|
+
`platform_editor_layout_column_menu`.
|
|
12
|
+
- [`618d89a102880`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/618d89a102880) -
|
|
13
|
+
Clean up experiment `remix_iw_block_menu_table_calc_fix`
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 23.0.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -16,7 +16,6 @@ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
|
16
16
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
17
17
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
18
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
19
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
19
|
var _handleKeyDownWithPreservedSelection = require("./editor-commands/handle-key-down-with-preserved-selection");
|
|
21
20
|
var _mapPreservedSelection2 = require("./editor-commands/map-preserved-selection");
|
|
22
21
|
var _moveNode = require("./editor-commands/move-node");
|
|
@@ -87,7 +86,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
87
86
|
// so that adjacent cells are not fused (e.g. 'hello world' + 'foo' must not
|
|
88
87
|
// become 'hello worldfoo'). Intl.Segmenter word-counting requires correct
|
|
89
88
|
// word boundaries, which raw textContent fusion breaks.
|
|
90
|
-
if (preservedSelection instanceof _cellSelection.CellSelection
|
|
89
|
+
if (preservedSelection instanceof _cellSelection.CellSelection) {
|
|
91
90
|
// Use node(1) to reliably target the table node regardless of $anchorCell depth.
|
|
92
91
|
// node(-1) would return tableRow if $anchorCell is at tableCell depth.
|
|
93
92
|
var tableNode = preservedSelection.$anchorCell.node(1);
|
|
@@ -250,11 +250,6 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
250
250
|
} else {
|
|
251
251
|
pos = view.posAtDOM(rootElement, 0);
|
|
252
252
|
}
|
|
253
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && !(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
254
|
-
// Don't show drag handle for layout column in a single column layout,
|
|
255
|
-
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
256
|
-
return false;
|
|
257
|
-
}
|
|
258
253
|
var targetPos = view.state.doc.resolve(pos).pos;
|
|
259
254
|
var rootAnchorName;
|
|
260
255
|
var rootNodeType;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.handleSparseMouseOver = void 0;
|
|
7
7
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
8
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
10
9
|
var _decorationsCommon = require("./decorations-common");
|
|
11
10
|
var OPAQUE_BLOCKS = new Set(['table', 'bulletList', 'orderedList', 'taskList', 'decisionList', 'mediaSingle']);
|
|
@@ -109,9 +108,6 @@ var handleSparseMouseOver = exports.handleSparseMouseOver = function handleSpars
|
|
|
109
108
|
if (isPanelNodeTypeName(parentNode.type.name) && !(parentDOM instanceof HTMLElement && parentDOM.classList.contains('ak-editor-panel__no-icon')) && $target.index() === 0) {
|
|
110
109
|
return false;
|
|
111
110
|
}
|
|
112
|
-
if (node.type.name === 'layoutColumn' && parentNode.type.name === 'layoutSection' && parentNode.childCount === 1 && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('advanced_layouts', 'isEnabled', true) && !(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
111
|
var anchors = controls === null || controls === void 0 ? void 0 : controls.surfaceAnchors;
|
|
116
112
|
var anchorName = (_anchors$get = anchors === null || anchors === void 0 ? void 0 : anchors.get(targetPosition)) !== null && _anchors$get !== void 0 ? _anchors$get : api.core.actions.getAnchorIdForNode(node, targetPosition);
|
|
117
113
|
var rootPos = $target.depth > 0 ? $target.before(1) : targetPosition;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.getNodeSpacingForDragPreview = exports.getNodeMarginsForDragPreview = exports.buildLayoutColumnMenuMeta = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
10
7
|
var _consts = require("./consts");
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
8
|
var buildLayoutColumnMenuMeta = exports.buildLayoutColumnMenuMeta = function buildLayoutColumnMenuMeta(anchorPos, openedViaKeyboard) {
|
|
14
|
-
return
|
|
15
|
-
anchorPos: anchorPos
|
|
16
|
-
}, (0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
17
|
-
isOpen: true
|
|
18
|
-
} : {}), {}, {
|
|
9
|
+
return {
|
|
10
|
+
anchorPos: anchorPos,
|
|
19
11
|
openedViaKeyboard: openedViaKeyboard
|
|
20
|
-
}
|
|
12
|
+
};
|
|
21
13
|
};
|
|
22
14
|
var getNodeSpacingForDragPreview = exports.getNodeSpacingForDragPreview = function getNodeSpacingForDragPreview(node) {
|
|
23
15
|
var _spacingBetweenNodesF2;
|
|
@@ -23,7 +23,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
23
23
|
var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/core/drag-handle-vertical"));
|
|
24
24
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
25
25
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
26
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
27
26
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
28
27
|
var _pluginKey = require("../pm-plugins/selection-preservation/plugin-key");
|
|
29
28
|
var _collapsedHeading = require("../pm-plugins/utils/collapsed-heading");
|
|
@@ -189,7 +188,7 @@ var BlockControlsSurfaceDragHandle = exports.BlockControlsSurfaceDragHandle = fu
|
|
|
189
188
|
if (startPos === undefined) {
|
|
190
189
|
return tr;
|
|
191
190
|
}
|
|
192
|
-
if (nodeType === 'layoutColumn'
|
|
191
|
+
if (nodeType === 'layoutColumn') {
|
|
193
192
|
tr.setMeta('toggleLayoutColumnMenu', (0, _blockControlsSurfaceDragHandleUtils.buildLayoutColumnMenuMeta)(startPos, openedViaKeyboard));
|
|
194
193
|
}
|
|
195
194
|
var selection = (_selectionPreservatio = (_selectionPreservatio2 = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio2 === void 0 ? void 0 : _selectionPreservatio2.preservedSelection) !== null && _selectionPreservatio !== void 0 ? _selectionPreservatio : tr.selection;
|
|
@@ -333,16 +333,12 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
333
333
|
return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
|
|
334
334
|
};
|
|
335
335
|
|
|
336
|
-
//
|
|
337
|
-
// `isOpen: true` for legacy always-open. Centralised so all dispatch sites stay in sync.
|
|
336
|
+
// Omit `isOpen` so the reducer toggles the menu for a re-clicked layout column.
|
|
338
337
|
var buildToggleLayoutColumnMenuMeta = function buildToggleLayoutColumnMenuMeta(anchorPos, openedViaKeyboard) {
|
|
339
|
-
return
|
|
340
|
-
anchorPos: anchorPos
|
|
341
|
-
}, (0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
342
|
-
isOpen: true
|
|
343
|
-
} : {}), {}, {
|
|
338
|
+
return {
|
|
339
|
+
anchorPos: anchorPos,
|
|
344
340
|
openedViaKeyboard: openedViaKeyboard
|
|
345
|
-
}
|
|
341
|
+
};
|
|
346
342
|
};
|
|
347
343
|
var getDragHandleAnchorReference = function getDragHandleAnchorReference(_ref) {
|
|
348
344
|
var edge = _ref.edge,
|
|
@@ -466,7 +462,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
466
462
|
if (startPos === undefined) {
|
|
467
463
|
return tr;
|
|
468
464
|
}
|
|
469
|
-
if (nodeType === 'layoutColumn'
|
|
465
|
+
if (nodeType === 'layoutColumn') {
|
|
470
466
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
471
467
|
}
|
|
472
468
|
var resolvedStartPos = tr.doc.resolve(startPos);
|
|
@@ -536,7 +532,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
536
532
|
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.startPreservingSelection()({
|
|
537
533
|
tr: tr
|
|
538
534
|
});
|
|
539
|
-
if (nodeType === 'layoutColumn'
|
|
535
|
+
if (nodeType === 'layoutColumn') {
|
|
540
536
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
541
537
|
}
|
|
542
538
|
var triggerByNode = {
|
|
@@ -1127,7 +1123,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1127
1123
|
}
|
|
1128
1124
|
}, renderButton());
|
|
1129
1125
|
};
|
|
1130
|
-
var tooltipContent = isLayoutColumn &&
|
|
1126
|
+
var tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
|
|
1131
1127
|
helpDescriptors: helpDescriptors
|
|
1132
1128
|
});
|
|
1133
1129
|
return (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? stickyWithTooltip() : buttonWithTooltip();
|
|
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.shouldUseNestedDragHandleIcon = void 0;
|
|
7
|
-
|
|
8
|
-
// Nested icon for non-top-level nodes. Exception: with the
|
|
9
|
-
// kill switch OFF, layout columns use the full block handle instead.
|
|
10
|
-
// TODO: EDITOR-7732 - remove this whole function when
|
|
11
|
-
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
7
|
+
// Nested layout columns use the full block handle; other non-top-level nodes use the nested icon.
|
|
12
8
|
var shouldUseNestedDragHandleIcon = exports.shouldUseNestedDragHandleIcon = function shouldUseNestedDragHandleIcon(isTopLevelNode, isLayoutColumn) {
|
|
13
9
|
if (isTopLevelNode) {
|
|
14
10
|
return false;
|
|
15
11
|
}
|
|
16
|
-
if (isLayoutColumn
|
|
12
|
+
if (isLayoutColumn) {
|
|
17
13
|
return false;
|
|
18
14
|
}
|
|
19
15
|
return true;
|
|
@@ -7,7 +7,6 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
12
11
|
import { mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
13
12
|
import { moveNode } from './editor-commands/move-node';
|
|
@@ -85,7 +84,7 @@ export const blockControlsPlugin = ({
|
|
|
85
84
|
// so that adjacent cells are not fused (e.g. 'hello world' + 'foo' must not
|
|
86
85
|
// become 'hello worldfoo'). Intl.Segmenter word-counting requires correct
|
|
87
86
|
// word boundaries, which raw textContent fusion breaks.
|
|
88
|
-
if (preservedSelection instanceof CellSelection
|
|
87
|
+
if (preservedSelection instanceof CellSelection) {
|
|
89
88
|
// Use node(1) to reliably target the table node regardless of $anchorCell depth.
|
|
90
89
|
// node(-1) would return tableRow if $anchorCell is at tableCell depth.
|
|
91
90
|
const tableNode = preservedSelection.$anchorCell.node(1);
|
|
@@ -242,11 +242,6 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
242
242
|
} else {
|
|
243
243
|
pos = view.posAtDOM(rootElement, 0);
|
|
244
244
|
}
|
|
245
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
246
|
-
// Don't show drag handle for layout column in a single column layout,
|
|
247
|
-
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
245
|
const targetPos = view.state.doc.resolve(pos).pos;
|
|
251
246
|
let rootAnchorName;
|
|
252
247
|
let rootNodeType;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
3
|
import { getNodeTypeWithLevel } from './decorations-common';
|
|
5
4
|
const OPAQUE_BLOCKS = new Set(['table', 'bulletList', 'orderedList', 'taskList', 'decisionList', 'mediaSingle']);
|
|
@@ -100,9 +99,6 @@ export const handleSparseMouseOver = (view, event, api) => {
|
|
|
100
99
|
if (isPanelNodeTypeName(parentNode.type.name) && !(parentDOM instanceof HTMLElement && parentDOM.classList.contains('ak-editor-panel__no-icon')) && $target.index() === 0) {
|
|
101
100
|
return false;
|
|
102
101
|
}
|
|
103
|
-
if (node.type.name === 'layoutColumn' && parentNode.type.name === 'layoutSection' && parentNode.childCount === 1 && expValEqualsNoExposure('advanced_layouts', 'isEnabled', true) && !expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
102
|
const anchors = controls === null || controls === void 0 ? void 0 : controls.surfaceAnchors;
|
|
107
103
|
const anchorName = (_anchors$get = anchors === null || anchors === void 0 ? void 0 : anchors.get(targetPosition)) !== null && _anchors$get !== void 0 ? _anchors$get : api.core.actions.getAnchorIdForNode(node, targetPosition);
|
|
108
104
|
const rootPos = $target.depth > 0 ? $target.before(1) : targetPosition;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
import { nodeMargins, spacingBetweenNodesForPreview } from './consts';
|
|
3
2
|
export const buildLayoutColumnMenuMeta = (anchorPos, openedViaKeyboard) => ({
|
|
4
3
|
anchorPos,
|
|
5
|
-
...(fg('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
6
|
-
isOpen: true
|
|
7
|
-
} : {}),
|
|
8
4
|
openedViaKeyboard
|
|
9
5
|
});
|
|
10
6
|
export const getNodeSpacingForDragPreview = node => {
|
|
@@ -17,7 +17,6 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
|
17
17
|
import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
|
|
18
18
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
20
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
20
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
22
21
|
import { selectionPreservationPluginKey } from '../pm-plugins/selection-preservation/plugin-key';
|
|
23
22
|
import { prepareCollapsedHeadingSelection } from '../pm-plugins/utils/collapsed-heading';
|
|
@@ -179,7 +178,7 @@ export const BlockControlsSurfaceDragHandle = ({
|
|
|
179
178
|
if (startPos === undefined) {
|
|
180
179
|
return tr;
|
|
181
180
|
}
|
|
182
|
-
if (nodeType === 'layoutColumn'
|
|
181
|
+
if (nodeType === 'layoutColumn') {
|
|
183
182
|
tr.setMeta('toggleLayoutColumnMenu', buildLayoutColumnMenuMeta(startPos, openedViaKeyboard));
|
|
184
183
|
}
|
|
185
184
|
const selection = (_selectionPreservatio = (_selectionPreservatio2 = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio2 === void 0 ? void 0 : _selectionPreservatio2.preservedSelection) !== null && _selectionPreservatio !== void 0 ? _selectionPreservatio : tr.selection;
|
|
@@ -327,13 +327,9 @@ const getNodeMargins = node => {
|
|
|
327
327
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
328
328
|
};
|
|
329
329
|
|
|
330
|
-
//
|
|
331
|
-
// `isOpen: true` for legacy always-open. Centralised so all dispatch sites stay in sync.
|
|
330
|
+
// Omit `isOpen` so the reducer toggles the menu for a re-clicked layout column.
|
|
332
331
|
const buildToggleLayoutColumnMenuMeta = (anchorPos, openedViaKeyboard) => ({
|
|
333
332
|
anchorPos,
|
|
334
|
-
...(fg('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
335
|
-
isOpen: true
|
|
336
|
-
} : {}),
|
|
337
333
|
openedViaKeyboard
|
|
338
334
|
});
|
|
339
335
|
const getDragHandleAnchorReference = ({
|
|
@@ -444,7 +440,7 @@ export const DragHandle = ({
|
|
|
444
440
|
if (startPos === undefined) {
|
|
445
441
|
return tr;
|
|
446
442
|
}
|
|
447
|
-
if (nodeType === 'layoutColumn'
|
|
443
|
+
if (nodeType === 'layoutColumn') {
|
|
448
444
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
449
445
|
}
|
|
450
446
|
const resolvedStartPos = tr.doc.resolve(startPos);
|
|
@@ -515,7 +511,7 @@ export const DragHandle = ({
|
|
|
515
511
|
api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.startPreservingSelection()({
|
|
516
512
|
tr
|
|
517
513
|
});
|
|
518
|
-
if (nodeType === 'layoutColumn'
|
|
514
|
+
if (nodeType === 'layoutColumn') {
|
|
519
515
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
520
516
|
}
|
|
521
517
|
const triggerByNode = {
|
|
@@ -1106,7 +1102,7 @@ export const DragHandle = ({
|
|
|
1106
1102
|
});
|
|
1107
1103
|
}
|
|
1108
1104
|
}, renderButton());
|
|
1109
|
-
const tooltipContent = isLayoutColumn &&
|
|
1105
|
+
const tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
|
|
1110
1106
|
helpDescriptors: helpDescriptors
|
|
1111
1107
|
});
|
|
1112
1108
|
return editorExperiment('platform_editor_controls', 'variant1') ? stickyWithTooltip() : buttonWithTooltip();
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Nested icon for non-top-level nodes. Exception: with the
|
|
4
|
-
// kill switch OFF, layout columns use the full block handle instead.
|
|
5
|
-
// TODO: EDITOR-7732 - remove this whole function when
|
|
6
|
-
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
1
|
+
// Nested layout columns use the full block handle; other non-top-level nodes use the nested icon.
|
|
7
2
|
export const shouldUseNestedDragHandleIcon = (isTopLevelNode, isLayoutColumn) => {
|
|
8
3
|
if (isTopLevelNode) {
|
|
9
4
|
return false;
|
|
10
5
|
}
|
|
11
|
-
if (isLayoutColumn
|
|
6
|
+
if (isLayoutColumn) {
|
|
12
7
|
return false;
|
|
13
8
|
}
|
|
14
9
|
return true;
|
|
@@ -11,7 +11,6 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
11
11
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
14
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
14
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
16
15
|
import { mapPreservedSelection as _mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
17
16
|
import { moveNode } from './editor-commands/move-node';
|
|
@@ -80,7 +79,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
80
79
|
// so that adjacent cells are not fused (e.g. 'hello world' + 'foo' must not
|
|
81
80
|
// become 'hello worldfoo'). Intl.Segmenter word-counting requires correct
|
|
82
81
|
// word boundaries, which raw textContent fusion breaks.
|
|
83
|
-
if (preservedSelection instanceof CellSelection
|
|
82
|
+
if (preservedSelection instanceof CellSelection) {
|
|
84
83
|
// Use node(1) to reliably target the table node regardless of $anchorCell depth.
|
|
85
84
|
// node(-1) would return tableRow if $anchorCell is at tableCell depth.
|
|
86
85
|
var tableNode = preservedSelection.$anchorCell.node(1);
|
|
@@ -243,11 +243,6 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
243
243
|
} else {
|
|
244
244
|
pos = view.posAtDOM(rootElement, 0);
|
|
245
245
|
}
|
|
246
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
247
|
-
// Don't show drag handle for layout column in a single column layout,
|
|
248
|
-
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
246
|
var targetPos = view.state.doc.resolve(pos).pos;
|
|
252
247
|
var rootAnchorName;
|
|
253
248
|
var rootNodeType;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
3
|
import { getNodeTypeWithLevel } from './decorations-common';
|
|
5
4
|
var OPAQUE_BLOCKS = new Set(['table', 'bulletList', 'orderedList', 'taskList', 'decisionList', 'mediaSingle']);
|
|
@@ -103,9 +102,6 @@ export var handleSparseMouseOver = function handleSparseMouseOver(view, event, a
|
|
|
103
102
|
if (isPanelNodeTypeName(parentNode.type.name) && !(parentDOM instanceof HTMLElement && parentDOM.classList.contains('ak-editor-panel__no-icon')) && $target.index() === 0) {
|
|
104
103
|
return false;
|
|
105
104
|
}
|
|
106
|
-
if (node.type.name === 'layoutColumn' && parentNode.type.name === 'layoutSection' && parentNode.childCount === 1 && expValEqualsNoExposure('advanced_layouts', 'isEnabled', true) && !expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
105
|
var anchors = controls === null || controls === void 0 ? void 0 : controls.surfaceAnchors;
|
|
110
106
|
var anchorName = (_anchors$get = anchors === null || anchors === void 0 ? void 0 : anchors.get(targetPosition)) !== null && _anchors$get !== void 0 ? _anchors$get : api.core.actions.getAnchorIdForNode(node, targetPosition);
|
|
111
107
|
var rootPos = $target.depth > 0 ? $target.before(1) : targetPosition;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
-
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
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
1
|
import { nodeMargins, spacingBetweenNodesForPreview } from './consts';
|
|
6
2
|
export var buildLayoutColumnMenuMeta = function buildLayoutColumnMenuMeta(anchorPos, openedViaKeyboard) {
|
|
7
|
-
return
|
|
8
|
-
anchorPos: anchorPos
|
|
9
|
-
}, fg('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
10
|
-
isOpen: true
|
|
11
|
-
} : {}), {}, {
|
|
3
|
+
return {
|
|
4
|
+
anchorPos: anchorPos,
|
|
12
5
|
openedViaKeyboard: openedViaKeyboard
|
|
13
|
-
}
|
|
6
|
+
};
|
|
14
7
|
};
|
|
15
8
|
export var getNodeSpacingForDragPreview = function getNodeSpacingForDragPreview(node) {
|
|
16
9
|
var _spacingBetweenNodesF2;
|
|
@@ -18,7 +18,6 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
|
18
18
|
import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
|
|
19
19
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
20
20
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
21
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
21
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
23
22
|
import { selectionPreservationPluginKey } from '../pm-plugins/selection-preservation/plugin-key';
|
|
24
23
|
import { prepareCollapsedHeadingSelection } from '../pm-plugins/utils/collapsed-heading';
|
|
@@ -183,7 +182,7 @@ export var BlockControlsSurfaceDragHandle = function BlockControlsSurfaceDragHan
|
|
|
183
182
|
if (startPos === undefined) {
|
|
184
183
|
return tr;
|
|
185
184
|
}
|
|
186
|
-
if (nodeType === 'layoutColumn'
|
|
185
|
+
if (nodeType === 'layoutColumn') {
|
|
187
186
|
tr.setMeta('toggleLayoutColumnMenu', buildLayoutColumnMenuMeta(startPos, openedViaKeyboard));
|
|
188
187
|
}
|
|
189
188
|
var selection = (_selectionPreservatio = (_selectionPreservatio2 = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio2 === void 0 ? void 0 : _selectionPreservatio2.preservedSelection) !== null && _selectionPreservatio !== void 0 ? _selectionPreservatio : tr.selection;
|
|
@@ -329,16 +329,12 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
329
329
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
330
330
|
};
|
|
331
331
|
|
|
332
|
-
//
|
|
333
|
-
// `isOpen: true` for legacy always-open. Centralised so all dispatch sites stay in sync.
|
|
332
|
+
// Omit `isOpen` so the reducer toggles the menu for a re-clicked layout column.
|
|
334
333
|
var buildToggleLayoutColumnMenuMeta = function buildToggleLayoutColumnMenuMeta(anchorPos, openedViaKeyboard) {
|
|
335
|
-
return
|
|
336
|
-
anchorPos: anchorPos
|
|
337
|
-
}, fg('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
338
|
-
isOpen: true
|
|
339
|
-
} : {}), {}, {
|
|
334
|
+
return {
|
|
335
|
+
anchorPos: anchorPos,
|
|
340
336
|
openedViaKeyboard: openedViaKeyboard
|
|
341
|
-
}
|
|
337
|
+
};
|
|
342
338
|
};
|
|
343
339
|
var getDragHandleAnchorReference = function getDragHandleAnchorReference(_ref) {
|
|
344
340
|
var edge = _ref.edge,
|
|
@@ -462,7 +458,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
462
458
|
if (startPos === undefined) {
|
|
463
459
|
return tr;
|
|
464
460
|
}
|
|
465
|
-
if (nodeType === 'layoutColumn'
|
|
461
|
+
if (nodeType === 'layoutColumn') {
|
|
466
462
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
467
463
|
}
|
|
468
464
|
var resolvedStartPos = tr.doc.resolve(startPos);
|
|
@@ -532,7 +528,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
532
528
|
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.startPreservingSelection()({
|
|
533
529
|
tr: tr
|
|
534
530
|
});
|
|
535
|
-
if (nodeType === 'layoutColumn'
|
|
531
|
+
if (nodeType === 'layoutColumn') {
|
|
536
532
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
537
533
|
}
|
|
538
534
|
var triggerByNode = {
|
|
@@ -1123,7 +1119,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
1123
1119
|
}
|
|
1124
1120
|
}, renderButton());
|
|
1125
1121
|
};
|
|
1126
|
-
var tooltipContent = isLayoutColumn &&
|
|
1122
|
+
var tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
|
|
1127
1123
|
helpDescriptors: helpDescriptors
|
|
1128
1124
|
});
|
|
1129
1125
|
return editorExperiment('platform_editor_controls', 'variant1') ? stickyWithTooltip() : buttonWithTooltip();
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Nested icon for non-top-level nodes. Exception: with the
|
|
4
|
-
// kill switch OFF, layout columns use the full block handle instead.
|
|
5
|
-
// TODO: EDITOR-7732 - remove this whole function when
|
|
6
|
-
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
1
|
+
// Nested layout columns use the full block handle; other non-top-level nodes use the nested icon.
|
|
7
2
|
export var shouldUseNestedDragHandleIcon = function shouldUseNestedDragHandleIcon(isTopLevelNode, isLayoutColumn) {
|
|
8
3
|
if (isTopLevelNode) {
|
|
9
4
|
return false;
|
|
10
5
|
}
|
|
11
|
-
if (isLayoutColumn
|
|
6
|
+
if (isLayoutColumn) {
|
|
12
7
|
return false;
|
|
13
8
|
}
|
|
14
9
|
return true;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
export declare const buildLayoutColumnMenuMeta: (anchorPos: number, openedViaKeyboard: boolean) => {
|
|
3
3
|
anchorPos: number;
|
|
4
|
-
isOpen?: true;
|
|
5
4
|
openedViaKeyboard: boolean;
|
|
6
5
|
};
|
|
7
6
|
export declare const getNodeSpacingForDragPreview: (node?: PMNode | null) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.4",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
52
52
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
53
53
|
"@atlaskit/icon": "^38.0.0",
|
|
54
|
-
"@atlaskit/icon-lab": "^7.
|
|
54
|
+
"@atlaskit/icon-lab": "^7.11.0",
|
|
55
55
|
"@atlaskit/link": "^5.1.0",
|
|
56
56
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
57
57
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@atlaskit/primitives": "^22.5.0",
|
|
62
62
|
"@atlaskit/section-message": "^10.2.0",
|
|
63
63
|
"@atlaskit/theme": "^28.2.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^213.0.0",
|
|
65
65
|
"@atlaskit/tokens": "^20.1.0",
|
|
66
66
|
"@atlaskit/tooltip": "^24.3.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^11.1.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^126.
|
|
76
|
+
"@atlaskit/editor-common": "^126.2.0",
|
|
77
77
|
"react": "^18.2.0 || ^19.2.0",
|
|
78
78
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
79
79
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -100,10 +100,6 @@
|
|
|
100
100
|
"platform_editor_controls_reliable_anchor_patch_1": {
|
|
101
101
|
"type": "boolean"
|
|
102
102
|
},
|
|
103
|
-
"platform_editor_layout_column_menu_kill_switch_1": {
|
|
104
|
-
"type": "boolean",
|
|
105
|
-
"referenceOnly": true
|
|
106
|
-
},
|
|
107
103
|
"platform-dst-top-layer-tooltip": {
|
|
108
104
|
"type": "boolean",
|
|
109
105
|
"referenceOnly": true
|