@atlaskit/editor-plugin-block-controls 31.0.2 → 31.0.4
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 +18 -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-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 +4 -5
- package/dist/cjs/pm-plugins/utils/getSelection.js +1 -11
- package/dist/cjs/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/cjs/ui/consts.js +1 -22
- package/dist/cjs/ui/drag-handle.js +1 -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-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 +4 -5
- package/dist/es2019/pm-plugins/utils/getSelection.js +0 -10
- package/dist/es2019/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/es2019/ui/consts.js +0 -37
- package/dist/es2019/ui/drag-handle.js +1 -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-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 +4 -5
- package/dist/esm/pm-plugins/utils/getSelection.js +0 -10
- package/dist/esm/ui/block-controls-surface-drag-handle.js +1 -2
- package/dist/esm/ui/consts.js +0 -21
- package/dist/esm/ui/drag-handle.js +1 -1
- package/dist/esm/ui/visibility-container.js +0 -1
- package/dist/types/pm-plugins/decorations-surface-anchor.d.ts +0 -5
- package/dist/types/pm-plugins/main.d.ts +3 -49
- package/dist/types/pm-plugins/utils/getSelection.d.ts +0 -1
- package/dist/types/ui/consts.d.ts +0 -11
- package/package.json +3 -6
- package/dist/cjs/pm-plugins/vanilla-quick-insert.js +0 -215
- package/dist/es2019/pm-plugins/vanilla-quick-insert.js +0 -215
- package/dist/esm/pm-plugins/vanilla-quick-insert.js +0 -208
- package/dist/types/pm-plugins/vanilla-quick-insert.d.ts +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 31.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c5b599e3bc90a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c5b599e3bc90a) -
|
|
8
|
+
Remove unused internal code and replace loose plugin state return types with PluginState. No
|
|
9
|
+
behaviour change.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 31.0.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`49c506ac95bb6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/49c506ac95bb6) -
|
|
17
|
+
Remove the fully rolled-out `confluence_remix_button_right_side_block_fg` gate; keep right-side
|
|
18
|
+
Remix controls enabled when their existing MAUI experiment and product configuration allow them.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 31.0.2
|
|
4
22
|
|
|
5
23
|
### 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);
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -887,7 +887,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
887
887
|
if (flags.toolbarFlagsEnabled) {
|
|
888
888
|
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
889
889
|
} else {
|
|
890
|
-
isSelectedViaDragHandle =
|
|
890
|
+
isSelectedViaDragHandle = false;
|
|
891
891
|
}
|
|
892
892
|
return {
|
|
893
893
|
decorations: decorations,
|
|
@@ -986,9 +986,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
986
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;
|
|
987
987
|
if (isDisabled) {
|
|
988
988
|
var _api$editorViewMode2;
|
|
989
|
-
var remixRightSideEnabled = rightSideControlsEnabled && (0, _fg.fg)('confluence_remix_button_right_side_block_fg');
|
|
990
989
|
// Hide decorations when disabled, except in view mode when right-side controls are enabled
|
|
991
|
-
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') {
|
|
992
991
|
return;
|
|
993
992
|
}
|
|
994
993
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setCursorPositionAtMovedNode = exports.selectNode = exports.rootTaskListDepth = exports.rootListDepth = exports.newGetSelection = exports.
|
|
6
|
+
exports.setCursorPositionAtMovedNode = exports.selectNode = exports.rootTaskListDepth = exports.rootListDepth = exports.newGetSelection = exports.isHandleCorrelatedToSelection = exports.getSelection = exports.getInlineNodePos = void 0;
|
|
7
7
|
var _nodeSelection = require("@atlaskit/editor-common/node-selection");
|
|
8
8
|
var _selection2 = require("@atlaskit/editor-common/selection");
|
|
9
9
|
var _selection3 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
@@ -34,16 +34,6 @@ var getInlineNodePos = exports.getInlineNodePos = function getInlineNodePos(doc,
|
|
|
34
34
|
inlineNodeEndPos: inlineNodeEndPos
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
var isNodeWithCodeBlock = exports.isNodeWithCodeBlock = function isNodeWithCodeBlock(tr, start, nodeSize) {
|
|
38
|
-
var $startPos = tr.doc.resolve(start);
|
|
39
|
-
var hasCodeBlock = false;
|
|
40
|
-
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n) {
|
|
41
|
-
if (['codeBlock'].includes(n.type.name)) {
|
|
42
|
-
hasCodeBlock = true;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return hasCodeBlock;
|
|
46
|
-
};
|
|
47
37
|
|
|
48
38
|
/**
|
|
49
39
|
* Gets the appropriate selection for the node at the given start position.
|
|
@@ -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", {
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -4,8 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
|
+
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dragHandleGap = exports.STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER = exports.STICKY_CONTROLS_TOP_MARGIN = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = exports.DRAG_HANDLE_SYNCED_BLOCK_GAP = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_CONTROLS_SURFACE_SELECTOR = exports.ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME = exports.ACTIVE_QUICK_INSERT_ATTR = exports.ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME = exports.ACTIVE_DRAG_HANDLE_ATTR = void 0;
|
|
9
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
9
|
var _dragHandle = require("@atlaskit/editor-common/styles/drag-handle");
|
|
11
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -14,7 +13,6 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
|
|
|
14
13
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
15
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
15
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
17
|
-
var _dropTargetMarginMap;
|
|
18
16
|
var ACTIVE_DRAG_HANDLE_ATTR = exports.ACTIVE_DRAG_HANDLE_ATTR = 'data-active-drag-handle';
|
|
19
17
|
var ACTIVE_QUICK_INSERT_ATTR = exports.ACTIVE_QUICK_INSERT_ATTR = 'data-active-quick-insert';
|
|
20
18
|
var BLOCK_CONTROLS_SURFACE_SELECTOR = exports.BLOCK_CONTROLS_SURFACE_SELECTOR = '[data-editor-block-controls-surface]';
|
|
@@ -165,25 +163,6 @@ var topPositionAdjustment = exports.topPositionAdjustment = function topPosition
|
|
|
165
163
|
return 0;
|
|
166
164
|
}
|
|
167
165
|
};
|
|
168
|
-
var dropTargetMarginMap = exports.dropTargetMarginMap = (_dropTargetMarginMap = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_dropTargetMarginMap, -24, "var(--ds-space-negative-300, -24px)"), -20, "var(--ds-space-negative-250, -20px)"), -16, "var(--ds-space-negative-200, -16px)"), -12, "var(--ds-space-negative-150, -12px)"), -8, "var(--ds-space-negative-100, -8px)"), -6, "var(--ds-space-negative-075, -6px)"), -4, "var(--ds-space-negative-050, -4px)"), -2, "var(--ds-space-negative-025, -2px)"), 0, "var(--ds-space-0, 0px)"), 2, "var(--ds-space-025, 2px)"), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_dropTargetMarginMap, 4, "var(--ds-space-050, 4px)"), 6, "var(--ds-space-075, 6px)"), 8, "var(--ds-space-100, 8px)"), 12, "var(--ds-space-150, 12px)"), 16, "var(--ds-space-200, 16px)"), 20, "var(--ds-space-250, 20px)"), 24, "var(--ds-space-300, 24px)"));
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* This document serves as a quick reference map for correlating various space matches
|
|
172
|
-
* to the table provided above.
|
|
173
|
-
* For instance, the number 1 will correspond to \{0: token('space.0', '0')\}.
|
|
174
|
-
*/
|
|
175
|
-
var spaceLookupMap = exports.spaceLookupMap = Object.fromEntries(
|
|
176
|
-
// 49 = -24 -> 0 -> 24 totaling 49 entries.
|
|
177
|
-
Array.from({
|
|
178
|
-
length: 49
|
|
179
|
-
}, function (_, index) {
|
|
180
|
-
var currKeyValue = index - 24;
|
|
181
|
-
var keyValues = Object.keys(dropTargetMarginMap).map(Number);
|
|
182
|
-
var value = keyValues.reduce(function (acc, curr) {
|
|
183
|
-
return Math.abs(currKeyValue - curr) < Math.abs(currKeyValue - acc) ? curr : acc;
|
|
184
|
-
}, 1000);
|
|
185
|
-
return [currKeyValue, dropTargetMarginMap[value]];
|
|
186
|
-
}));
|
|
187
166
|
var spacingBetweenNodesForPreview = exports.spacingBetweenNodesForPreview = {
|
|
188
167
|
paragraph: {
|
|
189
168
|
top: '0.75rem',
|
|
@@ -1041,7 +1041,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1041
1041
|
,
|
|
1042
1042
|
onDrop: handleOnDrop,
|
|
1043
1043
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1044
|
-
"data-blocks-drag-handle":
|
|
1044
|
+
"data-blocks-drag-handle": true,
|
|
1045
1045
|
"data-testid": "block-ctrl-drag-handle",
|
|
1046
1046
|
"aria-label": dragHandleAriaLabel,
|
|
1047
1047
|
onBlur: function onBlur() {
|
|
@@ -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);
|
|
@@ -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;
|
|
@@ -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) {
|
|
@@ -790,7 +790,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
790
790
|
if (flags.toolbarFlagsEnabled) {
|
|
791
791
|
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
792
792
|
} else {
|
|
793
|
-
isSelectedViaDragHandle =
|
|
793
|
+
isSelectedViaDragHandle = false;
|
|
794
794
|
}
|
|
795
795
|
return {
|
|
796
796
|
decorations,
|
|
@@ -886,9 +886,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
886
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;
|
|
887
887
|
if (isDisabled) {
|
|
888
888
|
var _api$editorViewMode2, _api$editorViewMode2$;
|
|
889
|
-
const remixRightSideEnabled = rightSideControlsEnabled && fg('confluence_remix_button_right_side_block_fg');
|
|
890
889
|
// Hide decorations when disabled, except in view mode when right-side controls are enabled
|
|
891
|
-
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') {
|
|
892
891
|
return;
|
|
893
892
|
}
|
|
894
893
|
}
|
|
@@ -28,16 +28,6 @@ export const getInlineNodePos = (doc, start, nodeSize) => {
|
|
|
28
28
|
inlineNodeEndPos
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export const isNodeWithCodeBlock = (tr, start, nodeSize) => {
|
|
32
|
-
const $startPos = tr.doc.resolve(start);
|
|
33
|
-
let hasCodeBlock = false;
|
|
34
|
-
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, n => {
|
|
35
|
-
if (['codeBlock'].includes(n.type.name)) {
|
|
36
|
-
hasCodeBlock = true;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return hasCodeBlock;
|
|
40
|
-
};
|
|
41
31
|
|
|
42
32
|
/**
|
|
43
33
|
* Gets the appropriate selection for the node at the given start position.
|
|
@@ -16,7 +16,6 @@ import { messages as blockControlsMessages } from '@atlaskit/editor-common/messa
|
|
|
16
16
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
17
17
|
import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
|
|
18
18
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
19
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
20
19
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
21
20
|
import { selectionPreservationPluginKey } from '../pm-plugins/selection-preservation/plugin-key';
|
|
22
21
|
import { prepareCollapsedHeadingSelection } from '../pm-plugins/utils/collapsed-heading';
|
|
@@ -265,7 +264,7 @@ export const BlockControlsSurfaceDragHandle = ({
|
|
|
265
264
|
,
|
|
266
265
|
onDrop: event => event.stopPropagation(),
|
|
267
266
|
"data-editor-block-ctrl-drag-handle": true,
|
|
268
|
-
"data-blocks-drag-handle":
|
|
267
|
+
"data-blocks-drag-handle": true,
|
|
269
268
|
"data-testid": "block-controls-surface-drag-handle",
|
|
270
269
|
className: 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])
|
|
271
270
|
}, /*#__PURE__*/React.createElement("span", {
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -153,43 +153,6 @@ export const topPositionAdjustment = (nodeType, layout) => {
|
|
|
153
153
|
return 0;
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
export const dropTargetMarginMap = {
|
|
157
|
-
[-24]: "var(--ds-space-negative-300, -24px)",
|
|
158
|
-
[-20]: "var(--ds-space-negative-250, -20px)",
|
|
159
|
-
[-16]: "var(--ds-space-negative-200, -16px)",
|
|
160
|
-
[-12]: "var(--ds-space-negative-150, -12px)",
|
|
161
|
-
[-8]: "var(--ds-space-negative-100, -8px)",
|
|
162
|
-
[-6]: "var(--ds-space-negative-075, -6px)",
|
|
163
|
-
[-4]: "var(--ds-space-negative-050, -4px)",
|
|
164
|
-
[-2]: "var(--ds-space-negative-025, -2px)",
|
|
165
|
-
0: "var(--ds-space-0, 0px)",
|
|
166
|
-
2: "var(--ds-space-025, 2px)",
|
|
167
|
-
4: "var(--ds-space-050, 4px)",
|
|
168
|
-
6: "var(--ds-space-075, 6px)",
|
|
169
|
-
8: "var(--ds-space-100, 8px)",
|
|
170
|
-
12: "var(--ds-space-150, 12px)",
|
|
171
|
-
16: "var(--ds-space-200, 16px)",
|
|
172
|
-
20: "var(--ds-space-250, 20px)",
|
|
173
|
-
24: "var(--ds-space-300, 24px)"
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* This document serves as a quick reference map for correlating various space matches
|
|
178
|
-
* to the table provided above.
|
|
179
|
-
* For instance, the number 1 will correspond to \{0: token('space.0', '0')\}.
|
|
180
|
-
*/
|
|
181
|
-
export const spaceLookupMap = Object.fromEntries(
|
|
182
|
-
// 49 = -24 -> 0 -> 24 totaling 49 entries.
|
|
183
|
-
Array.from({
|
|
184
|
-
length: 49
|
|
185
|
-
}, (_, index) => {
|
|
186
|
-
const currKeyValue = index - 24;
|
|
187
|
-
const keyValues = Object.keys(dropTargetMarginMap).map(Number);
|
|
188
|
-
const value = keyValues.reduce((acc, curr) => {
|
|
189
|
-
return Math.abs(currKeyValue - curr) < Math.abs(currKeyValue - acc) ? curr : acc;
|
|
190
|
-
}, 1000);
|
|
191
|
-
return [currKeyValue, dropTargetMarginMap[value]];
|
|
192
|
-
}));
|
|
193
156
|
export const spacingBetweenNodesForPreview = {
|
|
194
157
|
paragraph: {
|
|
195
158
|
top: '0.75rem',
|
|
@@ -1025,7 +1025,7 @@ export const DragHandle = ({
|
|
|
1025
1025
|
,
|
|
1026
1026
|
onDrop: handleOnDrop,
|
|
1027
1027
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1028
|
-
"data-blocks-drag-handle":
|
|
1028
|
+
"data-blocks-drag-handle": true,
|
|
1029
1029
|
"data-testid": "block-ctrl-drag-handle",
|
|
1030
1030
|
"aria-label": dragHandleAriaLabel,
|
|
1031
1031
|
onBlur: () => {
|
|
@@ -81,7 +81,6 @@ export const useBlockControlsVisibility = ({
|
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
83
|
const isViewMode = editorViewMode === 'view';
|
|
84
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
85
84
|
// Both controls are restricted by side: the drag handle shows on the left half, the Remix button on
|
|
86
85
|
// the right half (and the right margin), matching the midpoint split in handle-mouse-move.
|
|
87
86
|
const shouldRestrictBySide = rightSideControlsEnabled && controlSide !== undefined && !isViewMode;
|
|
@@ -485,7 +485,6 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
485
485
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
486
486
|
var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
|
|
487
487
|
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
488
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
489
488
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
490
489
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
491
490
|
}
|
|
@@ -6,7 +6,6 @@ import { createElement } from 'react';
|
|
|
6
6
|
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
10
|
import { ACTIVE_DRAG_HANDLE_ATTR } from '../ui/consts';
|
|
12
11
|
import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
|
|
@@ -88,9 +87,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
88
87
|
var element = document.createElement('span');
|
|
89
88
|
// inline decoration causes focus issues when refocusing Editor into first line
|
|
90
89
|
element.style.display = 'block';
|
|
91
|
-
|
|
92
|
-
element.setAttribute('data-blocks-decorator-widget', 'true');
|
|
93
|
-
}
|
|
90
|
+
element.setAttribute('data-blocks-decorator-widget', 'true');
|
|
94
91
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
95
92
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
96
93
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -3,7 +3,6 @@ import { createElement } from 'react';
|
|
|
3
3
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
4
|
import { v4 as uuid } from 'uuid';
|
|
5
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
6
|
import { ACTIVE_QUICK_INSERT_ATTR } from '../ui/consts';
|
|
8
7
|
import { QuickInsertWithVisibility } from '../ui/quick-insert-button';
|
|
9
8
|
import { getMatchingBlockMarks } from './utils/marks';
|
|
@@ -69,9 +68,7 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_r
|
|
|
69
68
|
element.style.clear = 'unset';
|
|
70
69
|
element.contentEditable = 'false';
|
|
71
70
|
element.setAttribute('data-blocks-quick-insert-container', 'true');
|
|
72
|
-
|
|
73
|
-
element.setAttribute('data-blocks-quick-insert-button', 'true');
|
|
74
|
-
}
|
|
71
|
+
element.setAttribute('data-blocks-quick-insert-button', 'true');
|
|
75
72
|
element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
|
|
76
73
|
nodeViewPortalProviderAPI.render(function () {
|
|
77
74
|
return /*#__PURE__*/createElement(QuickInsertWithVisibility, {
|
|
@@ -115,7 +115,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
115
115
|
// We shouldn't be firing mouse over transactions when the editor is disabled,
|
|
116
116
|
// except in view mode when right-side controls are enabled (show controls on block hover)
|
|
117
117
|
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;
|
|
118
|
-
if (editorDisabled && (!isViewMode || !
|
|
118
|
+
if (editorDisabled && (!isViewMode || !rightSideControlsEnabled)) {
|
|
119
119
|
return false;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -154,7 +154,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
154
154
|
|
|
155
155
|
// When hovering over the right-edge button (rendered in a portal outside the block), resolve the
|
|
156
156
|
// block from the container's anchor so activeNode stays set and the button remains visible.
|
|
157
|
-
if (!rootElement && rightSideControlsEnabled
|
|
157
|
+
if (!rootElement && rightSideControlsEnabled) {
|
|
158
158
|
var rightEdgeContainer = target === null || target === void 0 ? void 0 : target.closest('[data-blocks-right-edge-button-container]');
|
|
159
159
|
if (rightEdgeContainer) {
|
|
160
160
|
var anchor = rightEdgeContainer.getAttribute('data-blocks-right-edge-button-anchor');
|
|
@@ -92,7 +92,7 @@ var classifyRightMarginPosition = function classifyRightMarginPosition(view, eve
|
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* Process hover position and set left/right side. Only invoked when right-side controls are
|
|
95
|
-
* enabled
|
|
95
|
+
* enabled; handleMouseMove returns early otherwise.
|
|
96
96
|
*/
|
|
97
97
|
var processHoverSide = function processHoverSide(view, api) {
|
|
98
98
|
var _api$userIntent, _api$showDiff$sharedS, _api$showDiff;
|
|
@@ -195,7 +195,7 @@ export var handleMouseMove = function handleMouseMove(view, event, rightSideCont
|
|
|
195
195
|
stopEditing(view);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
// Only track hover side when right-side controls are enabled
|
|
198
|
+
// Only track hover side when right-side controls are enabled.
|
|
199
199
|
if (!rightSideControlsEnabled) {
|
|
200
200
|
return false;
|
|
201
201
|
}
|
|
@@ -112,8 +112,6 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
|
|
|
112
112
|
},
|
|
113
113
|
view: editorExperiment('platform_editor_controls', 'variant1') ? function (view) {
|
|
114
114
|
var editorContentArea = view.dom.closest('.ak-editor-content-area');
|
|
115
|
-
// rightSideControlsEnabled is the single source of truth (confluence_remix_button_right_side_block_fg from preset)
|
|
116
|
-
|
|
117
115
|
var unbindMouseEnter;
|
|
118
116
|
var unbindMouseLeave;
|
|
119
117
|
var unbindDocumentMouseMove;
|