@atlaskit/editor-plugin-block-controls 13.0.7 → 13.1.1
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 +29 -0
- package/dist/cjs/pm-plugins/main.js +1 -4
- package/dist/cjs/ui/drag-handle.js +18 -17
- package/dist/cjs/ui/should-use-nested-drag-handle-icon.js +24 -0
- package/dist/es2019/pm-plugins/main.js +1 -4
- package/dist/es2019/ui/drag-handle.js +16 -17
- package/dist/es2019/ui/should-use-nested-drag-handle-icon.js +19 -0
- package/dist/esm/pm-plugins/main.js +1 -4
- package/dist/esm/ui/drag-handle.js +18 -17
- package/dist/esm/ui/should-use-nested-drag-handle-icon.js +19 -0
- package/dist/types/ui/should-use-nested-drag-handle-icon.d.ts +1 -0
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 13.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b2f53114889ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2f53114889ac) -
|
|
8
|
+
Clean up feature gate `platform_editor_block_menu_jira_patch_1`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 13.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`bb48c26acb8ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb48c26acb8ba) -
|
|
16
|
+
Add platform_editor_layout_column_menu_kill_switch_1 kill switch and render the full block drag
|
|
17
|
+
handle icon for layout columns when the new behaviour is enabled (gate OFF). When the new
|
|
18
|
+
behaviour is enabled, re-clicking the layout column whose menu is already open now closes the
|
|
19
|
+
menu, while clicking a different column switches the menu to that column. The layout column menu
|
|
20
|
+
now opens below the drag handle with left-aligned edges (relying on the popup's built-in placement
|
|
21
|
+
to invert horizontally or nudge up when space is tight) instead of the previous centred
|
|
22
|
+
prefer-above behaviour. The layout column Delete hover/focus danger preview now matches the table
|
|
23
|
+
delete affordance exactly, using the translucent color.blanket.danger fill and a 1px
|
|
24
|
+
color.border.danger border instead of the previous low-alpha fill with a 2px border, and clears
|
|
25
|
+
the concurrent blue selected blanket while the danger preview is active so the preview reads as
|
|
26
|
+
pure red with no blue cast.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
3
32
|
## 13.0.7
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -391,10 +391,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
391
391
|
} else {
|
|
392
392
|
if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
|
|
393
393
|
var _nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
|
|
394
|
-
|
|
395
|
-
// which would cause a RangeError in ProseMirror. When the gate is off, the original
|
|
396
|
-
// behaviour is preserved for safe incremental rollout.
|
|
397
|
-
var rootNodeDecAtActivePos = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_jira_patch_1') ? latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined : getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to);
|
|
394
|
+
var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
|
|
398
395
|
if (_nodeDecAtActivePos || rootNodeDecAtActivePos) {
|
|
399
396
|
isActiveNodeModified = true;
|
|
400
397
|
}
|
|
@@ -41,6 +41,7 @@ var _selection = require("../pm-plugins/utils/selection");
|
|
|
41
41
|
var _consts2 = require("./consts");
|
|
42
42
|
var _dragHandleNestedIcon = require("./drag-handle-nested-icon");
|
|
43
43
|
var _dragPreview = require("./drag-preview");
|
|
44
|
+
var _shouldUseNestedDragHandleIcon = require("./should-use-nested-drag-handle-icon");
|
|
44
45
|
var _anchorName = require("./utils/anchor-name");
|
|
45
46
|
var _domAttrName = require("./utils/dom-attr-name");
|
|
46
47
|
var _visibilityContainer = require("./visibility-container");
|
|
@@ -370,6 +371,18 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
370
371
|
}
|
|
371
372
|
return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
|
|
372
373
|
};
|
|
374
|
+
|
|
375
|
+
// Kill switch OFF: omit `isOpen` so the reducer toggles per clicked column. ON: keep
|
|
376
|
+
// `isOpen: true` for legacy always-open. Centralised so all dispatch sites stay in sync.
|
|
377
|
+
var buildToggleLayoutColumnMenuMeta = function buildToggleLayoutColumnMenuMeta(anchorPos, openedViaKeyboard) {
|
|
378
|
+
return _objectSpread(_objectSpread({
|
|
379
|
+
anchorPos: anchorPos
|
|
380
|
+
}, (0, _platformFeatureFlags.fg)('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
381
|
+
isOpen: true
|
|
382
|
+
} : {}), {}, {
|
|
383
|
+
openedViaKeyboard: openedViaKeyboard
|
|
384
|
+
});
|
|
385
|
+
};
|
|
373
386
|
var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
374
387
|
var _api$core4, _api$blockControls8;
|
|
375
388
|
var view = _ref.view,
|
|
@@ -498,11 +511,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
498
511
|
return tr;
|
|
499
512
|
}
|
|
500
513
|
if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
501
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
502
|
-
anchorPos: startPos,
|
|
503
|
-
isOpen: true,
|
|
504
|
-
openedViaKeyboard: false
|
|
505
|
-
});
|
|
514
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
506
515
|
}
|
|
507
516
|
var resolvedStartPos = tr.doc.resolve(startPos);
|
|
508
517
|
var selection = ((_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
|
|
@@ -553,11 +562,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
553
562
|
return tr;
|
|
554
563
|
}
|
|
555
564
|
if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
556
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
557
|
-
anchorPos: startPos,
|
|
558
|
-
isOpen: true,
|
|
559
|
-
openedViaKeyboard: false
|
|
560
|
-
});
|
|
565
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
561
566
|
}
|
|
562
567
|
var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
|
|
563
568
|
var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
|
|
@@ -645,11 +650,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
645
650
|
tr: tr
|
|
646
651
|
});
|
|
647
652
|
if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
648
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
649
|
-
anchorPos: startPos,
|
|
650
|
-
isOpen: true,
|
|
651
|
-
openedViaKeyboard: true
|
|
652
|
-
});
|
|
653
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
653
654
|
}
|
|
654
655
|
var rootPos = (0, _experiments.editorExperiment)('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
655
656
|
var triggerByNode = (0, _experiments.editorExperiment)('platform_synced_block', true) ? {
|
|
@@ -1044,7 +1045,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1044
1045
|
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1045
1046
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1046
1047
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1047
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _experiments.editorExperiment)('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, ((0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) || (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') || (0, _experiments.editorExperiment)('platform_editor_block_menu', true)
|
|
1048
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _experiments.editorExperiment)('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, ((0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) || (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') || (0, _experiments.editorExperiment)('platform_editor_block_menu', true)) && dragHandleButtonScaledStyles],
|
|
1048
1049
|
ref: buttonRef
|
|
1049
1050
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1050
1051
|
,
|
|
@@ -1091,7 +1092,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1091
1092
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1092
1093
|
,
|
|
1093
1094
|
onDragStart: handleIconDragStart
|
|
1094
|
-
}, (0,
|
|
1095
|
+
}, (0, _shouldUseNestedDragHandleIcon.shouldUseNestedDragHandleIcon)(isTopLevelNodeValue, isLayoutColumn) ? (0, _react2.jsx)(_dragHandleNestedIcon.DragHandleNestedIcon, null) : (0, _react2.jsx)(_dragHandleVertical.default, {
|
|
1095
1096
|
spacing: "spacious",
|
|
1096
1097
|
label: "",
|
|
1097
1098
|
size: "small"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shouldUseNestedDragHandleIcon = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
|
+
// Nested icon for non-top-level nodes when the experiment is on. Exception: with the
|
|
10
|
+
// kill switch OFF, layout columns use the full block handle instead.
|
|
11
|
+
// TODO: EDITOR-7732 - remove this whole function when
|
|
12
|
+
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
13
|
+
var shouldUseNestedDragHandleIcon = exports.shouldUseNestedDragHandleIcon = function shouldUseNestedDragHandleIcon(isTopLevelNode, isLayoutColumn) {
|
|
14
|
+
if (!(0, _expValEquals.expValEquals)('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (isTopLevelNode) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (isLayoutColumn && !(0, _platformFeatureFlags.fg)('platform_editor_layout_column_menu_kill_switch_1')) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
@@ -381,10 +381,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
381
381
|
} else {
|
|
382
382
|
if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
|
|
383
383
|
const nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
|
|
384
|
-
|
|
385
|
-
// which would cause a RangeError in ProseMirror. When the gate is off, the original
|
|
386
|
-
// behaviour is preserved for safe incremental rollout.
|
|
387
|
-
const rootNodeDecAtActivePos = fg('platform_editor_block_menu_jira_patch_1') ? latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined : getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to);
|
|
384
|
+
const rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
|
|
388
385
|
if (nodeDecAtActivePos || rootNodeDecAtActivePos) {
|
|
389
386
|
isActiveNodeModified = true;
|
|
390
387
|
}
|
|
@@ -38,6 +38,7 @@ import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from
|
|
|
38
38
|
import { ACTIVE_DRAG_HANDLE_ATTR, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
39
39
|
import { DragHandleNestedIcon } from './drag-handle-nested-icon';
|
|
40
40
|
import { dragPreview } from './drag-preview';
|
|
41
|
+
import { shouldUseNestedDragHandleIcon } from './should-use-nested-drag-handle-icon';
|
|
41
42
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
42
43
|
import { getAnchorAttrName } from './utils/dom-attr-name';
|
|
43
44
|
import { VisibilityContainer } from './visibility-container';
|
|
@@ -364,6 +365,16 @@ const getNodeMargins = node => {
|
|
|
364
365
|
}
|
|
365
366
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
366
367
|
};
|
|
368
|
+
|
|
369
|
+
// Kill switch OFF: omit `isOpen` so the reducer toggles per clicked column. ON: keep
|
|
370
|
+
// `isOpen: true` for legacy always-open. Centralised so all dispatch sites stay in sync.
|
|
371
|
+
const buildToggleLayoutColumnMenuMeta = (anchorPos, openedViaKeyboard) => ({
|
|
372
|
+
anchorPos,
|
|
373
|
+
...(fg('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
374
|
+
isOpen: true
|
|
375
|
+
} : {}),
|
|
376
|
+
openedViaKeyboard
|
|
377
|
+
});
|
|
367
378
|
export const DragHandle = ({
|
|
368
379
|
view,
|
|
369
380
|
api,
|
|
@@ -473,11 +484,7 @@ export const DragHandle = ({
|
|
|
473
484
|
return tr;
|
|
474
485
|
}
|
|
475
486
|
if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
476
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
477
|
-
anchorPos: startPos,
|
|
478
|
-
isOpen: true,
|
|
479
|
-
openedViaKeyboard: false
|
|
480
|
-
});
|
|
487
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
481
488
|
}
|
|
482
489
|
const resolvedStartPos = tr.doc.resolve(startPos);
|
|
483
490
|
const selection = ((_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
|
|
@@ -529,11 +536,7 @@ export const DragHandle = ({
|
|
|
529
536
|
return tr;
|
|
530
537
|
}
|
|
531
538
|
if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
532
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
533
|
-
anchorPos: startPos,
|
|
534
|
-
isOpen: true,
|
|
535
|
-
openedViaKeyboard: false
|
|
536
|
-
});
|
|
539
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
537
540
|
}
|
|
538
541
|
const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
|
|
539
542
|
const $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
|
|
@@ -621,11 +624,7 @@ export const DragHandle = ({
|
|
|
621
624
|
tr
|
|
622
625
|
});
|
|
623
626
|
if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
624
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
625
|
-
anchorPos: startPos,
|
|
626
|
-
isOpen: true,
|
|
627
|
-
openedViaKeyboard: true
|
|
628
|
-
});
|
|
627
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
629
628
|
}
|
|
630
629
|
const rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
631
630
|
const triggerByNode = editorExperiment('platform_synced_block', true) ? {
|
|
@@ -1025,7 +1024,7 @@ export const DragHandle = ({
|
|
|
1025
1024
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1026
1025
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1027
1026
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1028
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, editorExperiment('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, editorExperiment('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') || editorExperiment('platform_editor_block_menu', true)
|
|
1027
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, editorExperiment('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, editorExperiment('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') || editorExperiment('platform_editor_block_menu', true)) && dragHandleButtonScaledStyles],
|
|
1029
1028
|
ref: buttonRef
|
|
1030
1029
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1031
1030
|
,
|
|
@@ -1073,7 +1072,7 @@ export const DragHandle = ({
|
|
|
1073
1072
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1074
1073
|
,
|
|
1075
1074
|
onDragStart: handleIconDragStart
|
|
1076
|
-
},
|
|
1075
|
+
}, shouldUseNestedDragHandleIcon(isTopLevelNodeValue, isLayoutColumn) ? jsx(DragHandleNestedIcon, null) : jsx(DragHandleVerticalIcon, {
|
|
1077
1076
|
spacing: "spacious",
|
|
1078
1077
|
label: "",
|
|
1079
1078
|
size: "small"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
|
|
4
|
+
// Nested icon for non-top-level nodes when the experiment is on. Exception: with the
|
|
5
|
+
// kill switch OFF, layout columns use the full block handle instead.
|
|
6
|
+
// TODO: EDITOR-7732 - remove this whole function when
|
|
7
|
+
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
8
|
+
export const shouldUseNestedDragHandleIcon = (isTopLevelNode, isLayoutColumn) => {
|
|
9
|
+
if (!expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (isTopLevelNode) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (isLayoutColumn && !fg('platform_editor_layout_column_menu_kill_switch_1')) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
@@ -384,10 +384,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
384
384
|
} else {
|
|
385
385
|
if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
|
|
386
386
|
var _nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
|
|
387
|
-
|
|
388
|
-
// which would cause a RangeError in ProseMirror. When the gate is off, the original
|
|
389
|
-
// behaviour is preserved for safe incremental rollout.
|
|
390
|
-
var rootNodeDecAtActivePos = fg('platform_editor_block_menu_jira_patch_1') ? latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined : getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to);
|
|
387
|
+
var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
|
|
391
388
|
if (_nodeDecAtActivePos || rootNodeDecAtActivePos) {
|
|
392
389
|
isActiveNodeModified = true;
|
|
393
390
|
}
|
|
@@ -43,6 +43,7 @@ import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from
|
|
|
43
43
|
import { ACTIVE_DRAG_HANDLE_ATTR, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
44
44
|
import { DragHandleNestedIcon } from './drag-handle-nested-icon';
|
|
45
45
|
import { dragPreview } from './drag-preview';
|
|
46
|
+
import { shouldUseNestedDragHandleIcon } from './should-use-nested-drag-handle-icon';
|
|
46
47
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
47
48
|
import { getAnchorAttrName } from './utils/dom-attr-name';
|
|
48
49
|
import { VisibilityContainer } from './visibility-container';
|
|
@@ -366,6 +367,18 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
366
367
|
}
|
|
367
368
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
368
369
|
};
|
|
370
|
+
|
|
371
|
+
// Kill switch OFF: omit `isOpen` so the reducer toggles per clicked column. ON: keep
|
|
372
|
+
// `isOpen: true` for legacy always-open. Centralised so all dispatch sites stay in sync.
|
|
373
|
+
var buildToggleLayoutColumnMenuMeta = function buildToggleLayoutColumnMenuMeta(anchorPos, openedViaKeyboard) {
|
|
374
|
+
return _objectSpread(_objectSpread({
|
|
375
|
+
anchorPos: anchorPos
|
|
376
|
+
}, fg('platform_editor_layout_column_menu_kill_switch_1') ? {
|
|
377
|
+
isOpen: true
|
|
378
|
+
} : {}), {}, {
|
|
379
|
+
openedViaKeyboard: openedViaKeyboard
|
|
380
|
+
});
|
|
381
|
+
};
|
|
369
382
|
export var DragHandle = function DragHandle(_ref) {
|
|
370
383
|
var _api$core4, _api$blockControls8;
|
|
371
384
|
var view = _ref.view,
|
|
@@ -494,11 +507,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
494
507
|
return tr;
|
|
495
508
|
}
|
|
496
509
|
if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
497
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
498
|
-
anchorPos: startPos,
|
|
499
|
-
isOpen: true,
|
|
500
|
-
openedViaKeyboard: false
|
|
501
|
-
});
|
|
510
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
502
511
|
}
|
|
503
512
|
var resolvedStartPos = tr.doc.resolve(startPos);
|
|
504
513
|
var selection = ((_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
|
|
@@ -549,11 +558,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
549
558
|
return tr;
|
|
550
559
|
}
|
|
551
560
|
if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
552
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
553
|
-
anchorPos: startPos,
|
|
554
|
-
isOpen: true,
|
|
555
|
-
openedViaKeyboard: false
|
|
556
|
-
});
|
|
561
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
557
562
|
}
|
|
558
563
|
var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
|
|
559
564
|
var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
|
|
@@ -641,11 +646,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
641
646
|
tr: tr
|
|
642
647
|
});
|
|
643
648
|
if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
644
|
-
tr.setMeta('toggleLayoutColumnMenu',
|
|
645
|
-
anchorPos: startPos,
|
|
646
|
-
isOpen: true,
|
|
647
|
-
openedViaKeyboard: true
|
|
648
|
-
});
|
|
649
|
+
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
649
650
|
}
|
|
650
651
|
var rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
651
652
|
var triggerByNode = editorExperiment('platform_synced_block', true) ? {
|
|
@@ -1040,7 +1041,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1040
1041
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1041
1042
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1042
1043
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1043
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, editorExperiment('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, editorExperiment('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') || editorExperiment('platform_editor_block_menu', true)
|
|
1044
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, editorExperiment('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, editorExperiment('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') || editorExperiment('platform_editor_block_menu', true)) && dragHandleButtonScaledStyles],
|
|
1044
1045
|
ref: buttonRef
|
|
1045
1046
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1046
1047
|
,
|
|
@@ -1087,7 +1088,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1087
1088
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1088
1089
|
,
|
|
1089
1090
|
onDragStart: handleIconDragStart
|
|
1090
|
-
},
|
|
1091
|
+
}, shouldUseNestedDragHandleIcon(isTopLevelNodeValue, isLayoutColumn) ? jsx(DragHandleNestedIcon, null) : jsx(DragHandleVerticalIcon, {
|
|
1091
1092
|
spacing: "spacious",
|
|
1092
1093
|
label: "",
|
|
1093
1094
|
size: "small"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
|
|
4
|
+
// Nested icon for non-top-level nodes when the experiment is on. Exception: with the
|
|
5
|
+
// kill switch OFF, layout columns use the full block handle instead.
|
|
6
|
+
// TODO: EDITOR-7732 - remove this whole function when
|
|
7
|
+
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
8
|
+
export var shouldUseNestedDragHandleIcon = function shouldUseNestedDragHandleIcon(isTopLevelNode, isLayoutColumn) {
|
|
9
|
+
if (!expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (isTopLevelNode) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (isLayoutColumn && !fg('platform_editor_layout_column_menu_kill_switch_1')) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldUseNestedDragHandleIcon: (isTopLevelNode: boolean, isLayoutColumn: boolean) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.0.0",
|
|
49
49
|
"@atlaskit/primitives": "^20.0.0",
|
|
50
50
|
"@atlaskit/theme": "^26.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^112.0.0",
|
|
52
52
|
"@atlaskit/tokens": "^15.0.0",
|
|
53
53
|
"@atlaskit/tooltip": "^23.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"uuid": "^3.1.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@atlaskit/editor-common": "^116.
|
|
62
|
+
"@atlaskit/editor-common": "^116.12.0",
|
|
63
63
|
"react": "^18.2.0",
|
|
64
64
|
"react-dom": "^18.2.0",
|
|
65
65
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -130,9 +130,6 @@
|
|
|
130
130
|
"platform_editor_table_sticky_header_patch_6": {
|
|
131
131
|
"type": "boolean"
|
|
132
132
|
},
|
|
133
|
-
"platform_editor_block_menu_jira_patch_1": {
|
|
134
|
-
"type": "boolean"
|
|
135
|
-
},
|
|
136
133
|
"platform_editor_block_menu_jira_patch_2": {
|
|
137
134
|
"type": "boolean"
|
|
138
135
|
},
|
|
@@ -141,6 +138,10 @@
|
|
|
141
138
|
},
|
|
142
139
|
"confluence_frontend_native_tabs_extension": {
|
|
143
140
|
"type": "boolean"
|
|
141
|
+
},
|
|
142
|
+
"platform_editor_layout_column_menu_kill_switch_1": {
|
|
143
|
+
"type": "boolean",
|
|
144
|
+
"referenceOnly": true
|
|
144
145
|
}
|
|
145
146
|
},
|
|
146
147
|
"devDependencies": {
|