@atlaskit/editor-plugin-block-controls 13.4.2 → 13.4.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 +8 -0
- package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +31 -38
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +6 -11
- package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +31 -38
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +6 -11
- package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +31 -38
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +6 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 13.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e4a610e4c20f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4a610e4c20f3) -
|
|
8
|
+
Clean up experiment `remix_button_right_margin_hover`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 13.4.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.handleMouseMove = exports.handleMouseLeave = exports.handleMouseEnter = void 0;
|
|
7
7
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
8
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
8
|
var _handleMouseOver = require("../handle-mouse-over");
|
|
10
9
|
var _commands = require("./commands");
|
|
11
10
|
var _constants = require("./constants");
|
|
@@ -126,50 +125,44 @@ var processHoverSide = function processHoverSide(view, api) {
|
|
|
126
125
|
}
|
|
127
126
|
return;
|
|
128
127
|
}
|
|
128
|
+
var closestBlock = target === null || target === void 0 ? void 0 : target.closest(BLOCK_SELECTORS);
|
|
129
|
+
var blockElement = closestBlock instanceof HTMLElement ? closestBlock : null;
|
|
129
130
|
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
target: marginZone.block
|
|
143
|
-
}, api);
|
|
144
|
-
// mouseenter doesn't fire over the click overlay, so clear isMouseOut here to re-show.
|
|
145
|
-
if (state !== null && state !== void 0 && state.isMouseOut) {
|
|
146
|
-
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_maui_remix_button_hover_corridor', 'isEnabled', true)) {
|
|
147
|
-
(0, _commands.mouseEnter)(view, 'right');
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
(0, _commands.mouseEnter)(view);
|
|
151
|
-
}
|
|
152
|
-
if ((state === null || state === void 0 ? void 0 : state.hoverSide) !== 'right') {
|
|
153
|
-
(0, _commands.setHoverSide)(view, 'right');
|
|
131
|
+
// Not over a block: the cursor may be in the right margin beside content.
|
|
132
|
+
var marginZone = blockElement ? null : classifyRightMarginPosition(view, event);
|
|
133
|
+
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'active' && api) {
|
|
134
|
+
// handleMouseOver only reads event.target, so a target-only stand-in is enough here.
|
|
135
|
+
(0, _handleMouseOver.handleMouseOver)(view, {
|
|
136
|
+
target: marginZone.block
|
|
137
|
+
}, api);
|
|
138
|
+
// mouseenter doesn't fire over the click overlay, so clear isMouseOut here to re-show.
|
|
139
|
+
if (state !== null && state !== void 0 && state.isMouseOut) {
|
|
140
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_maui_remix_button_hover_corridor', 'isEnabled', true)) {
|
|
141
|
+
(0, _commands.mouseEnter)(view, 'right');
|
|
142
|
+
return;
|
|
154
143
|
}
|
|
155
|
-
|
|
144
|
+
(0, _commands.mouseEnter)(view);
|
|
156
145
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// The corridor experiment keeps controls visible when the pointer is still over a real block;
|
|
160
|
-
// only empty margin remains reserved for Rovo in that case.
|
|
161
|
-
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'gap' || event.clientX > getRightMarginBoundary(view) && (!blockElement || !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_maui_remix_button_hover_corridor', 'isEnabled', true))) {
|
|
162
|
-
if (!(state !== null && state !== void 0 && state.isMouseOut)) {
|
|
163
|
-
(0, _commands.clearHoverSide)(view);
|
|
164
|
-
(0, _commands.mouseLeave)(view);
|
|
165
|
-
}
|
|
166
|
-
return;
|
|
146
|
+
if ((state === null || state === void 0 ? void 0 : state.hoverSide) !== 'right') {
|
|
147
|
+
(0, _commands.setHoverSide)(view, 'right');
|
|
167
148
|
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
168
151
|
|
|
169
|
-
|
|
170
|
-
|
|
152
|
+
// In the Rovo gap, dismiss the controls so the button doesn't linger over the Rovo button.
|
|
153
|
+
// The corridor experiment keeps controls visible when the pointer is still over a real block;
|
|
154
|
+
// only empty margin remains reserved for Rovo in that case.
|
|
155
|
+
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'gap' || event.clientX > getRightMarginBoundary(view) && (!blockElement || !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_maui_remix_button_hover_corridor', 'isEnabled', true))) {
|
|
156
|
+
if (!(state !== null && state !== void 0 && state.isMouseOut)) {
|
|
157
|
+
(0, _commands.clearHoverSide)(view);
|
|
158
|
+
(0, _commands.mouseLeave)(view);
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
171
161
|
}
|
|
172
162
|
|
|
163
|
+
// Over a block: fall through to the midpoint split so the left half keeps the drag handle and
|
|
164
|
+
// the right half shows the Remix button.
|
|
165
|
+
|
|
173
166
|
// Pick the side from the content midpoint, keeping the original left/right halves.
|
|
174
167
|
var _editorContentArea$ge = editorContentArea.getBoundingClientRect(),
|
|
175
168
|
left = _editorContentArea$ge.left,
|
|
@@ -113,28 +113,24 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
113
113
|
x: 0,
|
|
114
114
|
y: 0
|
|
115
115
|
};
|
|
116
|
-
|
|
117
|
-
// The active right margin only counts as "still hovering" when our experiment is on;
|
|
118
|
-
// otherwise leaving the content area (e.g. exiting left) must dismiss as on master.
|
|
119
|
-
var marginHoverEnabled = (0, _experiments.editorExperiment)('remix_button_right_margin_hover', true);
|
|
120
116
|
var scheduleMouseLeave = function scheduleMouseLeave(event) {
|
|
121
117
|
if (mouseLeaveTimeoutId) {
|
|
122
118
|
clearTimeout(mouseLeaveTimeoutId);
|
|
123
119
|
mouseLeaveTimeoutId = null;
|
|
124
120
|
}
|
|
125
121
|
|
|
126
|
-
// Keep controls visible when moving to block controls
|
|
127
|
-
// the
|
|
128
|
-
if (rightSideControlsEnabled && (isMovingToBlockControlsArea(event.relatedTarget) ||
|
|
122
|
+
// Keep controls visible when moving to block controls or the active right margin
|
|
123
|
+
// (the Rovo gap is excluded so controls still clear there).
|
|
124
|
+
if (rightSideControlsEnabled && (isMovingToBlockControlsArea(event.relatedTarget) || isOverActiveClickArea(event.relatedTarget, event.clientX))) {
|
|
129
125
|
return;
|
|
130
126
|
}
|
|
131
127
|
mouseLeaveTimeoutId = setTimeout(function () {
|
|
132
128
|
mouseLeaveTimeoutId = null;
|
|
133
129
|
// Re-check after the debounce: keep controls if the cursor landed on block controls
|
|
134
|
-
//
|
|
130
|
+
// or the active right margin.
|
|
135
131
|
if (rightSideControlsEnabled && typeof document !== 'undefined') {
|
|
136
132
|
var el = document.elementFromPoint(lastMousePosition.x, lastMousePosition.y);
|
|
137
|
-
if (el && (isMovingToBlockControlsArea(el) ||
|
|
133
|
+
if (el && (isMovingToBlockControlsArea(el) || isOverActiveClickArea(el, lastMousePosition.x))) {
|
|
138
134
|
return;
|
|
139
135
|
}
|
|
140
136
|
}
|
|
@@ -157,8 +153,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
157
153
|
y: event.clientY
|
|
158
154
|
};
|
|
159
155
|
// Catches block controls in portals that handleDOMEvents.mousemove misses.
|
|
160
|
-
|
|
161
|
-
var overClickArea = marginHoverEnabled && event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
156
|
+
var overClickArea = event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
162
157
|
if (editorContentArea.contains(event.target) || isMovingToBlockControlsArea(event.target) || overClickArea) {
|
|
163
158
|
(0, _handleMouseMove.handleMouseMove)(view, event, rightSideControlsEnabled, api);
|
|
164
159
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
2
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
2
|
import { handleMouseOver } from '../handle-mouse-over';
|
|
4
3
|
import { clearHoverSide, mouseEnter, mouseLeave, setHoverSide, stopEditing } from './commands';
|
|
5
4
|
import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
|
|
@@ -107,50 +106,44 @@ const processHoverSide = (view, api) => {
|
|
|
107
106
|
}
|
|
108
107
|
return;
|
|
109
108
|
}
|
|
109
|
+
const closestBlock = target === null || target === void 0 ? void 0 : target.closest(BLOCK_SELECTORS);
|
|
110
|
+
const blockElement = closestBlock instanceof HTMLElement ? closestBlock : null;
|
|
110
111
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
target: marginZone.block
|
|
124
|
-
}, api);
|
|
125
|
-
// mouseenter doesn't fire over the click overlay, so clear isMouseOut here to re-show.
|
|
126
|
-
if (state !== null && state !== void 0 && state.isMouseOut) {
|
|
127
|
-
if (expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true)) {
|
|
128
|
-
mouseEnter(view, 'right');
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
mouseEnter(view);
|
|
132
|
-
}
|
|
133
|
-
if ((state === null || state === void 0 ? void 0 : state.hoverSide) !== 'right') {
|
|
134
|
-
setHoverSide(view, 'right');
|
|
112
|
+
// Not over a block: the cursor may be in the right margin beside content.
|
|
113
|
+
const marginZone = blockElement ? null : classifyRightMarginPosition(view, event);
|
|
114
|
+
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'active' && api) {
|
|
115
|
+
// handleMouseOver only reads event.target, so a target-only stand-in is enough here.
|
|
116
|
+
handleMouseOver(view, {
|
|
117
|
+
target: marginZone.block
|
|
118
|
+
}, api);
|
|
119
|
+
// mouseenter doesn't fire over the click overlay, so clear isMouseOut here to re-show.
|
|
120
|
+
if (state !== null && state !== void 0 && state.isMouseOut) {
|
|
121
|
+
if (expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true)) {
|
|
122
|
+
mouseEnter(view, 'right');
|
|
123
|
+
return;
|
|
135
124
|
}
|
|
136
|
-
|
|
125
|
+
mouseEnter(view);
|
|
137
126
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// The corridor experiment keeps controls visible when the pointer is still over a real block;
|
|
141
|
-
// only empty margin remains reserved for Rovo in that case.
|
|
142
|
-
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'gap' || event.clientX > getRightMarginBoundary(view) && (!blockElement || !expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true))) {
|
|
143
|
-
if (!(state !== null && state !== void 0 && state.isMouseOut)) {
|
|
144
|
-
clearHoverSide(view);
|
|
145
|
-
mouseLeave(view);
|
|
146
|
-
}
|
|
147
|
-
return;
|
|
127
|
+
if ((state === null || state === void 0 ? void 0 : state.hoverSide) !== 'right') {
|
|
128
|
+
setHoverSide(view, 'right');
|
|
148
129
|
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
149
132
|
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
// In the Rovo gap, dismiss the controls so the button doesn't linger over the Rovo button.
|
|
134
|
+
// The corridor experiment keeps controls visible when the pointer is still over a real block;
|
|
135
|
+
// only empty margin remains reserved for Rovo in that case.
|
|
136
|
+
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'gap' || event.clientX > getRightMarginBoundary(view) && (!blockElement || !expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true))) {
|
|
137
|
+
if (!(state !== null && state !== void 0 && state.isMouseOut)) {
|
|
138
|
+
clearHoverSide(view);
|
|
139
|
+
mouseLeave(view);
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
152
142
|
}
|
|
153
143
|
|
|
144
|
+
// Over a block: fall through to the midpoint split so the left half keeps the drag handle and
|
|
145
|
+
// the right half shows the Remix button.
|
|
146
|
+
|
|
154
147
|
// Pick the side from the content midpoint, keeping the original left/right halves.
|
|
155
148
|
const {
|
|
156
149
|
left,
|
|
@@ -101,28 +101,24 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
|
|
|
101
101
|
x: 0,
|
|
102
102
|
y: 0
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
// The active right margin only counts as "still hovering" when our experiment is on;
|
|
106
|
-
// otherwise leaving the content area (e.g. exiting left) must dismiss as on master.
|
|
107
|
-
const marginHoverEnabled = editorExperiment('remix_button_right_margin_hover', true);
|
|
108
104
|
const scheduleMouseLeave = event => {
|
|
109
105
|
if (mouseLeaveTimeoutId) {
|
|
110
106
|
clearTimeout(mouseLeaveTimeoutId);
|
|
111
107
|
mouseLeaveTimeoutId = null;
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
// Keep controls visible when moving to block controls
|
|
115
|
-
// the
|
|
116
|
-
if (rightSideControlsEnabled && (isMovingToBlockControlsArea(event.relatedTarget) ||
|
|
110
|
+
// Keep controls visible when moving to block controls or the active right margin
|
|
111
|
+
// (the Rovo gap is excluded so controls still clear there).
|
|
112
|
+
if (rightSideControlsEnabled && (isMovingToBlockControlsArea(event.relatedTarget) || isOverActiveClickArea(event.relatedTarget, event.clientX))) {
|
|
117
113
|
return;
|
|
118
114
|
}
|
|
119
115
|
mouseLeaveTimeoutId = setTimeout(() => {
|
|
120
116
|
mouseLeaveTimeoutId = null;
|
|
121
117
|
// Re-check after the debounce: keep controls if the cursor landed on block controls
|
|
122
|
-
//
|
|
118
|
+
// or the active right margin.
|
|
123
119
|
if (rightSideControlsEnabled && typeof document !== 'undefined') {
|
|
124
120
|
const el = document.elementFromPoint(lastMousePosition.x, lastMousePosition.y);
|
|
125
|
-
if (el && (isMovingToBlockControlsArea(el) ||
|
|
121
|
+
if (el && (isMovingToBlockControlsArea(el) || isOverActiveClickArea(el, lastMousePosition.x))) {
|
|
126
122
|
return;
|
|
127
123
|
}
|
|
128
124
|
}
|
|
@@ -145,8 +141,7 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
|
|
|
145
141
|
y: event.clientY
|
|
146
142
|
};
|
|
147
143
|
// Catches block controls in portals that handleDOMEvents.mousemove misses.
|
|
148
|
-
|
|
149
|
-
const overClickArea = marginHoverEnabled && event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
144
|
+
const overClickArea = event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
150
145
|
if (editorContentArea.contains(event.target) || isMovingToBlockControlsArea(event.target) || overClickArea) {
|
|
151
146
|
handleMouseMove(view, event, rightSideControlsEnabled, api);
|
|
152
147
|
}
|
|
@@ -2,7 +2,6 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
4
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
import { handleMouseOver } from '../handle-mouse-over';
|
|
7
6
|
import { clearHoverSide, mouseEnter, mouseLeave, setHoverSide, stopEditing } from './commands';
|
|
8
7
|
import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
|
|
@@ -121,50 +120,44 @@ var processHoverSide = function processHoverSide(view, api) {
|
|
|
121
120
|
}
|
|
122
121
|
return;
|
|
123
122
|
}
|
|
123
|
+
var closestBlock = target === null || target === void 0 ? void 0 : target.closest(BLOCK_SELECTORS);
|
|
124
|
+
var blockElement = closestBlock instanceof HTMLElement ? closestBlock : null;
|
|
124
125
|
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
target: marginZone.block
|
|
138
|
-
}, api);
|
|
139
|
-
// mouseenter doesn't fire over the click overlay, so clear isMouseOut here to re-show.
|
|
140
|
-
if (state !== null && state !== void 0 && state.isMouseOut) {
|
|
141
|
-
if (expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true)) {
|
|
142
|
-
mouseEnter(view, 'right');
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
mouseEnter(view);
|
|
146
|
-
}
|
|
147
|
-
if ((state === null || state === void 0 ? void 0 : state.hoverSide) !== 'right') {
|
|
148
|
-
setHoverSide(view, 'right');
|
|
126
|
+
// Not over a block: the cursor may be in the right margin beside content.
|
|
127
|
+
var marginZone = blockElement ? null : classifyRightMarginPosition(view, event);
|
|
128
|
+
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'active' && api) {
|
|
129
|
+
// handleMouseOver only reads event.target, so a target-only stand-in is enough here.
|
|
130
|
+
handleMouseOver(view, {
|
|
131
|
+
target: marginZone.block
|
|
132
|
+
}, api);
|
|
133
|
+
// mouseenter doesn't fire over the click overlay, so clear isMouseOut here to re-show.
|
|
134
|
+
if (state !== null && state !== void 0 && state.isMouseOut) {
|
|
135
|
+
if (expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true)) {
|
|
136
|
+
mouseEnter(view, 'right');
|
|
137
|
+
return;
|
|
149
138
|
}
|
|
150
|
-
|
|
139
|
+
mouseEnter(view);
|
|
151
140
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// The corridor experiment keeps controls visible when the pointer is still over a real block;
|
|
155
|
-
// only empty margin remains reserved for Rovo in that case.
|
|
156
|
-
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'gap' || event.clientX > getRightMarginBoundary(view) && (!blockElement || !expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true))) {
|
|
157
|
-
if (!(state !== null && state !== void 0 && state.isMouseOut)) {
|
|
158
|
-
clearHoverSide(view);
|
|
159
|
-
mouseLeave(view);
|
|
160
|
-
}
|
|
161
|
-
return;
|
|
141
|
+
if ((state === null || state === void 0 ? void 0 : state.hoverSide) !== 'right') {
|
|
142
|
+
setHoverSide(view, 'right');
|
|
162
143
|
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
163
146
|
|
|
164
|
-
|
|
165
|
-
|
|
147
|
+
// In the Rovo gap, dismiss the controls so the button doesn't linger over the Rovo button.
|
|
148
|
+
// The corridor experiment keeps controls visible when the pointer is still over a real block;
|
|
149
|
+
// only empty margin remains reserved for Rovo in that case.
|
|
150
|
+
if ((marginZone === null || marginZone === void 0 ? void 0 : marginZone.type) === 'gap' || event.clientX > getRightMarginBoundary(view) && (!blockElement || !expValEqualsNoExposure('cc_maui_remix_button_hover_corridor', 'isEnabled', true))) {
|
|
151
|
+
if (!(state !== null && state !== void 0 && state.isMouseOut)) {
|
|
152
|
+
clearHoverSide(view);
|
|
153
|
+
mouseLeave(view);
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
166
156
|
}
|
|
167
157
|
|
|
158
|
+
// Over a block: fall through to the midpoint split so the left half keeps the drag handle and
|
|
159
|
+
// the right half shows the Remix button.
|
|
160
|
+
|
|
168
161
|
// Pick the side from the content midpoint, keeping the original left/right halves.
|
|
169
162
|
var _editorContentArea$ge = editorContentArea.getBoundingClientRect(),
|
|
170
163
|
left = _editorContentArea$ge.left,
|
|
@@ -107,28 +107,24 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
|
|
|
107
107
|
x: 0,
|
|
108
108
|
y: 0
|
|
109
109
|
};
|
|
110
|
-
|
|
111
|
-
// The active right margin only counts as "still hovering" when our experiment is on;
|
|
112
|
-
// otherwise leaving the content area (e.g. exiting left) must dismiss as on master.
|
|
113
|
-
var marginHoverEnabled = editorExperiment('remix_button_right_margin_hover', true);
|
|
114
110
|
var scheduleMouseLeave = function scheduleMouseLeave(event) {
|
|
115
111
|
if (mouseLeaveTimeoutId) {
|
|
116
112
|
clearTimeout(mouseLeaveTimeoutId);
|
|
117
113
|
mouseLeaveTimeoutId = null;
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
// Keep controls visible when moving to block controls
|
|
121
|
-
// the
|
|
122
|
-
if (rightSideControlsEnabled && (isMovingToBlockControlsArea(event.relatedTarget) ||
|
|
116
|
+
// Keep controls visible when moving to block controls or the active right margin
|
|
117
|
+
// (the Rovo gap is excluded so controls still clear there).
|
|
118
|
+
if (rightSideControlsEnabled && (isMovingToBlockControlsArea(event.relatedTarget) || isOverActiveClickArea(event.relatedTarget, event.clientX))) {
|
|
123
119
|
return;
|
|
124
120
|
}
|
|
125
121
|
mouseLeaveTimeoutId = setTimeout(function () {
|
|
126
122
|
mouseLeaveTimeoutId = null;
|
|
127
123
|
// Re-check after the debounce: keep controls if the cursor landed on block controls
|
|
128
|
-
//
|
|
124
|
+
// or the active right margin.
|
|
129
125
|
if (rightSideControlsEnabled && typeof document !== 'undefined') {
|
|
130
126
|
var el = document.elementFromPoint(lastMousePosition.x, lastMousePosition.y);
|
|
131
|
-
if (el && (isMovingToBlockControlsArea(el) ||
|
|
127
|
+
if (el && (isMovingToBlockControlsArea(el) || isOverActiveClickArea(el, lastMousePosition.x))) {
|
|
132
128
|
return;
|
|
133
129
|
}
|
|
134
130
|
}
|
|
@@ -151,8 +147,7 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
|
|
|
151
147
|
y: event.clientY
|
|
152
148
|
};
|
|
153
149
|
// Catches block controls in portals that handleDOMEvents.mousemove misses.
|
|
154
|
-
|
|
155
|
-
var overClickArea = marginHoverEnabled && event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
150
|
+
var overClickArea = event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
156
151
|
if (editorContentArea.contains(event.target) || isMovingToBlockControlsArea(event.target) || overClickArea) {
|
|
157
152
|
handleMouseMove(view, event, rightSideControlsEnabled, api);
|
|
158
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^22.2.0",
|
|
50
50
|
"@atlaskit/theme": "^26.1.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^136.0.0",
|
|
52
52
|
"@atlaskit/tokens": "^16.3.0",
|
|
53
53
|
"@atlaskit/tooltip": "^24.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|