@atlaskit/editor-plugin-block-controls 17.2.4 → 17.2.5
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 +8 -0
- package/dist/cjs/blockControlsPlugin.js +6 -6
- package/dist/cjs/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/cjs/editor-commands/move-node.js +6 -6
- package/dist/cjs/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/cjs/pm-plugins/decorations-anchor.js +4 -4
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +3 -3
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +2 -2
- package/dist/cjs/pm-plugins/decorations-drop-target.js +2 -2
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +2 -2
- package/dist/cjs/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/cjs/pm-plugins/handle-mouse-over.js +7 -7
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +3 -3
- package/dist/cjs/pm-plugins/main.js +14 -14
- package/dist/cjs/pm-plugins/react-root-registry.js +7 -7
- package/dist/cjs/pm-plugins/utils/active-anchor-tracker.js +2 -2
- package/dist/cjs/pm-plugins/utils/consts.js +2 -2
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +6 -6
- package/dist/cjs/pm-plugins/utils/expand-and-update-selection.js +2 -2
- package/dist/cjs/pm-plugins/utils/getSelection.js +5 -5
- package/dist/cjs/pm-plugins/utils/inline-drop-target.js +2 -2
- package/dist/cjs/pm-plugins/utils/remove-from-source.js +2 -2
- package/dist/cjs/pm-plugins/utils/validation.js +2 -2
- package/dist/cjs/ui/consts.js +4 -4
- package/dist/cjs/ui/drag-handle.js +20 -19
- package/dist/cjs/ui/drop-target.js +2 -2
- package/dist/cjs/ui/global-styles.js +5 -5
- package/dist/cjs/ui/visibility-container.js +2 -2
- package/dist/es2019/blockControlsPlugin.js +1 -1
- package/dist/es2019/editor-commands/move-node-with-block-menu.js +1 -1
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/editor-commands/utils/move-node-utils.js +1 -1
- package/dist/es2019/pm-plugins/decorations-anchor.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drop-target.js +1 -1
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-down.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +1 -1
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/react-root-registry.js +7 -7
- package/dist/es2019/pm-plugins/utils/active-anchor-tracker.js +1 -1
- package/dist/es2019/pm-plugins/utils/consts.js +1 -1
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +1 -1
- package/dist/es2019/pm-plugins/utils/expand-and-update-selection.js +1 -1
- package/dist/es2019/pm-plugins/utils/getSelection.js +1 -1
- package/dist/es2019/pm-plugins/utils/inline-drop-target.js +1 -1
- package/dist/es2019/pm-plugins/utils/remove-from-source.js +1 -1
- package/dist/es2019/pm-plugins/utils/validation.js +1 -1
- package/dist/es2019/ui/consts.js +1 -1
- package/dist/es2019/ui/drag-handle.js +4 -3
- package/dist/es2019/ui/drop-target.js +1 -1
- package/dist/es2019/ui/global-styles.js +1 -1
- package/dist/es2019/ui/visibility-container.js +1 -1
- package/dist/esm/blockControlsPlugin.js +1 -1
- package/dist/esm/editor-commands/move-node-with-block-menu.js +1 -1
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/editor-commands/utils/move-node-utils.js +1 -1
- package/dist/esm/pm-plugins/decorations-anchor.js +1 -1
- package/dist/esm/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +1 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +1 -1
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-down.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +1 -1
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/react-root-registry.js +7 -7
- package/dist/esm/pm-plugins/utils/active-anchor-tracker.js +1 -1
- package/dist/esm/pm-plugins/utils/consts.js +1 -1
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +1 -1
- package/dist/esm/pm-plugins/utils/expand-and-update-selection.js +1 -1
- package/dist/esm/pm-plugins/utils/getSelection.js +1 -1
- package/dist/esm/pm-plugins/utils/inline-drop-target.js +1 -1
- package/dist/esm/pm-plugins/utils/remove-from-source.js +1 -1
- package/dist/esm/pm-plugins/utils/validation.js +1 -1
- package/dist/esm/ui/consts.js +1 -1
- package/dist/esm/ui/drag-handle.js +4 -3
- package/dist/esm/ui/drop-target.js +1 -1
- package/dist/esm/ui/global-styles.js +1 -1
- package/dist/esm/ui/visibility-container.js +1 -1
- package/dist/types/pm-plugins/react-root-registry.d.ts +4 -4
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 17.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6304662fbdf4a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6304662fbdf4a) -
|
|
8
|
+
Use the supported `createRoot` API when `platform_editor_react19_migration` is enabled.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 17.2.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
|
16
16
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
17
17
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
18
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
|
-
var
|
|
19
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
20
20
|
var _handleKeyDownWithPreservedSelection = require("./editor-commands/handle-key-down-with-preserved-selection");
|
|
21
21
|
var _mapPreservedSelection2 = require("./editor-commands/map-preserved-selection");
|
|
22
22
|
var _moveNode = require("./editor-commands/move-node");
|
|
@@ -132,7 +132,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
132
132
|
return (0, _main.createPlugin)(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled && legacyBlockControlsEnabled, legacyBlockControlsEnabled, surfaceNodePositionsEnabled);
|
|
133
133
|
}
|
|
134
134
|
}];
|
|
135
|
-
if ((0,
|
|
135
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
136
136
|
pmPlugins.push({
|
|
137
137
|
name: 'blockControlsInteractionTrackingPlugin',
|
|
138
138
|
plugin: function plugin() {
|
|
@@ -140,7 +140,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
if ((0,
|
|
143
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
144
144
|
pmPlugins.push({
|
|
145
145
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
146
146
|
plugin: (0, _pmPlugin2.createSelectionPreservationPlugin)(api)
|
|
@@ -199,7 +199,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
199
199
|
return function (_ref6) {
|
|
200
200
|
var _api$userIntent, _api$blockControls2, _options$anchorName, _api$blockControls3;
|
|
201
201
|
var tr = _ref6.tr;
|
|
202
|
-
if (!(0,
|
|
202
|
+
if (!(0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
203
203
|
return tr;
|
|
204
204
|
}
|
|
205
205
|
var currMeta = tr.getMeta(_main.key);
|
|
@@ -435,14 +435,14 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
435
435
|
var _key$getState$surface, _key$getState11;
|
|
436
436
|
sharedState.surfaceNodePositions = (_key$getState$surface = (_key$getState11 = _main.key.getState(editorState)) === null || _key$getState11 === void 0 ? void 0 : _key$getState11.surfaceNodePositions) !== null && _key$getState$surface !== void 0 ? _key$getState$surface : [];
|
|
437
437
|
}
|
|
438
|
-
if ((0,
|
|
438
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
439
439
|
var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
|
|
440
440
|
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
441
441
|
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
442
442
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
443
443
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
444
444
|
}
|
|
445
|
-
if ((0,
|
|
445
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
446
446
|
var _selectionPreservatio;
|
|
447
447
|
sharedState.preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
448
448
|
}
|
|
@@ -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 _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
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, _editorExperiment.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;
|
|
@@ -22,7 +22,7 @@ var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
|
22
22
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
23
23
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
24
24
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
|
-
var
|
|
25
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
26
26
|
var _main = require("../pm-plugins/main");
|
|
27
27
|
var _analytics2 = require("../pm-plugins/utils/analytics");
|
|
28
28
|
var _getNestedNodePosition = require("../pm-plugins/utils/getNestedNodePosition");
|
|
@@ -203,7 +203,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
203
203
|
var moveToPos = -1;
|
|
204
204
|
var isLayoutColumnSelected = selection instanceof _state.NodeSelection && selection.node.type.name === 'layoutColumn';
|
|
205
205
|
if (direction === _types.DIRECTION.LEFT) {
|
|
206
|
-
if (isTopLevelNode && (0,
|
|
206
|
+
if (isTopLevelNode && (0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
207
207
|
var _api$core, _api$core2;
|
|
208
208
|
var nodeBefore = $currentNodePos.nodeBefore;
|
|
209
209
|
if (nodeBefore) {
|
|
@@ -247,7 +247,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
247
247
|
moveToPos = $currentNodePos.start() - ((previousNode === null || previousNode === void 0 ? void 0 : previousNode.nodeSize) || 1);
|
|
248
248
|
}
|
|
249
249
|
} else if (direction === _types.DIRECTION.RIGHT) {
|
|
250
|
-
if (isTopLevelNode && (0,
|
|
250
|
+
if (isTopLevelNode && (0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
251
251
|
var _api$core4, _api$core5;
|
|
252
252
|
var endOfDoc = $currentNodePos.end();
|
|
253
253
|
moveToPos = $currentNodePos.posAtIndex($currentNodePos.index() + 1);
|
|
@@ -378,7 +378,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
378
378
|
tr: tr
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
|
-
var preservedSelection = (0,
|
|
381
|
+
var preservedSelection = (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection : undefined;
|
|
382
382
|
if (preservedSelection) {
|
|
383
383
|
var $from = tr.doc.resolve(Math.min(start, preservedSelection.from));
|
|
384
384
|
var expandedRange = $from.blockRange(preservedSelection.$to);
|
|
@@ -482,7 +482,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
482
482
|
}));
|
|
483
483
|
if (
|
|
484
484
|
// 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
|
|
485
|
-
!(inputMethod === _analytics.INPUT_METHOD.BLOCK_MENU && (0,
|
|
485
|
+
!(inputMethod === _analytics.INPUT_METHOD.BLOCK_MENU && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true))) {
|
|
486
486
|
api === null || api === void 0 || api.core.actions.focus();
|
|
487
487
|
}
|
|
488
488
|
var $mappedTo = tr.doc.resolve(mappedTo);
|
|
@@ -494,7 +494,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
494
494
|
_expand.expandedState.set(updatedExpandAncestor.node, wasExpandExpanded);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
if ((0,
|
|
497
|
+
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
498
498
|
(0, _analytics2.attachMoveNodeAnalytics)(tr, inputMethod, $handlePos.depth, sourceNodeTypes, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name, $handlePos.sameParent($mappedTo), api, hasSelectedMultipleNodes);
|
|
499
499
|
} else {
|
|
500
500
|
var _api$analytics;
|
|
@@ -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 _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
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, _editorExperiment.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, _editorExperiment.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, _editorExperiment.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') {
|
|
@@ -8,7 +8,7 @@ exports.shouldDescendIntoNode = exports.nodeDecorations = exports.findNodeDecs =
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
10
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
|
-
var
|
|
11
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
12
12
|
var _decorationsCommon = require("./decorations-common");
|
|
13
13
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
|
|
14
14
|
var IGNORE_NODES_NEXT = exports.IGNORE_NODES_NEXT = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption'];
|
|
@@ -22,7 +22,7 @@ var shouldDescendIntoNode = exports.shouldDescendIntoNode = function shouldDesce
|
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
if ((0,
|
|
25
|
+
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
26
26
|
return !IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT.includes(node.type.name);
|
|
27
27
|
}
|
|
28
28
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
@@ -36,7 +36,7 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
36
36
|
if (isNestedTable) {
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
|
-
var isFirstTableRow = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'table' && depth === 1 && node === parent.firstChild && 'tableRow' === node.type.name && (0,
|
|
39
|
+
var isFirstTableRow = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'table' && depth === 1 && node === parent.firstChild && 'tableRow' === node.type.name && (0, _editorExperiment.editorExperiment)('advanced_layouts', true);
|
|
40
40
|
if (isFirstTableRow) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
@@ -82,7 +82,7 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
|
|
|
82
82
|
}
|
|
83
83
|
var docFrom = from === undefined || from < 0 ? 0 : from;
|
|
84
84
|
var docTo = to === undefined || to > newState.doc.nodeSize - 2 ? newState.doc.nodeSize - 2 : to;
|
|
85
|
-
var ignore_nodes = (0,
|
|
85
|
+
var ignore_nodes = (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? IGNORE_NODES_NEXT : IGNORE_NODES;
|
|
86
86
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, _) {
|
|
87
87
|
var depth = 0;
|
|
88
88
|
var shouldDescend = shouldDescendIntoNode(node);
|
|
@@ -11,7 +11,7 @@ var _uuid = _interopRequireDefault(require("uuid"));
|
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
-
var
|
|
14
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
15
15
|
var _consts = require("../ui/consts");
|
|
16
16
|
var _dragHandle = require("../ui/drag-handle");
|
|
17
17
|
var _decorationsCommon = require("./decorations-common");
|
|
@@ -63,7 +63,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
63
63
|
(0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
64
64
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
65
65
|
var key = (0, _uuid.default)();
|
|
66
|
-
var widgetSpec = (0,
|
|
66
|
+
var widgetSpec = (0, _editorExperiment.editorExperiment)('platform_editor_breakout_resizing', true) ? {
|
|
67
67
|
side: -1,
|
|
68
68
|
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
69
69
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
@@ -139,7 +139,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
139
139
|
// key,
|
|
140
140
|
// );
|
|
141
141
|
|
|
142
|
-
if ((0,
|
|
142
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
143
143
|
(0, _reactRootRegistry.renderToMountPoint)( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandleWithVisibility, {
|
|
144
144
|
view: view,
|
|
145
145
|
api: api,
|
|
@@ -12,7 +12,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
12
12
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
13
13
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
14
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
-
var
|
|
15
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
16
16
|
var _decorationsCommon = require("./decorations-common");
|
|
17
17
|
var _decorationsDropTarget = require("./decorations-drop-target");
|
|
18
18
|
var _decorationsFindSurroundingNodes = require("./decorations-find-surrounding-nodes");
|
|
@@ -212,7 +212,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
215
|
-
if ((0,
|
|
215
|
+
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
216
216
|
var schema = rootNodeWithPos.node.type.schema;
|
|
217
217
|
var layoutSection = schema.nodes.layoutSection;
|
|
218
218
|
var isLayoutSectionChildOfRoot = (0, _utils2.findChildrenByType)(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
@@ -15,7 +15,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
15
15
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
16
16
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
17
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
|
-
var
|
|
18
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
19
19
|
var _consts = require("../ui/consts");
|
|
20
20
|
var _dropTarget = require("../ui/drop-target");
|
|
21
21
|
var _dropTargetLayout = require("../ui/drop-target-layout");
|
|
@@ -191,7 +191,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
191
191
|
popNodeStack(depth);
|
|
192
192
|
prevNodeStack.push(node);
|
|
193
193
|
};
|
|
194
|
-
var isAdvancedLayoutsPreRelease2 = (0,
|
|
194
|
+
var isAdvancedLayoutsPreRelease2 = (0, _editorExperiment.editorExperiment)('advanced_layouts', true);
|
|
195
195
|
|
|
196
196
|
// For deciding to show drop targets or not when multiple nodes are selected
|
|
197
197
|
var selection = newState.selection;
|
|
@@ -11,7 +11,7 @@ var _uuid = _interopRequireDefault(require("uuid"));
|
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
-
var
|
|
14
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
15
15
|
var _consts = require("../ui/consts");
|
|
16
16
|
var _quickInsertButton = require("../ui/quick-insert-button");
|
|
17
17
|
var _marks = require("./utils/marks");
|
|
@@ -53,7 +53,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
53
53
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
54
54
|
var key = (0, _uuid.default)();
|
|
55
55
|
var cleanupCallbacks = [];
|
|
56
|
-
var widgetSpec = (0,
|
|
56
|
+
var widgetSpec = (0, _editorExperiment.editorExperiment)('platform_editor_breakout_resizing', true) ? {
|
|
57
57
|
side: -2,
|
|
58
58
|
type: TYPE_QUICK_INSERT,
|
|
59
59
|
/**
|
|
@@ -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 _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
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, _editorExperiment.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, _editorExperiment.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;
|
|
@@ -12,7 +12,7 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
|
12
12
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
14
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
15
|
-
var
|
|
15
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
16
16
|
var _domAttrName = require("../ui/utils/dom-attr-name");
|
|
17
17
|
var _decorationsAnchor = require("./decorations-anchor");
|
|
18
18
|
var _pluginKey = require("./selection-preservation/plugin-key");
|
|
@@ -115,7 +115,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// If the editor view is not in focus when the block menu is open, do not update the drag handle
|
|
118
|
-
if (!view.hasFocus() && isMenuOpen && (0,
|
|
118
|
+
if (!view.hasFocus() && isMenuOpen && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true, {
|
|
119
119
|
exposure: true
|
|
120
120
|
})) {
|
|
121
121
|
return false;
|
|
@@ -166,7 +166,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
166
166
|
if (isEmptyNestedParagraphOrHeading(rootElement)) {
|
|
167
167
|
return false;
|
|
168
168
|
}
|
|
169
|
-
if (rootElement.getAttribute((0, _domAttrName.getTypeNameAttrName)()) === 'media' && (0,
|
|
169
|
+
if (rootElement.getAttribute((0, _domAttrName.getTypeNameAttrName)()) === 'media' && (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && !isNativeAnchorSupported) {
|
|
170
170
|
rootElement = rootElement.closest("[".concat((0, _domAttrName.getAnchorAttrName)(), "][").concat((0, _domAttrName.getTypeNameAttrName)(), "=\"mediaSingle\"]"));
|
|
171
171
|
if (!rootElement) {
|
|
172
172
|
return false;
|
|
@@ -174,7 +174,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
174
174
|
}
|
|
175
175
|
var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest("[".concat((0, _domAttrName.getAnchorAttrName)(), "]"));
|
|
176
176
|
var parentElementType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(parentElement) : parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
|
|
177
|
-
if ((0,
|
|
177
|
+
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
178
178
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
179
179
|
if (parentElement && parentElementType === 'table') {
|
|
180
180
|
rootElement = parentElement;
|
|
@@ -240,7 +240,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
240
240
|
} else {
|
|
241
241
|
pos = view.posAtDOM(rootElement, 0);
|
|
242
242
|
}
|
|
243
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0,
|
|
243
|
+
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && !(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
244
244
|
// Don't show drag handle for layout column in a single column layout,
|
|
245
245
|
// unless the layout column menu is enabled (menu needs the handle to be accessible).
|
|
246
246
|
return false;
|
|
@@ -269,7 +269,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
269
269
|
if (nodeType) {
|
|
270
270
|
// platform_editor_controls note: enables quick insert
|
|
271
271
|
if (toolbarFlagsEnabled) {
|
|
272
|
-
if ((0,
|
|
272
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
273
273
|
var _selectionPreservatio;
|
|
274
274
|
var preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
275
275
|
var selection = preservedSelection || view.state.selection;
|
|
@@ -290,7 +290,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
290
290
|
var _api$core3, _api$blockControls5;
|
|
291
291
|
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));
|
|
292
292
|
}
|
|
293
|
-
if ((0,
|
|
293
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
294
294
|
var _api$userIntent2;
|
|
295
295
|
if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'blockMenuOpen') {
|
|
296
296
|
var _api$core4, _api$blockControls6;
|
|
@@ -12,7 +12,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
12
12
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
13
|
var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
|
-
var
|
|
15
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
16
16
|
var _constants = require("./constants");
|
|
17
17
|
var _handleKeyDown = require("./handle-key-down");
|
|
18
18
|
var _handleMouseMove = require("./handle-mouse-move");
|
|
@@ -70,7 +70,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
70
70
|
var state = {
|
|
71
71
|
isEditing: false
|
|
72
72
|
};
|
|
73
|
-
if ((0,
|
|
73
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
74
74
|
state.isMouseOut = false;
|
|
75
75
|
}
|
|
76
76
|
return state;
|
|
@@ -113,7 +113,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
|
-
view: (0,
|
|
116
|
+
view: (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? function (view) {
|
|
117
117
|
var editorContentArea = view.dom.closest('.ak-editor-content-area');
|
|
118
118
|
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
119
119
|
|
|
@@ -26,7 +26,7 @@ var _element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
|
|
|
26
26
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/utils/combine");
|
|
27
27
|
var _elementAdapter = require("@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter");
|
|
28
28
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
29
|
-
var
|
|
29
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
30
30
|
var _consts = require("../ui/consts");
|
|
31
31
|
var _domAttrName = require("../ui/utils/dom-attr-name");
|
|
32
32
|
var _decorationsAnchor = require("./decorations-anchor");
|
|
@@ -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, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
317
317
|
_mappedPos = tr.mapping.mapResult(activeNode.pos);
|
|
318
318
|
isActiveNodeDeleted = _mappedPos.deleted;
|
|
319
319
|
} else {
|
|
@@ -364,7 +364,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
364
364
|
|
|
365
365
|
// Re-create node decorations
|
|
366
366
|
var isDecSetEmpty = decorations === _view.DecorationSet.empty;
|
|
367
|
-
var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || (0,
|
|
367
|
+
var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || (0, _editorExperiment.editorExperiment)('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
|
|
368
368
|
var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
|
|
369
369
|
// Skip expensive anchor node decoration recalculations when native anchor support is enabled
|
|
370
370
|
!(0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
@@ -811,7 +811,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
811
811
|
// handle - so findHandleDec is always empty. Don't clear activeNode in that case.
|
|
812
812
|
var hasHandleOrViewModeControls = (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length > 0 || isViewMode && rightSideControlsEnabled || !flags.legacyDragHandleEnabled;
|
|
813
813
|
// Keep the registry surface mounted while its Block Menu owns focus.
|
|
814
|
-
var keepActiveNodeForOpenBlockMenu = !flags.legacyDragHandleEnabled && isMenuOpen && (0,
|
|
814
|
+
var keepActiveNodeForOpenBlockMenu = !flags.legacyDragHandleEnabled && isMenuOpen && (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true);
|
|
815
815
|
newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
|
|
816
816
|
} else {
|
|
817
817
|
var _latestActiveNode13, _latestActiveNode14;
|
|
@@ -830,7 +830,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
830
830
|
});
|
|
831
831
|
}
|
|
832
832
|
var isMenuOpenNew = isMenuOpen;
|
|
833
|
-
if ((0,
|
|
833
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
|
|
834
834
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
835
835
|
isMenuOpenNew = false;
|
|
836
836
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
@@ -853,9 +853,9 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
853
853
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
854
854
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
855
855
|
isMenuOpen: isMenuOpenNew,
|
|
856
|
-
menuTriggerBy: flags.toolbarFlagsEnabled || (0,
|
|
856
|
+
menuTriggerBy: flags.toolbarFlagsEnabled || (0, _editorExperiment.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,
|
|
857
857
|
menuTriggerByNode: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode,
|
|
858
|
-
blockMenuOptions: (0,
|
|
858
|
+
blockMenuOptions: (0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? {
|
|
859
859
|
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,
|
|
860
860
|
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,
|
|
861
861
|
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
|
|
@@ -880,7 +880,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
880
880
|
var surfaceNodePositionsEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
881
881
|
var _getIntl = getIntl(),
|
|
882
882
|
formatMessage = _getIntl.formatMessage;
|
|
883
|
-
var isAdvancedLayoutEnabled = (0,
|
|
883
|
+
var isAdvancedLayoutEnabled = (0, _editorExperiment.editorExperiment)('advanced_layouts', true, {
|
|
884
884
|
exposure: true
|
|
885
885
|
});
|
|
886
886
|
var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
@@ -1083,7 +1083,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1083
1083
|
if (api !== null && api !== void 0 && (_api$limitedMode7 = api.limitedMode) !== null && _api$limitedMode7 !== void 0 && (_api$limitedMode7 = _api$limitedMode7.sharedState.currentState()) !== null && _api$limitedMode7 !== void 0 && _api$limitedMode7.enabled) {
|
|
1084
1084
|
return;
|
|
1085
1085
|
}
|
|
1086
|
-
return (0,
|
|
1086
|
+
return (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _handleMouseDown.handleMouseDown)(api)(view, event) : undefined;
|
|
1087
1087
|
},
|
|
1088
1088
|
keydown: function keydown(view, event) {
|
|
1089
1089
|
var _api$limitedMode8;
|
|
@@ -1097,13 +1097,13 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1097
1097
|
return true;
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0,
|
|
1101
|
-
var isDragHandle = event.target.closest((0,
|
|
1100
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
1101
|
+
var isDragHandle = event.target.closest((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
1102
1102
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
1103
1103
|
}
|
|
1104
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0,
|
|
1104
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
1105
1105
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
1106
|
-
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,
|
|
1106
|
+
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, _editorExperiment.editorExperiment)('platform_editor_block_menu', true);
|
|
1107
1107
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
1108
1108
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
1109
1109
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -1133,7 +1133,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1133
1133
|
if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0 = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0 !== void 0 && _api$limitedMode0.enabled) {
|
|
1134
1134
|
return;
|
|
1135
1135
|
}
|
|
1136
|
-
if ((0,
|
|
1136
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
1137
1137
|
var _api$core2;
|
|
1138
1138
|
// Focus moving into the registry surface remains inside the editor experience.
|
|
1139
1139
|
var isChildOfSurface = !flags.legacyDragHandleEnabled && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(_consts.BLOCK_CONTROLS_SURFACE_SELECTOR) !== null;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.unmountFromMountPoint = exports.renderToMountPoint = void 0;
|
|
8
8
|
var _reactDom = _interopRequireWildcard(require("react-dom"));
|
|
9
9
|
var _client = require("react-dom/client");
|
|
10
|
-
var
|
|
10
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
12
|
/**
|
|
13
13
|
* Shared registry of React roots created via `createRoot`.
|
|
@@ -21,16 +21,16 @@ var reactRoots = new WeakMap();
|
|
|
21
21
|
/**
|
|
22
22
|
* Mounts `element` into `mountPoint`.
|
|
23
23
|
*
|
|
24
|
-
* When `
|
|
24
|
+
* When `platform_editor_react19_migration` is **on**, uses the React 18/19 `createRoot`
|
|
25
25
|
* API wrapped in `flushSync` so the render is synchronous – matching the
|
|
26
26
|
* legacy `ReactDOM.render` timing that ProseMirror decoration widgets depend
|
|
27
27
|
* on (focus management, anchor positioning, block-menu visibility all read
|
|
28
28
|
* the rendered DOM immediately after the callback returns).
|
|
29
29
|
*
|
|
30
|
-
*
|
|
30
|
+
* Otherwise, falls back to the legacy `ReactDOM.render` path.
|
|
31
31
|
*/
|
|
32
32
|
var renderToMountPoint = exports.renderToMountPoint = function renderToMountPoint(element, mountPoint) {
|
|
33
|
-
if ((0,
|
|
33
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_react19_migration')) {
|
|
34
34
|
var root = reactRoots.get(mountPoint);
|
|
35
35
|
if (!root) {
|
|
36
36
|
root = (0, _client.createRoot)(mountPoint);
|
|
@@ -51,13 +51,13 @@ var renderToMountPoint = exports.renderToMountPoint = function renderToMountPoin
|
|
|
51
51
|
/**
|
|
52
52
|
* Unmounts the React tree at `mountPoint`.
|
|
53
53
|
*
|
|
54
|
-
* When `
|
|
54
|
+
* When `platform_editor_react19_migration` is **on**, looks up the root in the shared
|
|
55
55
|
* registry, calls `root.unmount()`, and removes the entry.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
57
|
+
* Otherwise, falls back to `ReactDOM.unmountComponentAtNode`.
|
|
58
58
|
*/
|
|
59
59
|
var unmountFromMountPoint = exports.unmountFromMountPoint = function unmountFromMountPoint(mountPoint) {
|
|
60
|
-
if ((0,
|
|
60
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_react19_migration')) {
|
|
61
61
|
var root = reactRoots.get(mountPoint);
|
|
62
62
|
if (root) {
|
|
63
63
|
root.unmount();
|
|
@@ -11,7 +11,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _events = require("events");
|
|
13
13
|
var _react = require("react");
|
|
14
|
-
var
|
|
14
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
15
15
|
var ActiveAnchorTracker = exports.ActiveAnchorTracker = /*#__PURE__*/function () {
|
|
16
16
|
function ActiveAnchorTracker() {
|
|
17
17
|
(0, _classCallCheck2.default)(this, ActiveAnchorTracker);
|
|
@@ -71,7 +71,7 @@ var useActiveAnchorTracker = exports.useActiveAnchorTracker = function useActive
|
|
|
71
71
|
setIsActive(eventIsActive);
|
|
72
72
|
};
|
|
73
73
|
(0, _react.useEffect)(function () {
|
|
74
|
-
if (activeAnchorTracker && anchorName && (0,
|
|
74
|
+
if (activeAnchorTracker && anchorName && (0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
|
|
75
75
|
activeAnchorTracker.subscribe(anchorName, onActive);
|
|
76
76
|
if (activeAnchorTracker.getActiveAnchor() === anchorName) {
|
|
77
77
|
setIsActive(true);
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.maxLayoutColumnSupported = exports.MIN_LAYOUT_COLUMN = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
8
8
|
var maxLayoutColumnSupported = exports.maxLayoutColumnSupported = function maxLayoutColumnSupported() {
|
|
9
|
-
return (0,
|
|
9
|
+
return (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? 5 : 3;
|
|
10
10
|
};
|
|
11
11
|
var MIN_LAYOUT_COLUMN = exports.MIN_LAYOUT_COLUMN = 2;
|