@atlaskit/editor-plugin-block-controls 31.0.1 → 31.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/blockControlsPlugin.js +0 -1
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +1 -4
- package/dist/cjs/pm-plugins/decorations-find-surrounding-nodes.js +2 -3
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +1 -4
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +2 -2
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +0 -2
- package/dist/cjs/pm-plugins/main.js +14 -17
- package/dist/cjs/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/cjs/ui/drag-handle.js +14 -2
- package/dist/cjs/ui/drop-target.js +3 -6
- package/dist/cjs/ui/quick-insert-button.js +17 -1
- package/dist/cjs/ui/visibility-container.js +0 -1
- package/dist/es2019/blockControlsPlugin.js +0 -1
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +1 -4
- package/dist/es2019/pm-plugins/decorations-find-surrounding-nodes.js +2 -3
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +1 -4
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +2 -2
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +0 -2
- package/dist/es2019/pm-plugins/main.js +14 -17
- package/dist/es2019/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/es2019/ui/consts.js +3 -3
- package/dist/es2019/ui/drag-handle.js +14 -2
- package/dist/es2019/ui/drop-target.js +3 -6
- package/dist/es2019/ui/quick-insert-button.js +17 -1
- package/dist/es2019/ui/visibility-container.js +0 -1
- package/dist/esm/blockControlsPlugin.js +0 -1
- package/dist/esm/pm-plugins/decorations-drag-handle.js +1 -4
- package/dist/esm/pm-plugins/decorations-find-surrounding-nodes.js +2 -3
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +1 -4
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +2 -2
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +0 -2
- package/dist/esm/pm-plugins/main.js +14 -17
- package/dist/esm/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/esm/ui/consts.js +3 -3
- package/dist/esm/ui/drag-handle.js +14 -2
- package/dist/esm/ui/drop-target.js +3 -6
- package/dist/esm/ui/quick-insert-button.js +17 -1
- package/dist/esm/ui/visibility-container.js +0 -1
- package/package.json +3 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 31.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`49c506ac95bb6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/49c506ac95bb6) -
|
|
8
|
+
Remove the fully rolled-out `confluence_remix_button_right_side_block_fg` gate; keep right-side
|
|
9
|
+
Remix controls enabled when their existing MAUI experiment and product configuration allow them.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 31.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`18fdc5aa80389`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/18fdc5aa80389) -
|
|
17
|
+
Remove unused feature gate registrations and leftover names from past gate cleanups. No behaviour
|
|
18
|
+
change.
|
|
19
|
+
|
|
3
20
|
## 31.0.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -492,7 +492,6 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
492
492
|
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
493
493
|
var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
|
|
494
494
|
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
495
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
496
495
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
497
496
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
498
497
|
}
|
|
@@ -10,7 +10,6 @@ var _react = require("react");
|
|
|
10
10
|
var _uuid = require("uuid");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
13
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
15
14
|
var _consts = require("../ui/consts");
|
|
16
15
|
var _dragHandle = require("../ui/drag-handle");
|
|
@@ -94,9 +93,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
94
93
|
var element = document.createElement('span');
|
|
95
94
|
// inline decoration causes focus issues when refocusing Editor into first line
|
|
96
95
|
element.style.display = 'block';
|
|
97
|
-
|
|
98
|
-
element.setAttribute('data-blocks-decorator-widget', 'true');
|
|
99
|
-
}
|
|
96
|
+
element.setAttribute('data-blocks-decorator-widget', 'true');
|
|
100
97
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
101
98
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
102
99
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.findSurroundingNodes = void 0;
|
|
7
7
|
var IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
|
|
8
|
-
var
|
|
8
|
+
var BLOCK_LEAF_NODES = ['blockCard', 'rule', 'extension', 'syncBlock'];
|
|
9
9
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -19,10 +19,9 @@ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
|
19
19
|
*/
|
|
20
20
|
var _findSurroundingNodes = exports.findSurroundingNodes = function findSurroundingNodes(state, $pos, nodeType) {
|
|
21
21
|
var depth = $pos.depth;
|
|
22
|
-
var blockLeafNodeList = blockLeafNodeNext;
|
|
23
22
|
|
|
24
23
|
// special cases like hr rule here
|
|
25
|
-
if (
|
|
24
|
+
if (BLOCK_LEAF_NODES.includes(nodeType || '') || $pos.pos === 0) {
|
|
26
25
|
var _parent = $pos.node(depth);
|
|
27
26
|
var _node = $pos.nodeAfter;
|
|
28
27
|
var _index = $pos.index();
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _uuid = require("uuid");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
12
|
var _consts = require("../ui/consts");
|
|
14
13
|
var _quickInsertButton = require("../ui/quick-insert-button");
|
|
15
14
|
var _marks = require("./utils/marks");
|
|
@@ -77,9 +76,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
77
76
|
element.style.clear = 'unset';
|
|
78
77
|
element.contentEditable = 'false';
|
|
79
78
|
element.setAttribute('data-blocks-quick-insert-container', 'true');
|
|
80
|
-
|
|
81
|
-
element.setAttribute('data-blocks-quick-insert-button', 'true');
|
|
82
|
-
}
|
|
79
|
+
element.setAttribute('data-blocks-quick-insert-button', 'true');
|
|
83
80
|
element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
|
|
84
81
|
nodeViewPortalProviderAPI.render(function () {
|
|
85
82
|
return /*#__PURE__*/(0, _react.createElement)(_quickInsertButton.QuickInsertWithVisibility, {
|
|
@@ -122,7 +122,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
122
122
|
// We shouldn't be firing mouse over transactions when the editor is disabled,
|
|
123
123
|
// except in view mode when right-side controls are enabled (show controls on block hover)
|
|
124
124
|
var rightSideControlsEnabled = (_api$blockControls$sh = api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.sharedState.currentState()) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.rightSideControlsEnabled) !== null && _api$blockControls$sh !== void 0 ? _api$blockControls$sh : false;
|
|
125
|
-
if (editorDisabled && (!isViewMode || !
|
|
125
|
+
if (editorDisabled && (!isViewMode || !rightSideControlsEnabled)) {
|
|
126
126
|
return false;
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -161,7 +161,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
161
161
|
|
|
162
162
|
// When hovering over the right-edge button (rendered in a portal outside the block), resolve the
|
|
163
163
|
// block from the container's anchor so activeNode stays set and the button remains visible.
|
|
164
|
-
if (!rootElement && rightSideControlsEnabled
|
|
164
|
+
if (!rootElement && rightSideControlsEnabled) {
|
|
165
165
|
var rightEdgeContainer = target === null || target === void 0 ? void 0 : target.closest('[data-blocks-right-edge-button-container]');
|
|
166
166
|
if (rightEdgeContainer) {
|
|
167
167
|
var anchor = rightEdgeContainer.getAttribute('data-blocks-right-edge-button-anchor');
|
|
@@ -97,7 +97,7 @@ var classifyRightMarginPosition = function classifyRightMarginPosition(view, eve
|
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Process hover position and set left/right side. Only invoked when right-side controls are
|
|
100
|
-
* enabled
|
|
100
|
+
* enabled; handleMouseMove returns early otherwise.
|
|
101
101
|
*/
|
|
102
102
|
var processHoverSide = function processHoverSide(view, api) {
|
|
103
103
|
var _api$userIntent, _api$showDiff$sharedS, _api$showDiff;
|
|
@@ -200,7 +200,7 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
200
200
|
(0, _commands.stopEditing)(view);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
// Only track hover side when right-side controls are enabled
|
|
203
|
+
// Only track hover side when right-side controls are enabled.
|
|
204
204
|
if (!rightSideControlsEnabled) {
|
|
205
205
|
return false;
|
|
206
206
|
}
|
|
@@ -118,8 +118,6 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
118
118
|
},
|
|
119
119
|
view: (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? function (view) {
|
|
120
120
|
var editorContentArea = view.dom.closest('.ak-editor-content-area');
|
|
121
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
122
|
-
|
|
123
121
|
var unbindMouseEnter;
|
|
124
122
|
var unbindMouseLeave;
|
|
125
123
|
var unbindDocumentMouseMove;
|
|
@@ -191,19 +191,19 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
191
191
|
var activeNode = currentState.activeNode,
|
|
192
192
|
decorations = currentState.decorations,
|
|
193
193
|
isResizerResizing = currentState.isResizerResizing,
|
|
194
|
-
multiSelectDnD = currentState.multiSelectDnD
|
|
194
|
+
multiSelectDnD = currentState.multiSelectDnD,
|
|
195
|
+
isMenuOpen = currentState.isMenuOpen,
|
|
196
|
+
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
195
197
|
var surfaceNodePositions = currentState.surfaceNodePositions;
|
|
196
198
|
var editorHeight = currentState.editorHeight,
|
|
197
199
|
editorWidthLeft = currentState.editorWidthLeft,
|
|
198
200
|
editorWidthRight = currentState.editorWidthRight,
|
|
199
201
|
isDragging = currentState.isDragging,
|
|
200
|
-
isMenuOpen = currentState.isMenuOpen,
|
|
201
202
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
202
203
|
menuTriggerByNode = currentState.menuTriggerByNode,
|
|
203
204
|
blockMenuOptions = currentState.blockMenuOptions,
|
|
204
205
|
isPMDragging = currentState.isPMDragging,
|
|
205
|
-
lastDragCancelled = currentState.lastDragCancelled
|
|
206
|
-
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
206
|
+
lastDragCancelled = currentState.lastDragCancelled;
|
|
207
207
|
var isActiveNodeDeleted = false;
|
|
208
208
|
var _getTrMetadata = (0, _transactions.getTrMetadata)(tr, flags),
|
|
209
209
|
from = _getTrMetadata.from,
|
|
@@ -523,7 +523,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
523
523
|
} finally {
|
|
524
524
|
_iterator.f();
|
|
525
525
|
}
|
|
526
|
-
if (rightSideControlsEnabled && isViewMode
|
|
526
|
+
if (rightSideControlsEnabled && isViewMode) {
|
|
527
527
|
var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
528
528
|
_step2;
|
|
529
529
|
try {
|
|
@@ -779,7 +779,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
779
779
|
} finally {
|
|
780
780
|
_iterator5.f();
|
|
781
781
|
}
|
|
782
|
-
} else if (isViewMode && rightSideControlsEnabled
|
|
782
|
+
} else if (isViewMode && rightSideControlsEnabled) {
|
|
783
783
|
// Remove view-mode right-side decorations when no active node
|
|
784
784
|
var _iterator6 = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
785
785
|
_step6;
|
|
@@ -863,7 +863,6 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
863
863
|
var _latestActiveNode13, _latestActiveNode14;
|
|
864
864
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
|
|
865
865
|
}
|
|
866
|
-
var isMenuOpenNew = isMenuOpen;
|
|
867
866
|
var nextMenuTriggerByNode = (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
|
|
868
867
|
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
|
|
869
868
|
var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
|
|
@@ -871,7 +870,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
871
870
|
var mappedRoot = tr.mapping.mapResult((_menuTriggerByNode$ro = menuTriggerByNode.rootPos) !== null && _menuTriggerByNode$ro !== void 0 ? _menuTriggerByNode$ro : menuTriggerByNode.pos, 1);
|
|
872
871
|
if (mapped.deleted || mappedRoot.deleted || !((_newState$doc$nodeAt4 = newState.doc.nodeAt(mapped.pos)) !== null && _newState$doc$nodeAt4 !== void 0 && _newState$doc$nodeAt4.isBlock)) {
|
|
873
872
|
nextMenuTriggerByNode = undefined;
|
|
874
|
-
|
|
873
|
+
isMenuOpen = false;
|
|
875
874
|
} else {
|
|
876
875
|
nextMenuTriggerByNode = _objectSpread(_objectSpread({}, menuTriggerByNode), {}, {
|
|
877
876
|
pos: mapped.pos,
|
|
@@ -880,16 +879,15 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
880
879
|
}
|
|
881
880
|
}
|
|
882
881
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
883
|
-
|
|
882
|
+
isMenuOpen = false;
|
|
884
883
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
885
884
|
var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
|
|
886
|
-
|
|
885
|
+
isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
|
|
887
886
|
}
|
|
888
|
-
var isSelectedViaDragHandleNew;
|
|
889
887
|
if (flags.toolbarFlagsEnabled) {
|
|
890
|
-
|
|
888
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
891
889
|
} else {
|
|
892
|
-
|
|
890
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && flags.toolbarFlagsEnabled && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
893
891
|
}
|
|
894
892
|
return {
|
|
895
893
|
decorations: decorations,
|
|
@@ -897,7 +895,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
897
895
|
activeNode: newActiveNode,
|
|
898
896
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
899
897
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
900
|
-
isMenuOpen:
|
|
898
|
+
isMenuOpen: isMenuOpen,
|
|
901
899
|
menuTriggerBy: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.anchorName) || menuTriggerBy,
|
|
902
900
|
menuTriggerByNode: nextMenuTriggerByNode,
|
|
903
901
|
blockMenuOptions: {
|
|
@@ -913,7 +911,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
913
911
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging,
|
|
914
912
|
multiSelectDnD: multiSelectDnD,
|
|
915
913
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
916
|
-
isSelectedViaDragHandle:
|
|
914
|
+
isSelectedViaDragHandle: isSelectedViaDragHandle
|
|
917
915
|
};
|
|
918
916
|
};
|
|
919
917
|
var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
@@ -988,9 +986,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
988
986
|
var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
|
|
989
987
|
if (isDisabled) {
|
|
990
988
|
var _api$editorViewMode2;
|
|
991
|
-
var remixRightSideEnabled = rightSideControlsEnabled && (0, _fg.fg)('confluence_remix_button_right_side_block_fg');
|
|
992
989
|
// Hide decorations when disabled, except in view mode when right-side controls are enabled
|
|
993
|
-
if (!
|
|
990
|
+
if (!rightSideControlsEnabled || (api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) !== 'view') {
|
|
994
991
|
return;
|
|
995
992
|
}
|
|
996
993
|
}
|
|
@@ -22,7 +22,6 @@ var _blockControls = require("@atlaskit/editor-common/messages/block-controls");
|
|
|
22
22
|
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
23
23
|
var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/core/drag-handle-vertical"));
|
|
24
24
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
25
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
26
25
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
27
26
|
var _pluginKey = require("../pm-plugins/selection-preservation/plugin-key");
|
|
28
27
|
var _collapsedHeading = require("../pm-plugins/utils/collapsed-heading");
|
|
@@ -279,7 +278,7 @@ var BlockControlsSurfaceDragHandle = exports.BlockControlsSurfaceDragHandle = fu
|
|
|
279
278
|
return event.stopPropagation();
|
|
280
279
|
},
|
|
281
280
|
"data-editor-block-ctrl-drag-handle": true,
|
|
282
|
-
"data-blocks-drag-handle":
|
|
281
|
+
"data-blocks-drag-handle": true,
|
|
283
282
|
"data-testid": "block-controls-surface-drag-handle",
|
|
284
283
|
className: (0, _runtime.ax)([dragHandleStyles.root, browser.gecko && dragHandleStyles.firefoxSelection, isLayoutColumn && dragHandleStyles.layoutColumn, dragHandleSelected && interactionState !== 'hasNotHadInteraction' && dragHandleStyles.selected, (handleOptions === null || handleOptions === void 0 ? void 0 : handleOptions.isFocused) && dragHandleStyles.keyboardFocused, dragHandleStyles.scaled])
|
|
285
284
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -212,6 +212,18 @@ var tooltipContainerStyles = (0, _react2.css)({
|
|
|
212
212
|
display: 'block',
|
|
213
213
|
zIndex: 100 // card = 100
|
|
214
214
|
});
|
|
215
|
+
var tooltipContainerStylesStickyHeaderWithMask = (0, _react2.css)({
|
|
216
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
217
|
+
top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
218
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
219
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
220
|
+
top: '0'
|
|
221
|
+
},
|
|
222
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
223
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
224
|
+
top: '0'
|
|
225
|
+
}
|
|
226
|
+
});
|
|
215
227
|
var tooltipContainerStylesImprovedStickyHeaderWithMask = (0, _react2.css)({
|
|
216
228
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
217
229
|
top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
@@ -1029,7 +1041,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1029
1041
|
,
|
|
1030
1042
|
onDrop: handleOnDrop,
|
|
1031
1043
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1032
|
-
"data-blocks-drag-handle":
|
|
1044
|
+
"data-blocks-drag-handle": true,
|
|
1033
1045
|
"data-testid": "block-ctrl-drag-handle",
|
|
1034
1046
|
"aria-label": dragHandleAriaLabel,
|
|
1035
1047
|
onBlur: function onBlur() {
|
|
@@ -1076,7 +1088,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1076
1088
|
as: "span",
|
|
1077
1089
|
testId: "block-ctrl-drag-handle-container"
|
|
1078
1090
|
}, (0, _react2.jsx)("span", {
|
|
1079
|
-
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1091
|
+
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && ((0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMask : tooltipContainerStylesStickyHeaderWithMask), !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1080
1092
|
}, (0, _react2.jsx)(_Tooltip.default, {
|
|
1081
1093
|
content: tooltipContent,
|
|
1082
1094
|
ignoreTooltipPointerEvents: true,
|
|
@@ -73,10 +73,7 @@ var nestedDropZoneStyle = (0, _react2.css)({
|
|
|
73
73
|
right: '4px',
|
|
74
74
|
width: 'unset'
|
|
75
75
|
});
|
|
76
|
-
var
|
|
77
|
-
var getEnableDropZone = function getEnableDropZone() {
|
|
78
|
-
return enableDropZoneNext;
|
|
79
|
-
};
|
|
76
|
+
var ENABLE_DROP_ZONE = ['paragraph', 'mediaSingle', 'heading', 'codeBlock', 'decisionList', 'bulletList', 'orderedList', 'taskList', 'extension', 'blockCard', 'syncBlock'];
|
|
80
77
|
|
|
81
78
|
// This z index is used in container like layout
|
|
82
79
|
var fullHeightStyleAdjustZIndexStyle = (0, _react2.css)({
|
|
@@ -130,7 +127,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
130
127
|
var hoverZoneUpperStyle = (0, _react.useMemo)(function () {
|
|
131
128
|
var heightStyleOffset = "var(--editor-block-controls-drop-indicator-gap, 0)/2";
|
|
132
129
|
var transformOffset = "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, ", 0)");
|
|
133
|
-
var heightStyle = anchorName &&
|
|
130
|
+
var heightStyle = anchorName && ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '') ? (0, _anchorUtils.isAnchorSupported)() ? "calc(anchor-size(".concat(anchorName, " height)/2 + ").concat(heightStyleOffset, ")") : "calc(".concat(((anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchorName)) || 0) / 2, "px + ").concat(heightStyleOffset, ")") : '4px';
|
|
134
131
|
var transform = position === 'upper' ? "translateY(calc(-100% + ".concat(transformOffset, "))") : "translateY(".concat(transformOffset, ")");
|
|
135
132
|
return (0, _react2.css)({
|
|
136
133
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
@@ -155,7 +152,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
155
152
|
var _anchorName = node ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos || -1)) || '' : (0, _decorationsCommon.getNodeAnchor)(node) : '';
|
|
156
153
|
var top = 'unset';
|
|
157
154
|
if (_anchorName) {
|
|
158
|
-
var enabledDropZone =
|
|
155
|
+
var enabledDropZone = ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
|
|
159
156
|
if ((0, _anchorUtils.isAnchorSupported)()) {
|
|
160
157
|
top = enabledDropZone ? "calc(anchor(".concat(_anchorName, " 50%))") : "calc(anchor(".concat(_anchorName, " bottom) - 4px)");
|
|
161
158
|
} else if (anchorRectCache) {
|
|
@@ -90,6 +90,13 @@ var tooltipContainerStyles = (0, _react2.css)({
|
|
|
90
90
|
display: 'block',
|
|
91
91
|
zIndex: 'card'
|
|
92
92
|
});
|
|
93
|
+
var tooltipContainerStylesStickyHeader = (0, _react2.css)({
|
|
94
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
95
|
+
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
96
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
97
|
+
top: _table.tableControlsSpacing
|
|
98
|
+
}
|
|
99
|
+
});
|
|
93
100
|
var tooltipContainerImprovedStylesStickyHeader = (0, _react2.css)({
|
|
94
101
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
95
102
|
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
@@ -113,6 +120,15 @@ var tooltipContainerImprovedStylesStickyHeader = (0, _react2.css)({
|
|
|
113
120
|
}
|
|
114
121
|
});
|
|
115
122
|
|
|
123
|
+
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
124
|
+
var tooltipContainerStylesStickyHeaderWithMarksFix = (0, _react2.css)({
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
126
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-quick-insert-container]):has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
127
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
128
|
+
top: _table.tableControlsSpacing
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
116
132
|
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
117
133
|
var tooltipContainerStylesImprovedStickyHeaderWithMarksFix = (0, _react2.css)({
|
|
118
134
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
@@ -381,7 +397,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
381
397
|
,
|
|
382
398
|
xcss: [containerStaticStyles]
|
|
383
399
|
}, (0, _react2.jsx)("span", {
|
|
384
|
-
css: [tooltipContainerStyles, tooltipContainerImprovedStylesStickyHeader, tooltipContainerStylesImprovedStickyHeaderWithMarksFix]
|
|
400
|
+
css: [tooltipContainerStyles, (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
385
401
|
}, tooltipPressable()));
|
|
386
402
|
};
|
|
387
403
|
var QuickInsertWithVisibility = exports.QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref6) {
|
|
@@ -91,7 +91,6 @@ var useBlockControlsVisibility = exports.useBlockControlsVisibility = function u
|
|
|
91
91
|
isDisplayingDiff = _useSharedPluginState.isDisplayingDiff,
|
|
92
92
|
rightSideControlsEnabled = _useSharedPluginState.rightSideControlsEnabled;
|
|
93
93
|
var isViewMode = editorViewMode === 'view';
|
|
94
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
95
94
|
// Both controls are restricted by side: the drag handle shows on the left half, the Remix button on
|
|
96
95
|
// the right half (and the right margin), matching the midpoint split in handle-mouse-move.
|
|
97
96
|
var shouldRestrictBySide = rightSideControlsEnabled && controlSide !== undefined && !isViewMode;
|
|
@@ -482,7 +482,6 @@ export const blockControlsPlugin = ({
|
|
|
482
482
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
483
483
|
var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
|
|
484
484
|
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
485
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
486
485
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
487
486
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
488
487
|
}
|
|
@@ -3,7 +3,6 @@ import { createElement } from 'react';
|
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
8
7
|
import { ACTIVE_DRAG_HANDLE_ATTR } from '../ui/consts';
|
|
9
8
|
import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
|
|
@@ -80,9 +79,7 @@ export const dragHandleDecoration = ({
|
|
|
80
79
|
const element = document.createElement('span');
|
|
81
80
|
// inline decoration causes focus issues when refocusing Editor into first line
|
|
82
81
|
element.style.display = 'block';
|
|
83
|
-
|
|
84
|
-
element.setAttribute('data-blocks-decorator-widget', 'true');
|
|
85
|
-
}
|
|
82
|
+
element.setAttribute('data-blocks-decorator-widget', 'true');
|
|
86
83
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
87
84
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
88
85
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
|
|
2
|
-
const
|
|
2
|
+
const BLOCK_LEAF_NODES = ['blockCard', 'rule', 'extension', 'syncBlock'];
|
|
3
3
|
const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,10 +13,9 @@ const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
|
13
13
|
*/
|
|
14
14
|
export const findSurroundingNodes = (state, $pos, nodeType) => {
|
|
15
15
|
const depth = $pos.depth;
|
|
16
|
-
const blockLeafNodeList = blockLeafNodeNext;
|
|
17
16
|
|
|
18
17
|
// special cases like hr rule here
|
|
19
|
-
if (
|
|
18
|
+
if (BLOCK_LEAF_NODES.includes(nodeType || '') || $pos.pos === 0) {
|
|
20
19
|
const parent = $pos.node(depth);
|
|
21
20
|
const node = $pos.nodeAfter;
|
|
22
21
|
const index = $pos.index();
|
|
@@ -2,7 +2,6 @@ import { createElement } from 'react';
|
|
|
2
2
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
5
|
import { ACTIVE_QUICK_INSERT_ATTR } from '../ui/consts';
|
|
7
6
|
import { QuickInsertWithVisibility } from '../ui/quick-insert-button';
|
|
8
7
|
import { getMatchingBlockMarks } from './utils/marks';
|
|
@@ -63,9 +62,7 @@ export const quickInsertButtonDecoration = ({
|
|
|
63
62
|
element.style.clear = 'unset';
|
|
64
63
|
element.contentEditable = 'false';
|
|
65
64
|
element.setAttribute('data-blocks-quick-insert-container', 'true');
|
|
66
|
-
|
|
67
|
-
element.setAttribute('data-blocks-quick-insert-button', 'true');
|
|
68
|
-
}
|
|
65
|
+
element.setAttribute('data-blocks-quick-insert-button', 'true');
|
|
69
66
|
element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
|
|
70
67
|
nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(QuickInsertWithVisibility, {
|
|
71
68
|
api,
|
|
@@ -114,7 +114,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
114
114
|
// We shouldn't be firing mouse over transactions when the editor is disabled,
|
|
115
115
|
// except in view mode when right-side controls are enabled (show controls on block hover)
|
|
116
116
|
const rightSideControlsEnabled = (_api$blockControls$sh = api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$s = _api$blockControls2.sharedState.currentState()) === null || _api$blockControls2$s === void 0 ? void 0 : _api$blockControls2$s.rightSideControlsEnabled) !== null && _api$blockControls$sh !== void 0 ? _api$blockControls$sh : false;
|
|
117
|
-
if (editorDisabled && (!isViewMode || !
|
|
117
|
+
if (editorDisabled && (!isViewMode || !rightSideControlsEnabled)) {
|
|
118
118
|
return false;
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -153,7 +153,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
153
153
|
|
|
154
154
|
// When hovering over the right-edge button (rendered in a portal outside the block), resolve the
|
|
155
155
|
// block from the container's anchor so activeNode stays set and the button remains visible.
|
|
156
|
-
if (!rootElement && rightSideControlsEnabled
|
|
156
|
+
if (!rootElement && rightSideControlsEnabled) {
|
|
157
157
|
const rightEdgeContainer = target === null || target === void 0 ? void 0 : target.closest('[data-blocks-right-edge-button-container]');
|
|
158
158
|
if (rightEdgeContainer) {
|
|
159
159
|
const anchor = rightEdgeContainer.getAttribute('data-blocks-right-edge-button-anchor');
|
|
@@ -74,7 +74,7 @@ const classifyRightMarginPosition = (view, event) => {
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Process hover position and set left/right side. Only invoked when right-side controls are
|
|
77
|
-
* enabled
|
|
77
|
+
* enabled; handleMouseMove returns early otherwise.
|
|
78
78
|
*/
|
|
79
79
|
const processHoverSide = (view, api) => {
|
|
80
80
|
var _api$userIntent, _api$userIntent$share, _api$showDiff$sharedS, _api$showDiff, _api$showDiff$sharedS2;
|
|
@@ -178,7 +178,7 @@ export const handleMouseMove = (view, event, rightSideControlsEnabled, api) => {
|
|
|
178
178
|
stopEditing(view);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// Only track hover side when right-side controls are enabled
|
|
181
|
+
// Only track hover side when right-side controls are enabled.
|
|
182
182
|
if (!rightSideControlsEnabled) {
|
|
183
183
|
return false;
|
|
184
184
|
}
|
|
@@ -104,8 +104,6 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
|
|
|
104
104
|
},
|
|
105
105
|
view: editorExperiment('platform_editor_controls', 'variant1') ? view => {
|
|
106
106
|
const editorContentArea = view.dom.closest('.ak-editor-content-area');
|
|
107
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
108
|
-
|
|
109
107
|
let unbindMouseEnter;
|
|
110
108
|
let unbindMouseLeave;
|
|
111
109
|
let unbindDocumentMouseMove;
|
|
@@ -177,7 +177,9 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
177
177
|
activeNode,
|
|
178
178
|
decorations,
|
|
179
179
|
isResizerResizing,
|
|
180
|
-
multiSelectDnD
|
|
180
|
+
multiSelectDnD,
|
|
181
|
+
isMenuOpen,
|
|
182
|
+
isSelectedViaDragHandle
|
|
181
183
|
} = currentState;
|
|
182
184
|
const {
|
|
183
185
|
surfaceNodePositions
|
|
@@ -187,13 +189,11 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
187
189
|
editorWidthLeft,
|
|
188
190
|
editorWidthRight,
|
|
189
191
|
isDragging,
|
|
190
|
-
isMenuOpen,
|
|
191
192
|
menuTriggerBy,
|
|
192
193
|
menuTriggerByNode,
|
|
193
194
|
blockMenuOptions,
|
|
194
195
|
isPMDragging,
|
|
195
|
-
lastDragCancelled
|
|
196
|
-
isSelectedViaDragHandle
|
|
196
|
+
lastDragCancelled
|
|
197
197
|
} = currentState;
|
|
198
198
|
let isActiveNodeDeleted = false;
|
|
199
199
|
const {
|
|
@@ -500,7 +500,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
500
500
|
const old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, spec => spec.type === factory.type);
|
|
501
501
|
decorations = decorations.remove(old);
|
|
502
502
|
}
|
|
503
|
-
if (rightSideControlsEnabled && isViewMode
|
|
503
|
+
if (rightSideControlsEnabled && isViewMode) {
|
|
504
504
|
for (const factory of nodeDecorationRegistry) {
|
|
505
505
|
if (factory.showInViewMode) {
|
|
506
506
|
var _activeNode1, _activeNode10;
|
|
@@ -694,7 +694,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
694
694
|
decorations = decorations.add(newState.doc, [dec]);
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
|
-
} else if (isViewMode && rightSideControlsEnabled
|
|
697
|
+
} else if (isViewMode && rightSideControlsEnabled) {
|
|
698
698
|
// Remove view-mode right-side decorations when no active node
|
|
699
699
|
for (const factory of nodeDecorationRegistry) {
|
|
700
700
|
if (factory.showInViewMode) {
|
|
@@ -765,7 +765,6 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
765
765
|
var _latestActiveNode13, _latestActiveNode14;
|
|
766
766
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !isExperimentEnabled('platform_editor_block_control_migration') && findHandleDec(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
|
|
767
767
|
}
|
|
768
|
-
let isMenuOpenNew = isMenuOpen;
|
|
769
768
|
let nextMenuTriggerByNode = (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
|
|
770
769
|
if (isExperimentEnabled('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
|
|
771
770
|
var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
|
|
@@ -773,7 +772,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
773
772
|
const mappedRoot = tr.mapping.mapResult((_menuTriggerByNode$ro = menuTriggerByNode.rootPos) !== null && _menuTriggerByNode$ro !== void 0 ? _menuTriggerByNode$ro : menuTriggerByNode.pos, 1);
|
|
774
773
|
if (mapped.deleted || mappedRoot.deleted || !((_newState$doc$nodeAt4 = newState.doc.nodeAt(mapped.pos)) !== null && _newState$doc$nodeAt4 !== void 0 && _newState$doc$nodeAt4.isBlock)) {
|
|
775
774
|
nextMenuTriggerByNode = undefined;
|
|
776
|
-
|
|
775
|
+
isMenuOpen = false;
|
|
777
776
|
} else {
|
|
778
777
|
nextMenuTriggerByNode = {
|
|
779
778
|
...menuTriggerByNode,
|
|
@@ -783,16 +782,15 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
783
782
|
}
|
|
784
783
|
}
|
|
785
784
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
786
|
-
|
|
785
|
+
isMenuOpen = false;
|
|
787
786
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
788
787
|
const isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
|
|
789
|
-
|
|
788
|
+
isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
|
|
790
789
|
}
|
|
791
|
-
let isSelectedViaDragHandleNew;
|
|
792
790
|
if (flags.toolbarFlagsEnabled) {
|
|
793
|
-
|
|
791
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
794
792
|
} else {
|
|
795
|
-
|
|
793
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && flags.toolbarFlagsEnabled && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
796
794
|
}
|
|
797
795
|
return {
|
|
798
796
|
decorations,
|
|
@@ -800,7 +798,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
800
798
|
activeNode: newActiveNode,
|
|
801
799
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
802
800
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
803
|
-
isMenuOpen
|
|
801
|
+
isMenuOpen,
|
|
804
802
|
menuTriggerBy: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.anchorName) || menuTriggerBy,
|
|
805
803
|
menuTriggerByNode: nextMenuTriggerByNode,
|
|
806
804
|
blockMenuOptions: {
|
|
@@ -816,7 +814,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
816
814
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging,
|
|
817
815
|
multiSelectDnD,
|
|
818
816
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
819
|
-
isSelectedViaDragHandle
|
|
817
|
+
isSelectedViaDragHandle
|
|
820
818
|
};
|
|
821
819
|
};
|
|
822
820
|
export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true) => {
|
|
@@ -888,9 +886,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
888
886
|
const isDisabled = api === null || api === void 0 ? void 0 : (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 ? void 0 : (_api$editorDisabled$s = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled$s === void 0 ? void 0 : _api$editorDisabled$s.editorDisabled;
|
|
889
887
|
if (isDisabled) {
|
|
890
888
|
var _api$editorViewMode2, _api$editorViewMode2$;
|
|
891
|
-
const remixRightSideEnabled = rightSideControlsEnabled && fg('confluence_remix_button_right_side_block_fg');
|
|
892
889
|
// Hide decorations when disabled, except in view mode when right-side controls are enabled
|
|
893
|
-
if (!
|
|
890
|
+
if (!rightSideControlsEnabled || (api === null || api === void 0 ? void 0 : (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : (_api$editorViewMode2$ = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2$ === void 0 ? void 0 : _api$editorViewMode2$.mode) !== 'view') {
|
|
894
891
|
return;
|
|
895
892
|
}
|
|
896
893
|
}
|