@atlaskit/editor-plugin-block-controls 9.0.15 → 9.0.17
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 +14 -0
- package/dist/cjs/blockControlsPlugin.js +3 -4
- package/dist/cjs/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/cjs/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/cjs/pm-plugins/handle-mouse-over.js +5 -3
- package/dist/cjs/pm-plugins/main.js +8 -8
- package/dist/cjs/pm-plugins/utils/getSelection.js +3 -3
- package/dist/cjs/ui/drag-handle.js +18 -10
- package/dist/cjs/ui/drop-target.js +12 -4
- package/dist/cjs/ui/global-styles.js +3 -1
- package/dist/cjs/ui/quick-insert-button.js +6 -2
- package/dist/cjs/ui/visibility-container.js +2 -0
- package/dist/es2019/blockControlsPlugin.js +3 -4
- package/dist/es2019/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/es2019/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/es2019/pm-plugins/handle-mouse-over.js +5 -3
- package/dist/es2019/pm-plugins/main.js +8 -8
- package/dist/es2019/pm-plugins/utils/getSelection.js +3 -3
- package/dist/es2019/ui/drag-handle.js +18 -10
- package/dist/es2019/ui/drop-target.js +12 -4
- package/dist/es2019/ui/global-styles.js +3 -1
- package/dist/es2019/ui/quick-insert-button.js +6 -2
- package/dist/es2019/ui/visibility-container.js +2 -0
- package/dist/esm/blockControlsPlugin.js +3 -4
- package/dist/esm/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/esm/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/esm/pm-plugins/handle-mouse-over.js +5 -3
- package/dist/esm/pm-plugins/main.js +8 -8
- package/dist/esm/pm-plugins/utils/getSelection.js +3 -3
- package/dist/esm/ui/drag-handle.js +18 -10
- package/dist/esm/ui/drop-target.js +12 -4
- package/dist/esm/ui/global-styles.js +3 -1
- package/dist/esm/ui/quick-insert-button.js +6 -2
- package/dist/esm/ui/visibility-container.js +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 9.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.0.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9ed32aea2c1d3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ed32aea2c1d3) -
|
|
14
|
+
Replace feature experiment util with cross platform alternative for platform_editor_block_menu
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 9.0.15
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -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 _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
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 _handleKeyDownWithPreservedSelection = require("./editor-commands/handle-key-down-with-preserved-selection");
|
|
17
16
|
var _mapPreservedSelection2 = require("./editor-commands/map-preserved-selection");
|
|
@@ -68,7 +67,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
68
67
|
}
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
|
-
if ((0,
|
|
70
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
72
71
|
pmPlugins.push({
|
|
73
72
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
74
73
|
plugin: (0, _pmPlugin2.createSelectionPreservationPlugin)(api)
|
|
@@ -109,7 +108,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
109
108
|
return function (_ref4) {
|
|
110
109
|
var _api$userIntent, _api$blockControls, _options$anchorName, _api$blockControls2;
|
|
111
110
|
var tr = _ref4.tr;
|
|
112
|
-
if (!(0,
|
|
111
|
+
if (!(0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
113
112
|
return tr;
|
|
114
113
|
}
|
|
115
114
|
var currMeta = tr.getMeta(_main.key);
|
|
@@ -342,7 +341,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
342
341
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
343
342
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
344
343
|
}
|
|
345
|
-
if ((0,
|
|
344
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
346
345
|
var _selectionPreservatio;
|
|
347
346
|
sharedState.preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
348
347
|
}
|
|
@@ -8,7 +8,7 @@ exports.moveNodeWithBlockMenu = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _types = require("@atlaskit/editor-common/types");
|
|
11
|
-
var
|
|
11
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
12
|
var _main = require("../pm-plugins/main");
|
|
13
13
|
var _selection = require("../pm-plugins/utils/selection");
|
|
14
14
|
var _moveNode = require("./move-node");
|
|
@@ -30,7 +30,7 @@ var moveNodeWithBlockMenu = exports.moveNodeWithBlockMenu = function moveNodeWit
|
|
|
30
30
|
return function (_ref) {
|
|
31
31
|
var _api$blockControls$sh;
|
|
32
32
|
var tr = _ref.tr;
|
|
33
|
-
if (!(0,
|
|
33
|
+
if (!(0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
34
34
|
return tr;
|
|
35
35
|
}
|
|
36
36
|
var preservedSelection = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
|
|
@@ -443,7 +443,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
443
443
|
}));
|
|
444
444
|
if (
|
|
445
445
|
// when move node via block menu, we need to keep the focus on block menu popup, so don't move focus to editor in this scenario
|
|
446
|
-
!(inputMethod === _analytics.INPUT_METHOD.BLOCK_MENU && (0,
|
|
446
|
+
!(inputMethod === _analytics.INPUT_METHOD.BLOCK_MENU && (0, _experiments.editorExperiment)('platform_editor_block_menu', true))) {
|
|
447
447
|
api === null || api === void 0 || api.core.actions.focus();
|
|
448
448
|
}
|
|
449
449
|
var $mappedTo = tr.doc.resolve(mappedTo);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getShouldMoveNode = exports.getPosWhenMoveNodeUp = exports.getPosWhenMoveNodeDown = exports.getNodeBoundsFromSelection = exports.canMoveNodeUpOrDown = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
9
|
-
var
|
|
9
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
10
10
|
var _selection = require("../../pm-plugins/utils/selection");
|
|
11
11
|
/**
|
|
12
12
|
* Gets the current node position and bounds from the selection using the preserved selection logic.
|
|
@@ -33,7 +33,7 @@ var getNodeBoundsFromSelection = exports.getNodeBoundsFromSelection = function g
|
|
|
33
33
|
// Special case: if a media node (file) is selected, we need to get the parent mediaGroup
|
|
34
34
|
// This handles the case where clicking on a file creates a NodeSelection of the media node
|
|
35
35
|
// but we want to move the entire mediaGroup that wraps it
|
|
36
|
-
if (selection instanceof _state.NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' && (0,
|
|
36
|
+
if (selection instanceof _state.NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' && (0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
37
37
|
// The media node is wrapped in a mediaGroup, so we need to get the parent position
|
|
38
38
|
var mediaGroupPos = selection.$from.pos - 1;
|
|
39
39
|
var mediaGroupNode = selection.$from.doc.nodeAt(mediaGroupPos);
|
|
@@ -58,7 +58,7 @@ var getNodeBoundsFromSelection = exports.getNodeBoundsFromSelection = function g
|
|
|
58
58
|
var getPosWhenMoveNodeUp = exports.getPosWhenMoveNodeUp = function getPosWhenMoveNodeUp($currentNodePos, currentNodePos) {
|
|
59
59
|
var nodeIndex = $currentNodePos.index();
|
|
60
60
|
var nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
|
|
61
|
-
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && (0,
|
|
61
|
+
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && (0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
62
62
|
return -1;
|
|
63
63
|
}
|
|
64
64
|
return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
|
|
@@ -72,7 +72,7 @@ var getPosWhenMoveNodeDown = exports.getPosWhenMoveNodeDown = function getPosWhe
|
|
|
72
72
|
return -1;
|
|
73
73
|
}
|
|
74
74
|
var nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
75
|
-
if ((0,
|
|
75
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
76
76
|
var nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
77
77
|
// if move empty line down to another empty line, move to the position of the next empty line
|
|
78
78
|
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.handleMouseDown = void 0;
|
|
7
7
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
8
8
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
|
-
var
|
|
9
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
10
10
|
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
|
|
11
11
|
return function (view, event) {
|
|
12
12
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -34,7 +34,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
|
|
|
34
34
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name3 = rootNode.type.name) !== null && _rootNode$type$name3 !== void 0 ? _rootNode$type$name3 : '', undefined, rootPos, '', (_rootNode$type$name4 = rootNode.type.name) !== null && _rootNode$type$name4 !== void 0 ? _rootNode$type$name4 : ''));
|
|
35
35
|
}
|
|
36
36
|
} else {
|
|
37
|
-
var isDragHandle = event.target.closest((0,
|
|
37
|
+
var isDragHandle = event.target.closest((0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle]') !== null;
|
|
38
38
|
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
39
39
|
var tr = _ref.tr;
|
|
40
40
|
api === null || api === void 0 || api.blockControls.commands.setSelectedViaDragHandle(isDragHandle)({
|
|
@@ -44,7 +44,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
|
|
|
44
44
|
* When block menu is enabled, reset intent back to 'default' as editor-plugin-block-menu sets the user intent to 'blockMenuOpen', and setting here
|
|
45
45
|
* causes flickering as this runs before editor-plugin-block-menu.
|
|
46
46
|
*/
|
|
47
|
-
if ((0,
|
|
47
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
48
48
|
// if target is drag handle, block menu will be opened
|
|
49
49
|
if (!isDragHandle) {
|
|
50
50
|
var _api$userIntent;
|
|
@@ -68,7 +68,9 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// If the editor view is not in focus when the block menu is open, do not update the drag handle
|
|
71
|
-
if (!view.hasFocus() && isMenuOpen && (0,
|
|
71
|
+
if (!view.hasFocus() && isMenuOpen && (0, _experiments.editorExperiment)('platform_editor_block_menu', true, {
|
|
72
|
+
exposure: true
|
|
73
|
+
})) {
|
|
72
74
|
return false;
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -196,7 +198,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
196
198
|
if (nodeType) {
|
|
197
199
|
// platform_editor_controls note: enables quick insert
|
|
198
200
|
if (toolbarFlagsEnabled) {
|
|
199
|
-
if ((0,
|
|
201
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
200
202
|
var _selectionPreservatio;
|
|
201
203
|
var preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
202
204
|
var selection = preservedSelection || view.state.selection;
|
|
@@ -217,7 +219,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
217
219
|
var _api$core3, _api$blockControls5;
|
|
218
220
|
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.showDragHandleAt(targetPos, anchorName, nodeType));
|
|
219
221
|
}
|
|
220
|
-
if ((0,
|
|
222
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
221
223
|
var _api$userIntent;
|
|
222
224
|
if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'blockMenuOpen') {
|
|
223
225
|
var _api$core4, _api$blockControls6;
|
|
@@ -313,7 +313,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
313
313
|
// Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
|
|
314
314
|
// This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
|
|
315
315
|
// This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
|
|
316
|
-
if (browser.webkit && (0,
|
|
316
|
+
if (browser.webkit && (0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
317
317
|
_mappedPos = tr.mapping.mapResult(activeNode.pos);
|
|
318
318
|
isActiveNodeDeleted = _mappedPos.deleted;
|
|
319
319
|
} else {
|
|
@@ -731,7 +731,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
731
731
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos).length === 0 ? null : latestActiveNode;
|
|
732
732
|
}
|
|
733
733
|
var isMenuOpenNew = isMenuOpen;
|
|
734
|
-
if ((0,
|
|
734
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
735
735
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
736
736
|
isMenuOpenNew = false;
|
|
737
737
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
@@ -753,9 +753,9 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
753
753
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
754
754
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
755
755
|
isMenuOpen: isMenuOpenNew,
|
|
756
|
-
menuTriggerBy: flags.toolbarFlagsEnabled || (0,
|
|
756
|
+
menuTriggerBy: flags.toolbarFlagsEnabled || (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
757
757
|
menuTriggerByNode: (0, _experiments.editorExperiment)('platform_synced_block', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode : undefined,
|
|
758
|
-
blockMenuOptions: (0,
|
|
758
|
+
blockMenuOptions: (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? {
|
|
759
759
|
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
760
760
|
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
761
761
|
openedViaKeyboard: (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard
|
|
@@ -986,12 +986,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
989
|
-
var isDragHandle = event.target.closest((0,
|
|
989
|
+
var isDragHandle = event.target.closest((0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
990
990
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
991
991
|
}
|
|
992
992
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
993
993
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
994
|
-
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0,
|
|
994
|
+
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0, _experiments.editorExperiment)('platform_editor_block_menu', true);
|
|
995
995
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
996
996
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
997
997
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -1013,12 +1013,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
1015
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
1016
|
-
var _isDragHandle = event.target.closest((0,
|
|
1016
|
+
var _isDragHandle = event.target.closest((0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
1017
1017
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(_isDragHandle));
|
|
1018
1018
|
}
|
|
1019
1019
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
1020
1020
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
1021
|
-
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && (0,
|
|
1021
|
+
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && (0, _experiments.editorExperiment)('platform_editor_block_menu', true);
|
|
1022
1022
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
1023
1023
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
1024
1024
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !_isBlockMenuOpen) {
|
|
@@ -10,7 +10,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
14
|
var getInlineNodePos = exports.getInlineNodePos = function getInlineNodePos(doc, start, nodeSize) {
|
|
15
15
|
var $startPos = doc.resolve(start);
|
|
16
16
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -96,7 +96,7 @@ var newGetSelection = exports.newGetSelection = function newGetSelection(doc, se
|
|
|
96
96
|
var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
|
|
97
97
|
var nodeSize = node ? node.nodeSize : 1;
|
|
98
98
|
var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
|
|
99
|
-
if ((0,
|
|
99
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
100
100
|
var _doc$nodeAt;
|
|
101
101
|
// if mediaGroup only has a single child, we want to select the child
|
|
102
102
|
if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
|
|
@@ -141,7 +141,7 @@ var newGetSelection = exports.newGetSelection = function newGetSelection(doc, se
|
|
|
141
141
|
return new _state.TextSelection(doc.resolve(inlineNodePos), doc.resolve(inlineNodeEndPos));
|
|
142
142
|
};
|
|
143
143
|
var getSelection = exports.getSelection = function getSelection(tr, start, api) {
|
|
144
|
-
if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) || (0,
|
|
144
|
+
if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) || (0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
145
145
|
return newGetSelection(tr.doc, tr.selection.empty, start);
|
|
146
146
|
}
|
|
147
147
|
return oldGetSelection(tr, start);
|
|
@@ -1047,7 +1047,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1047
1047
|
setDragHandleDisabled(false);
|
|
1048
1048
|
}
|
|
1049
1049
|
}, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNodeValue, view]);
|
|
1050
|
-
var dragHandleMessage = (0,
|
|
1050
|
+
var dragHandleMessage = (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
|
|
1051
1051
|
br: (0, _react2.jsx)("br", null)
|
|
1052
1052
|
}) : formatMessage(_messages.blockControlsMessages.dragToMove);
|
|
1053
1053
|
|
|
@@ -1136,15 +1136,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1136
1136
|
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1137
1137
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1138
1138
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1139
|
-
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,
|
|
1139
|
+
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')) && dragHandleButtonDenseModeStyles],
|
|
1140
1140
|
ref: buttonRef
|
|
1141
1141
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1142
1142
|
,
|
|
1143
1143
|
style: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1144
1144
|
onMouseDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
|
|
1145
|
-
onMouseUp: (0,
|
|
1146
|
-
onClick: (0,
|
|
1147
|
-
onKeyDown: (0,
|
|
1145
|
+
onMouseUp: (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? handleMouseUp : undefined,
|
|
1146
|
+
onClick: (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? handleOnClickNew : handleOnClick,
|
|
1147
|
+
onKeyDown: (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? handleKeyDownNew : handleKeyDown
|
|
1148
1148
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1149
1149
|
,
|
|
1150
1150
|
onDrop: handleOnDrop,
|
|
@@ -1153,7 +1153,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1153
1153
|
"data-blocks-drag-handle": (0, _expValEqualsNoExposure.expValEqualsNoExposure)('confluence_remix_icon_right_side', 'isEnabled', true) || undefined,
|
|
1154
1154
|
"data-testid": "block-ctrl-drag-handle",
|
|
1155
1155
|
"aria-label": dragHandleAriaLabel,
|
|
1156
|
-
onBlur: (0,
|
|
1156
|
+
onBlur: (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? function () {
|
|
1157
1157
|
return setIsFocused(false);
|
|
1158
1158
|
} : undefined
|
|
1159
1159
|
}, (0, _react2.jsx)(_primitives.Box, {
|
|
@@ -1172,7 +1172,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1172
1172
|
return (0, _react2.jsx)(_primitives.Box
|
|
1173
1173
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1174
1174
|
, {
|
|
1175
|
-
style: (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1175
|
+
style: (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1176
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1177
|
+
,
|
|
1176
1178
|
xcss: [dragHandleContainerStyles],
|
|
1177
1179
|
as: "span",
|
|
1178
1180
|
testId: "block-ctrl-drag-handle-container"
|
|
@@ -1183,7 +1185,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1183
1185
|
helpDescriptors: helpDescriptors
|
|
1184
1186
|
}),
|
|
1185
1187
|
ignoreTooltipPointerEvents: true,
|
|
1186
|
-
position: 'top'
|
|
1188
|
+
position: 'top'
|
|
1189
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1190
|
+
,
|
|
1187
1191
|
onShow: function onShow() {
|
|
1188
1192
|
var _api$accessibilityUti;
|
|
1189
1193
|
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
@@ -1198,7 +1202,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1198
1202
|
return (0, _react2.jsx)(_primitives.Box
|
|
1199
1203
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1200
1204
|
, {
|
|
1201
|
-
style: (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1205
|
+
style: (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1206
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1207
|
+
,
|
|
1202
1208
|
xcss: [dragHandleContainerStyles],
|
|
1203
1209
|
as: "span",
|
|
1204
1210
|
testId: "block-ctrl-drag-handle-container"
|
|
@@ -1213,7 +1219,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
|
|
|
1213
1219
|
content: (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
|
|
1214
1220
|
helpDescriptors: helpDescriptors
|
|
1215
1221
|
}),
|
|
1216
|
-
ignoreTooltipPointerEvents: true
|
|
1222
|
+
ignoreTooltipPointerEvents: true
|
|
1223
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1224
|
+
,
|
|
1217
1225
|
onShow: function onShow() {
|
|
1218
1226
|
var _api$accessibilityUti2;
|
|
1219
1227
|
api === null || api === void 0 || (_api$accessibilityUti2 = api.accessibilityUtils) === null || _api$accessibilityUti2 === void 0 || _api$accessibilityUti2.actions.ariaNotify(message, {
|
|
@@ -242,10 +242,14 @@ var DropTarget = exports.DropTarget = function DropTarget(props) {
|
|
|
242
242
|
width: isNestedDropTarget ? 'unset' : '100%'
|
|
243
243
|
}, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_WIDTH, isNestedDropTarget ? '100%' : "".concat(lineLength || DEFAULT_DROP_INDICATOR_WIDTH, "px")), EDITOR_BLOCK_CONTROLS_DROP_TARGET_LEFT_MARGIN, isNestedDropTarget ? (0, _consts.getNestedNodeLeftPaddingMargin)(parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) : '0'), EDITOR_BLOCK_CONTROLS_DROP_TARGET_ZINDEX, _constants.layers.navigation());
|
|
244
244
|
var isShowInlineDropTarget = (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout, activeNode, parentNode);
|
|
245
|
-
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(HoverZone
|
|
245
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(HoverZone
|
|
246
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
247
|
+
, {
|
|
246
248
|
onDragEnter: function onDragEnter() {
|
|
247
249
|
return setIsDraggedOver(true);
|
|
248
|
-
}
|
|
250
|
+
}
|
|
251
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
252
|
+
,
|
|
249
253
|
onDragLeave: function onDragLeave() {
|
|
250
254
|
return setIsDraggedOver(false);
|
|
251
255
|
},
|
|
@@ -270,10 +274,14 @@ var DropTarget = exports.DropTarget = function DropTarget(props) {
|
|
|
270
274
|
"data-testid": "block-ctrl-drop-indicator"
|
|
271
275
|
}, (0, _react2.jsx)(_box.DropIndicator, {
|
|
272
276
|
edge: "bottom"
|
|
273
|
-
}))), dropTargetStyle !== 'remainingHeight' && (0, _react2.jsx)(HoverZone
|
|
277
|
+
}))), dropTargetStyle !== 'remainingHeight' && (0, _react2.jsx)(HoverZone
|
|
278
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
279
|
+
, {
|
|
274
280
|
onDragEnter: function onDragEnter() {
|
|
275
281
|
return setIsDraggedOver(true);
|
|
276
|
-
}
|
|
282
|
+
}
|
|
283
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
284
|
+
,
|
|
277
285
|
onDragLeave: function onDragLeave() {
|
|
278
286
|
return setIsDraggedOver(false);
|
|
279
287
|
},
|
|
@@ -469,7 +469,9 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
469
469
|
var isDragging = (0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true) ? isDraggingFromState : false;
|
|
470
470
|
var shouldRenderAnchors = (0, _styles.isCSSAnchorSupported)() && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
471
471
|
var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
472
|
-
return (0, _react.jsx)(_react.Global
|
|
472
|
+
return (0, _react.jsx)(_react.Global
|
|
473
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
474
|
+
, {
|
|
473
475
|
styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
474
476
|
exposure: true
|
|
475
477
|
}) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
@@ -341,7 +341,9 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
341
341
|
}, (0, _react2.jsx)(_primitives.Pressable, {
|
|
342
342
|
testId: "editor-quick-insert-button",
|
|
343
343
|
type: "button",
|
|
344
|
-
"aria-label": formatMessage(_messages.blockControlsMessages.insert)
|
|
344
|
+
"aria-label": formatMessage(_messages.blockControlsMessages.insert)
|
|
345
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
346
|
+
,
|
|
345
347
|
xcss: [stickyButtonStyles, ((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')) && stickyButtonDenseModeStyles],
|
|
346
348
|
onClick: handleQuickInsert,
|
|
347
349
|
onMouseDown: handleMouseDown
|
|
@@ -354,7 +356,9 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
354
356
|
return (0, _react2.jsx)(_primitives.Box
|
|
355
357
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
356
358
|
, {
|
|
357
|
-
style: positionStyles
|
|
359
|
+
style: positionStyles
|
|
360
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
361
|
+
,
|
|
358
362
|
xcss: [containerStaticStyles]
|
|
359
363
|
}, (0, _react2.jsx)("span", {
|
|
360
364
|
css: [tooltipContainerStyles, (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_6') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_6') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
@@ -124,6 +124,8 @@ var VisibilityContainer = exports.VisibilityContainer = function VisibilityConta
|
|
|
124
124
|
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
125
125
|
}, children);
|
|
126
126
|
}
|
|
127
|
+
|
|
128
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
127
129
|
return (0, _react2.jsx)(_primitives.Box, {
|
|
128
130
|
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
|
|
129
131
|
}, children);
|
|
@@ -3,7 +3,6 @@ import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
4
4
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
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 { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
9
8
|
import { mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
@@ -54,7 +53,7 @@ export const blockControlsPlugin = ({
|
|
|
54
53
|
plugin: () => createInteractionTrackingPlugin(rightSideControlsEnabled)
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
if (
|
|
56
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
58
57
|
pmPlugins.push({
|
|
59
58
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
60
59
|
plugin: createSelectionPreservationPlugin(api)
|
|
@@ -95,7 +94,7 @@ export const blockControlsPlugin = ({
|
|
|
95
94
|
tr
|
|
96
95
|
}) => {
|
|
97
96
|
var _api$userIntent, _api$userIntent$share, _api$blockControls, _api$blockControls$sh, _options$anchorName, _api$blockControls2, _api$blockControls2$s;
|
|
98
|
-
if (!
|
|
97
|
+
if (!editorExperiment('platform_editor_block_menu', true)) {
|
|
99
98
|
return tr;
|
|
100
99
|
}
|
|
101
100
|
const currMeta = tr.getMeta(key);
|
|
@@ -325,7 +324,7 @@ export const blockControlsPlugin = ({
|
|
|
325
324
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
326
325
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
327
326
|
}
|
|
328
|
-
if (
|
|
327
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
329
328
|
var _selectionPreservatio;
|
|
330
329
|
sharedState.preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
331
330
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
import { key } from '../pm-plugins/main';
|
|
5
5
|
import { mapPreservedSelection } from '../pm-plugins/utils/selection';
|
|
6
6
|
import { moveNode } from './move-node';
|
|
@@ -21,7 +21,7 @@ export const moveNodeWithBlockMenu = (api, direction) => {
|
|
|
21
21
|
tr
|
|
22
22
|
}) => {
|
|
23
23
|
var _api$blockControls$sh;
|
|
24
|
-
if (!
|
|
24
|
+
if (!editorExperiment('platform_editor_block_menu', true)) {
|
|
25
25
|
return tr;
|
|
26
26
|
}
|
|
27
27
|
const preservedSelection = 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.preservedSelection;
|
|
@@ -445,7 +445,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
445
445
|
});
|
|
446
446
|
if (
|
|
447
447
|
// when move node via block menu, we need to keep the focus on block menu popup, so don't move focus to editor in this scenario
|
|
448
|
-
!(inputMethod === INPUT_METHOD.BLOCK_MENU &&
|
|
448
|
+
!(inputMethod === INPUT_METHOD.BLOCK_MENU && editorExperiment('platform_editor_block_menu', true))) {
|
|
449
449
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
450
450
|
}
|
|
451
451
|
const $mappedTo = tr.doc.resolve(mappedTo);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
import { createPreservedSelection } from '../../pm-plugins/utils/selection';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -28,7 +28,7 @@ export const getNodeBoundsFromSelection = selection => {
|
|
|
28
28
|
// Special case: if a media node (file) is selected, we need to get the parent mediaGroup
|
|
29
29
|
// This handles the case where clicking on a file creates a NodeSelection of the media node
|
|
30
30
|
// but we want to move the entire mediaGroup that wraps it
|
|
31
|
-
if (selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' &&
|
|
31
|
+
if (selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' && editorExperiment('platform_editor_block_menu', true)) {
|
|
32
32
|
// The media node is wrapped in a mediaGroup, so we need to get the parent position
|
|
33
33
|
const mediaGroupPos = selection.$from.pos - 1;
|
|
34
34
|
const mediaGroupNode = selection.$from.doc.nodeAt(mediaGroupPos);
|
|
@@ -53,7 +53,7 @@ export const getNodeBoundsFromSelection = selection => {
|
|
|
53
53
|
export const getPosWhenMoveNodeUp = ($currentNodePos, currentNodePos) => {
|
|
54
54
|
const nodeIndex = $currentNodePos.index();
|
|
55
55
|
const nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
|
|
56
|
-
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' &&
|
|
56
|
+
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && editorExperiment('platform_editor_block_menu', true)) {
|
|
57
57
|
return -1;
|
|
58
58
|
}
|
|
59
59
|
return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
|
|
@@ -68,7 +68,7 @@ export const getPosWhenMoveNodeDown = ({
|
|
|
68
68
|
return -1;
|
|
69
69
|
}
|
|
70
70
|
const nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
71
|
-
if (
|
|
71
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
72
72
|
const nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
73
73
|
// if move empty line down to another empty line, move to the position of the next empty line
|
|
74
74
|
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
export const handleMouseDown = api => (view, event) => {
|
|
5
5
|
if (!(event.target instanceof HTMLElement)) {
|
|
6
6
|
return false;
|
|
@@ -27,7 +27,7 @@ export const handleMouseDown = api => (view, event) => {
|
|
|
27
27
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name3 = rootNode.type.name) !== null && _rootNode$type$name3 !== void 0 ? _rootNode$type$name3 : '', undefined, rootPos, '', (_rootNode$type$name4 = rootNode.type.name) !== null && _rootNode$type$name4 !== void 0 ? _rootNode$type$name4 : ''));
|
|
28
28
|
}
|
|
29
29
|
} else {
|
|
30
|
-
const isDragHandle = event.target.closest(
|
|
30
|
+
const isDragHandle = event.target.closest(editorExperiment('platform_editor_block_menu', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle]') !== null;
|
|
31
31
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
32
32
|
tr
|
|
33
33
|
}) => {
|
|
@@ -38,7 +38,7 @@ export const handleMouseDown = api => (view, event) => {
|
|
|
38
38
|
* When block menu is enabled, reset intent back to 'default' as editor-plugin-block-menu sets the user intent to 'blockMenuOpen', and setting here
|
|
39
39
|
* causes flickering as this runs before editor-plugin-block-menu.
|
|
40
40
|
*/
|
|
41
|
-
if (
|
|
41
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
42
42
|
// if target is drag handle, block menu will be opened
|
|
43
43
|
if (!isDragHandle) {
|
|
44
44
|
var _api$userIntent;
|
|
@@ -60,7 +60,9 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// If the editor view is not in focus when the block menu is open, do not update the drag handle
|
|
63
|
-
if (!view.hasFocus() && isMenuOpen &&
|
|
63
|
+
if (!view.hasFocus() && isMenuOpen && editorExperiment('platform_editor_block_menu', true, {
|
|
64
|
+
exposure: true
|
|
65
|
+
})) {
|
|
64
66
|
return false;
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -188,7 +190,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
188
190
|
if (nodeType) {
|
|
189
191
|
// platform_editor_controls note: enables quick insert
|
|
190
192
|
if (toolbarFlagsEnabled) {
|
|
191
|
-
if (
|
|
193
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
192
194
|
var _selectionPreservatio;
|
|
193
195
|
const preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
194
196
|
const selection = preservedSelection || view.state.selection;
|
|
@@ -209,7 +211,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
209
211
|
var _api$core3, _api$blockControls5;
|
|
210
212
|
api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.showDragHandleAt(targetPos, anchorName, nodeType));
|
|
211
213
|
}
|
|
212
|
-
if (
|
|
214
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
213
215
|
var _api$userIntent, _api$userIntent$share;
|
|
214
216
|
if (isMenuOpen && originalAnchorName && (api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) === 'blockMenuOpen') {
|
|
215
217
|
var _api$core4, _api$blockControls6;
|