@atlaskit/editor-plugin-block-controls 13.1.2 → 13.1.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 +6 -0
- package/dist/cjs/pm-plugins/handle-mouse-over.js +1 -2
- package/dist/cjs/ui/drag-handle.js +6 -6
- package/dist/es2019/pm-plugins/handle-mouse-over.js +1 -2
- package/dist/es2019/ui/drag-handle.js +6 -6
- package/dist/esm/pm-plugins/handle-mouse-over.js +1 -2
- package/dist/esm/ui/drag-handle.js +6 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,6 @@ var _selection = require("@atlaskit/editor-common/selection");
|
|
|
11
11
|
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
15
14
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
15
|
var _domAttrName = require("../ui/utils/dom-attr-name");
|
|
17
16
|
var _decorationsAnchor = require("./decorations-anchor");
|
|
@@ -231,7 +230,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
231
230
|
} else {
|
|
232
231
|
pos = view.posAtDOM(rootElement, 0);
|
|
233
232
|
}
|
|
234
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true) && !(0,
|
|
233
|
+
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
235
234
|
// Don't show drag handle for layout column in a single column layout,
|
|
236
235
|
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
237
236
|
return false;
|
|
@@ -510,7 +510,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
510
510
|
if (startPos === undefined) {
|
|
511
511
|
return tr;
|
|
512
512
|
}
|
|
513
|
-
if (nodeType === 'layoutColumn' && (0,
|
|
513
|
+
if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
514
514
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
515
515
|
}
|
|
516
516
|
var resolvedStartPos = tr.doc.resolve(startPos);
|
|
@@ -561,7 +561,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
561
561
|
if (startPos === undefined) {
|
|
562
562
|
return tr;
|
|
563
563
|
}
|
|
564
|
-
if (nodeType === 'layoutColumn' && (0,
|
|
564
|
+
if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
565
565
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
566
566
|
}
|
|
567
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;
|
|
@@ -649,7 +649,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
649
649
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.startPreservingSelection()({
|
|
650
650
|
tr: tr
|
|
651
651
|
});
|
|
652
|
-
if (nodeType === 'layoutColumn' && (0,
|
|
652
|
+
if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
653
653
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
654
654
|
}
|
|
655
655
|
var rootPos = (0, _experiments.editorExperiment)('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
@@ -949,7 +949,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
949
949
|
}
|
|
950
950
|
var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
|
|
951
951
|
var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
|
|
952
|
-
var isLayoutColumnMenuEnabled = (0,
|
|
952
|
+
var isLayoutColumnMenuEnabled = (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true);
|
|
953
953
|
if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
|
|
954
954
|
setDragHandleDisabled(true);
|
|
955
955
|
} else {
|
|
@@ -961,7 +961,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
961
961
|
}) : formatMessage(_messages.blockControlsMessages.dragToMove);
|
|
962
962
|
|
|
963
963
|
// Create a string version for aria-label
|
|
964
|
-
var dragHandleAriaLabel = (0,
|
|
964
|
+
var dragHandleAriaLabel = (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
|
|
965
965
|
br: ' '
|
|
966
966
|
}) : formatMessage(_messages.blockControlsMessages.dragToMove);
|
|
967
967
|
var helpDescriptors = isTopLevelNodeValue ? [{
|
|
@@ -1163,7 +1163,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
}, renderButton());
|
|
1165
1165
|
};
|
|
1166
|
-
var tooltipContent = isLayoutColumn && (0,
|
|
1166
|
+
var tooltipContent = isLayoutColumn && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
|
|
1167
1167
|
helpDescriptors: helpDescriptors
|
|
1168
1168
|
});
|
|
1169
1169
|
var isTooltip = !dragHandleDisabled;
|
|
@@ -3,7 +3,6 @@ import { isMultiBlockSelection } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
|
|
9
8
|
import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
|
|
@@ -223,7 +222,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
223
222
|
} else {
|
|
224
223
|
pos = view.posAtDOM(rootElement, 0);
|
|
225
224
|
}
|
|
226
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !
|
|
225
|
+
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)) {
|
|
227
226
|
// Don't show drag handle for layout column in a single column layout,
|
|
228
227
|
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
229
228
|
return false;
|
|
@@ -483,7 +483,7 @@ export const DragHandle = ({
|
|
|
483
483
|
if (startPos === undefined) {
|
|
484
484
|
return tr;
|
|
485
485
|
}
|
|
486
|
-
if (nodeType === 'layoutColumn' &&
|
|
486
|
+
if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
487
487
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
488
488
|
}
|
|
489
489
|
const resolvedStartPos = tr.doc.resolve(startPos);
|
|
@@ -535,7 +535,7 @@ export const DragHandle = ({
|
|
|
535
535
|
if (startPos === undefined) {
|
|
536
536
|
return tr;
|
|
537
537
|
}
|
|
538
|
-
if (nodeType === 'layoutColumn' &&
|
|
538
|
+
if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
539
539
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
540
540
|
}
|
|
541
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;
|
|
@@ -623,7 +623,7 @@ export const DragHandle = ({
|
|
|
623
623
|
api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.startPreservingSelection()({
|
|
624
624
|
tr
|
|
625
625
|
});
|
|
626
|
-
if (nodeType === 'layoutColumn' &&
|
|
626
|
+
if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
627
627
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
628
628
|
}
|
|
629
629
|
const rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
@@ -929,7 +929,7 @@ export const DragHandle = ({
|
|
|
929
929
|
}
|
|
930
930
|
const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
|
|
931
931
|
const $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
|
|
932
|
-
const isLayoutColumnMenuEnabled =
|
|
932
|
+
const isLayoutColumnMenuEnabled = expValEquals('platform_editor_layout_column_menu', 'isEnabled', true);
|
|
933
933
|
if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
|
|
934
934
|
setDragHandleDisabled(true);
|
|
935
935
|
} else {
|
|
@@ -941,7 +941,7 @@ export const DragHandle = ({
|
|
|
941
941
|
}) : formatMessage(blockControlsMessages.dragToMove);
|
|
942
942
|
|
|
943
943
|
// Create a string version for aria-label
|
|
944
|
-
const dragHandleAriaLabel =
|
|
944
|
+
const dragHandleAriaLabel = expValEquals('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
|
|
945
945
|
br: ' '
|
|
946
946
|
}) : formatMessage(blockControlsMessages.dragToMove);
|
|
947
947
|
let helpDescriptors = isTopLevelNodeValue ? [{
|
|
@@ -1135,7 +1135,7 @@ export const DragHandle = ({
|
|
|
1135
1135
|
});
|
|
1136
1136
|
}
|
|
1137
1137
|
}, renderButton());
|
|
1138
|
-
const tooltipContent = isLayoutColumn &&
|
|
1138
|
+
const tooltipContent = isLayoutColumn && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
|
|
1139
1139
|
helpDescriptors: helpDescriptors
|
|
1140
1140
|
});
|
|
1141
1141
|
const isTooltip = !dragHandleDisabled;
|
|
@@ -4,7 +4,6 @@ import { isMultiBlockSelection } from '@atlaskit/editor-common/selection';
|
|
|
4
4
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
8
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
8
|
import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
|
|
10
9
|
import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
|
|
@@ -224,7 +223,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
224
223
|
} else {
|
|
225
224
|
pos = view.posAtDOM(rootElement, 0);
|
|
226
225
|
}
|
|
227
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !
|
|
226
|
+
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)) {
|
|
228
227
|
// Don't show drag handle for layout column in a single column layout,
|
|
229
228
|
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
230
229
|
return false;
|
|
@@ -506,7 +506,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
506
506
|
if (startPos === undefined) {
|
|
507
507
|
return tr;
|
|
508
508
|
}
|
|
509
|
-
if (nodeType === 'layoutColumn' &&
|
|
509
|
+
if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
510
510
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
511
511
|
}
|
|
512
512
|
var resolvedStartPos = tr.doc.resolve(startPos);
|
|
@@ -557,7 +557,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
557
557
|
if (startPos === undefined) {
|
|
558
558
|
return tr;
|
|
559
559
|
}
|
|
560
|
-
if (nodeType === 'layoutColumn' &&
|
|
560
|
+
if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
561
561
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
562
562
|
}
|
|
563
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;
|
|
@@ -645,7 +645,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
645
645
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.startPreservingSelection()({
|
|
646
646
|
tr: tr
|
|
647
647
|
});
|
|
648
|
-
if (nodeType === 'layoutColumn' &&
|
|
648
|
+
if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
649
649
|
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
|
|
650
650
|
}
|
|
651
651
|
var rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
@@ -945,7 +945,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
945
945
|
}
|
|
946
946
|
var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
|
|
947
947
|
var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
|
|
948
|
-
var isLayoutColumnMenuEnabled =
|
|
948
|
+
var isLayoutColumnMenuEnabled = expValEquals('platform_editor_layout_column_menu', 'isEnabled', true);
|
|
949
949
|
if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
|
|
950
950
|
setDragHandleDisabled(true);
|
|
951
951
|
} else {
|
|
@@ -957,7 +957,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
957
957
|
}) : formatMessage(blockControlsMessages.dragToMove);
|
|
958
958
|
|
|
959
959
|
// Create a string version for aria-label
|
|
960
|
-
var dragHandleAriaLabel =
|
|
960
|
+
var dragHandleAriaLabel = expValEquals('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
|
|
961
961
|
br: ' '
|
|
962
962
|
}) : formatMessage(blockControlsMessages.dragToMove);
|
|
963
963
|
var helpDescriptors = isTopLevelNodeValue ? [{
|
|
@@ -1159,7 +1159,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
}, renderButton());
|
|
1161
1161
|
};
|
|
1162
|
-
var tooltipContent = isLayoutColumn &&
|
|
1162
|
+
var tooltipContent = isLayoutColumn && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
|
|
1163
1163
|
helpDescriptors: helpDescriptors
|
|
1164
1164
|
});
|
|
1165
1165
|
var isTooltip = !dragHandleDisabled;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.3",
|
|
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": "^114.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.13.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"
|