@atlaskit/editor-plugin-block-controls 32.0.0 → 32.0.1
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 +9 -0
- package/dist/cjs/blockControlsPlugin.js +11 -17
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +11 -47
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
- package/dist/cjs/pm-plugins/main.js +27 -30
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/cjs/pm-plugins/utils/transactions.js +1 -1
- package/dist/cjs/ui/drag-handle.js +38 -173
- package/dist/cjs/ui/global-styles.js +3 -3
- package/dist/es2019/blockControlsPlugin.js +9 -15
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +12 -48
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +5 -9
- package/dist/es2019/pm-plugins/main.js +29 -32
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/es2019/pm-plugins/utils/transactions.js +1 -1
- package/dist/es2019/ui/drag-handle.js +16 -151
- package/dist/es2019/ui/global-styles.js +3 -3
- package/dist/esm/blockControlsPlugin.js +11 -17
- package/dist/esm/pm-plugins/decorations-drag-handle.js +12 -48
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
- package/dist/esm/pm-plugins/main.js +27 -30
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/esm/pm-plugins/utils/transactions.js +1 -1
- package/dist/esm/ui/drag-handle.js +40 -175
- package/dist/esm/ui/global-styles.js +3 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 32.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5d72d64c680a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5d72d64c680a0) -
|
|
8
|
+
Remove the `control` branches of experiment `platform_editor_controls`; the editor controls
|
|
9
|
+
(`variant1`) experience is now permanent.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 32.0.0
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -15,7 +15,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
15
15
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
16
16
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
17
17
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
19
18
|
var _handleKeyDownWithPreservedSelection = require("./editor-commands/handle-key-down-with-preserved-selection");
|
|
20
19
|
var _mapPreservedSelection2 = require("./editor-commands/map-preserved-selection");
|
|
21
20
|
var _moveNode = require("./editor-commands/move-node");
|
|
@@ -162,20 +161,18 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
162
161
|
}
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
});
|
|
172
|
-
}
|
|
164
|
+
pmPlugins.push({
|
|
165
|
+
name: 'blockControlsInteractionTrackingPlugin',
|
|
166
|
+
plugin: function plugin() {
|
|
167
|
+
return (0, _pmPlugin.createInteractionTrackingPlugin)(rightSideControlsEnabled, api);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
173
170
|
pmPlugins.push({
|
|
174
171
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
175
172
|
plugin: (0, _pmPlugin2.createSelectionPreservationPlugin)(api)
|
|
176
173
|
});
|
|
177
174
|
|
|
178
|
-
//
|
|
175
|
+
// quick insert rendering fixes
|
|
179
176
|
//
|
|
180
177
|
// Not registered under the registry migration: the decoration puts an inline
|
|
181
178
|
// `margin-top: 0` on the first document node, which fights features that render their own
|
|
@@ -466,7 +463,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
466
463
|
}
|
|
467
464
|
},
|
|
468
465
|
getSharedState: function getSharedState(editorState) {
|
|
469
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$lastDra, _key$getState0, _interactionTrackingP, _key$getState$isSelec, _key$getState1, _selectionPreservatio;
|
|
466
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$lastDra, _key$getState0, _interactionTrackingP, _key$getState$isSelec, _key$getState1, _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4, _selectionPreservatio;
|
|
470
467
|
if (!editorState) {
|
|
471
468
|
return undefined;
|
|
472
469
|
}
|
|
@@ -490,12 +487,9 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
490
487
|
sharedState.surfaceAnchors = surfaces === null || surfaces === void 0 ? void 0 : surfaces.anchors;
|
|
491
488
|
sharedState.surfaceActiveNodes = surfaces === null || surfaces === void 0 ? void 0 : surfaces.activeNodesByPosition;
|
|
492
489
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
497
|
-
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
498
|
-
}
|
|
490
|
+
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
491
|
+
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
492
|
+
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
499
493
|
sharedState.preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
500
494
|
return sharedState;
|
|
501
495
|
},
|
|
@@ -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 _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
14
13
|
var _consts = require("../ui/consts");
|
|
15
14
|
var _dragHandle = require("../ui/drag-handle");
|
|
16
15
|
var _decorationsCommon = require("./decorations-common");
|
|
@@ -124,52 +123,17 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
124
123
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
125
124
|
// due to margins applied to other nodes eg. Headings
|
|
126
125
|
element.style.clear = 'unset';
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
// getPos,
|
|
139
|
-
// anchorName,
|
|
140
|
-
// nodeType,
|
|
141
|
-
// handleOptions,
|
|
142
|
-
// isTopLevelNode,
|
|
143
|
-
// }),
|
|
144
|
-
// element,
|
|
145
|
-
// key,
|
|
146
|
-
// );
|
|
147
|
-
|
|
148
|
-
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
149
|
-
(0, _reactRootRegistry.renderToMountPoint)( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandleWithVisibility, {
|
|
150
|
-
view: view,
|
|
151
|
-
api: api,
|
|
152
|
-
formatMessage: formatMessage,
|
|
153
|
-
getPos: getPos,
|
|
154
|
-
anchorName: anchorName,
|
|
155
|
-
nodeType: nodeType,
|
|
156
|
-
handleOptions: handleOptions,
|
|
157
|
-
isTopLevelNode: isTopLevelNode,
|
|
158
|
-
anchorRectCache: anchorRectCache
|
|
159
|
-
}), element);
|
|
160
|
-
} else {
|
|
161
|
-
(0, _reactRootRegistry.renderToMountPoint)( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandle, {
|
|
162
|
-
view: view,
|
|
163
|
-
api: api,
|
|
164
|
-
formatMessage: formatMessage,
|
|
165
|
-
getPos: getPos,
|
|
166
|
-
anchorName: anchorName,
|
|
167
|
-
nodeType: nodeType,
|
|
168
|
-
handleOptions: handleOptions,
|
|
169
|
-
isTopLevelNode: isTopLevelNode,
|
|
170
|
-
anchorRectCache: anchorRectCache
|
|
171
|
-
}), element);
|
|
172
|
-
}
|
|
126
|
+
(0, _reactRootRegistry.renderToMountPoint)( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandleWithVisibility, {
|
|
127
|
+
view: view,
|
|
128
|
+
api: api,
|
|
129
|
+
formatMessage: formatMessage,
|
|
130
|
+
getPos: getPos,
|
|
131
|
+
anchorName: anchorName,
|
|
132
|
+
nodeType: nodeType,
|
|
133
|
+
handleOptions: handleOptions,
|
|
134
|
+
isTopLevelNode: isTopLevelNode,
|
|
135
|
+
anchorRectCache: anchorRectCache
|
|
136
|
+
}), element);
|
|
173
137
|
return element;
|
|
174
138
|
}, widgetSpec);
|
|
175
139
|
};
|
|
@@ -255,7 +255,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
255
255
|
var rootNodeType;
|
|
256
256
|
var rootPos;
|
|
257
257
|
|
|
258
|
-
//
|
|
258
|
+
// enables quick insert
|
|
259
259
|
if (toolbarFlagsEnabled) {
|
|
260
260
|
rootPos = view.state.doc.resolve(pos).before(1);
|
|
261
261
|
if (targetPos !== rootPos) {
|
|
@@ -273,7 +273,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
273
273
|
(_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : (0, _domAttrName.getTypeNameFromDom)(rootElement);
|
|
274
274
|
if (nodeType) {
|
|
275
275
|
var _api$userIntent2;
|
|
276
|
-
//
|
|
276
|
+
// enables quick insert
|
|
277
277
|
if (toolbarFlagsEnabled) {
|
|
278
278
|
var _selectionPreservatio;
|
|
279
279
|
var preservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
@@ -12,7 +12,6 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
13
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
14
|
var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
|
|
15
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
16
15
|
var _constants = require("./constants");
|
|
17
16
|
var _handleKeyDown = require("./handle-key-down");
|
|
18
17
|
var _handleMouseMove = require("./handle-mouse-move");
|
|
@@ -70,13 +69,10 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
70
69
|
key: interactionTrackingPluginKey,
|
|
71
70
|
state: {
|
|
72
71
|
init: function init() {
|
|
73
|
-
|
|
74
|
-
isEditing: false
|
|
72
|
+
return {
|
|
73
|
+
isEditing: false,
|
|
74
|
+
isMouseOut: false
|
|
75
75
|
};
|
|
76
|
-
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
77
|
-
state.isMouseOut = false;
|
|
78
|
-
}
|
|
79
|
-
return state;
|
|
80
76
|
},
|
|
81
77
|
apply: function apply(tr, pluginState) {
|
|
82
78
|
var meta = tr.getMeta(interactionTrackingPluginKey);
|
|
@@ -116,8 +112,8 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
116
112
|
}
|
|
117
113
|
}
|
|
118
114
|
},
|
|
119
|
-
view:
|
|
120
|
-
var editorContentArea =
|
|
115
|
+
view: function view(_view) {
|
|
116
|
+
var editorContentArea = _view.dom.closest('.ak-editor-content-area');
|
|
121
117
|
var unbindMouseEnter;
|
|
122
118
|
var unbindMouseLeave;
|
|
123
119
|
var unbindDocumentMouseMove;
|
|
@@ -151,7 +147,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
151
147
|
return;
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
|
-
(0, _handleMouseMove.handleMouseLeave)(
|
|
150
|
+
(0, _handleMouseMove.handleMouseLeave)(_view, rightSideControlsEnabled);
|
|
155
151
|
}, MOUSE_LEAVE_DEBOUNCE_MS);
|
|
156
152
|
};
|
|
157
153
|
var cancelScheduledMouseLeave = function cancelScheduledMouseLeave() {
|
|
@@ -169,7 +165,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
169
165
|
var isOverKnownHoverTarget = (editorContentArea === null || editorContentArea === void 0 ? void 0 : editorContentArea.contains(event.target)) || isMovingToBlockControlsArea(event.target);
|
|
170
166
|
var overClickArea = event.target instanceof Element && !!event.target.closest(CLICK_AREA_SELECTOR);
|
|
171
167
|
if (isOverKnownHoverTarget || overClickArea) {
|
|
172
|
-
(0, _handleMouseMove.handleMouseMove)(
|
|
168
|
+
(0, _handleMouseMove.handleMouseMove)(_view, event, rightSideControlsEnabled, api);
|
|
173
169
|
}
|
|
174
170
|
};
|
|
175
171
|
var handleTreatmentDocumentMouseMove = function handleTreatmentDocumentMouseMove(event) {
|
|
@@ -180,8 +176,8 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
180
176
|
y: event.clientY
|
|
181
177
|
};
|
|
182
178
|
cancelScheduledMouseLeave();
|
|
183
|
-
if (!((_interactionTrackingP = interactionTrackingPluginKey.getState(
|
|
184
|
-
(0, _handleMouseMove.handleMouseLeave)(
|
|
179
|
+
if (!((_interactionTrackingP = interactionTrackingPluginKey.getState(_view.state)) !== null && _interactionTrackingP !== void 0 && _interactionTrackingP.isMouseOut)) {
|
|
180
|
+
(0, _handleMouseMove.handleMouseLeave)(_view, rightSideControlsEnabled);
|
|
185
181
|
}
|
|
186
182
|
return;
|
|
187
183
|
}
|
|
@@ -215,7 +211,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
215
211
|
if (rightSideControlsEnabled) {
|
|
216
212
|
cancelScheduledMouseLeave();
|
|
217
213
|
}
|
|
218
|
-
(0, _handleMouseMove.handleMouseEnter)(
|
|
214
|
+
(0, _handleMouseMove.handleMouseEnter)(_view);
|
|
219
215
|
}
|
|
220
216
|
});
|
|
221
217
|
unbindMouseLeave = (0, _bindEventListener.bind)(editorContentArea, {
|
|
@@ -229,7 +225,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
229
225
|
if (rightSideControlsEnabled) {
|
|
230
226
|
scheduleMouseLeave(e);
|
|
231
227
|
} else {
|
|
232
|
-
(0, _handleMouseMove.handleMouseLeave)(
|
|
228
|
+
(0, _handleMouseMove.handleMouseLeave)(_view, false);
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
231
|
});
|
|
@@ -246,7 +242,7 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
|
|
|
246
242
|
(_unbindMouseLeave = unbindMouseLeave) === null || _unbindMouseLeave === void 0 || _unbindMouseLeave();
|
|
247
243
|
}
|
|
248
244
|
};
|
|
249
|
-
}
|
|
245
|
+
}
|
|
250
246
|
});
|
|
251
247
|
};
|
|
252
248
|
var getInteractionTrackingState = exports.getInteractionTrackingState = function getInteractionTrackingState(state) {
|
|
@@ -302,7 +302,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
302
302
|
decorations = decorations.map(tr.mapping, tr.doc);
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
//
|
|
305
|
+
// enables quick insert
|
|
306
306
|
// don't remap activeNode if it's being dragged
|
|
307
307
|
if (!flags.toolbarFlagsEnabled) {
|
|
308
308
|
if (activeNode) {
|
|
@@ -319,7 +319,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
319
319
|
var _mappedRootPos$pos, _mappedRootPos;
|
|
320
320
|
var _mappedPos;
|
|
321
321
|
var browser = (0, _browser.getBrowserInfo)();
|
|
322
|
-
// In safari,
|
|
322
|
+
// In safari,
|
|
323
323
|
// sometimes the drag handle for the layout disppears after you click on the handle for a few times
|
|
324
324
|
// Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
|
|
325
325
|
// This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
|
|
@@ -401,7 +401,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
401
401
|
var newNodeDecs = (0, _decorationsAnchor.nodeDecorations)(newState, isDecSetEmpty ? undefined : from, isDecSetEmpty ? undefined : to);
|
|
402
402
|
decorations = decorations.add(newState.doc, newNodeDecs);
|
|
403
403
|
|
|
404
|
-
//
|
|
404
|
+
// enables quick insert
|
|
405
405
|
if (!flags.toolbarFlagsEnabled) {
|
|
406
406
|
if (latestActiveNode && !isActiveNodeDeleted) {
|
|
407
407
|
// Find the newly minted node decs that touch the active node
|
|
@@ -460,7 +460,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
460
460
|
// If the active node is missing, we need to remove the handle
|
|
461
461
|
var shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
|
|
462
462
|
|
|
463
|
-
//
|
|
463
|
+
// enables quick insert
|
|
464
464
|
if (flags.toolbarFlagsEnabled) {
|
|
465
465
|
// Remove handle dec when editor is blurred
|
|
466
466
|
shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
|
|
@@ -498,7 +498,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
498
498
|
// quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
|
|
499
499
|
// stale decoration is left behind whenever platform_editor_block_control_migration is on.
|
|
500
500
|
if (flags.toolbarFlagsEnabled) {
|
|
501
|
-
//
|
|
501
|
+
// enables quick insert
|
|
502
502
|
if (quickInsertButtonEnabled) {
|
|
503
503
|
var _activeNode7, _activeNode8;
|
|
504
504
|
var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
@@ -623,7 +623,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
|
|
626
|
-
//
|
|
626
|
+
// enables quick insert
|
|
627
627
|
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
628
628
|
var _latestActiveNode1;
|
|
629
629
|
if (quickInsertButtonEnabled) {
|
|
@@ -843,7 +843,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
var newActiveNode;
|
|
846
|
-
//
|
|
846
|
+
// enables quick insert
|
|
847
847
|
if (flags.toolbarFlagsEnabled) {
|
|
848
848
|
var _latestActiveNode11, _latestActiveNode12;
|
|
849
849
|
// remove isEmptyDoc check and let decorations render and determine their own visibility
|
|
@@ -1117,7 +1117,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1117
1117
|
if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8 = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8 !== void 0 && _api$limitedMode8.enabled) {
|
|
1118
1118
|
return;
|
|
1119
1119
|
}
|
|
1120
|
-
return (0,
|
|
1120
|
+
return (0, _handleMouseDown.handleMouseDown)(api)(view, event);
|
|
1121
1121
|
},
|
|
1122
1122
|
keydown: function keydown(view, event) {
|
|
1123
1123
|
var _api$limitedMode9;
|
|
@@ -1131,11 +1131,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1131
1131
|
return true;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement
|
|
1134
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement) {
|
|
1135
1135
|
var isDragHandle = event.target.closest(_dragHandle.DRAG_HANDLE_SELECTOR) !== null;
|
|
1136
1136
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
1137
1137
|
}
|
|
1138
|
-
if (
|
|
1138
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
1139
1139
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
1140
1140
|
var isBlockMenuOpen = api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen;
|
|
1141
1141
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
@@ -1147,32 +1147,29 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
1147
1147
|
return false;
|
|
1148
1148
|
},
|
|
1149
1149
|
blur: function blur(view, event) {
|
|
1150
|
-
var _api$limitedMode0;
|
|
1150
|
+
var _api$limitedMode0, _api$core2;
|
|
1151
1151
|
if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0 = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0 !== void 0 && _api$limitedMode0.enabled) {
|
|
1152
1152
|
return;
|
|
1153
1153
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
var shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
|
|
1159
|
-
var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(_uiToolbar.EDIT_AREA_ID)) !== null;
|
|
1154
|
+
// Focus moving into the registry surface remains inside the editor experience.
|
|
1155
|
+
var isChildOfSurface = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(_consts.BLOCK_CONTROLS_SURFACE_SELECTOR) !== null;
|
|
1156
|
+
var shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
|
|
1157
|
+
var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(_uiToolbar.EDIT_AREA_ID)) !== null;
|
|
1160
1158
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
return false;
|
|
1165
|
-
}
|
|
1166
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref6) {
|
|
1167
|
-
var tr = _ref6.tr;
|
|
1168
|
-
var currMeta = tr.getMeta(key);
|
|
1169
|
-
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
1170
|
-
editorBlurred: true
|
|
1171
|
-
}));
|
|
1172
|
-
return tr;
|
|
1173
|
-
});
|
|
1159
|
+
// don't do anything if the event relatedTarget (the element receiving focus) is a child of the editor
|
|
1160
|
+
// or if the editor has focus
|
|
1161
|
+
if (isChildOfEditor || isChildOfSurface || shouldPreserveRemixInlineDropdownFocus || view.hasFocus()) {
|
|
1174
1162
|
return false;
|
|
1175
1163
|
}
|
|
1164
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref6) {
|
|
1165
|
+
var tr = _ref6.tr;
|
|
1166
|
+
var currMeta = tr.getMeta(key);
|
|
1167
|
+
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
1168
|
+
editorBlurred: true
|
|
1169
|
+
}));
|
|
1170
|
+
return tr;
|
|
1171
|
+
});
|
|
1172
|
+
return false;
|
|
1176
1173
|
}
|
|
1177
1174
|
}
|
|
1178
1175
|
},
|
|
@@ -67,7 +67,7 @@ var getStickyNodes = (0, _memoizeOne.default)(function () {
|
|
|
67
67
|
return [].concat(STICKY_NODES, (0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('confluence_native_tabs_experiment', 'isEnabled', true) ? ['multiBodiedExtension'] : []));
|
|
68
68
|
});
|
|
69
69
|
var shouldBeSticky = exports.shouldBeSticky = function shouldBeSticky(nodeType) {
|
|
70
|
-
return
|
|
70
|
+
return getStickyNodes().includes(nodeType);
|
|
71
71
|
};
|
|
72
72
|
var getControlBottomCSSValue = exports.getControlBottomCSSValue = function getControlBottomCSSValue(anchor, isSticky, isTopLevelNode, isLayoutColumn, fallbackAnchor) {
|
|
73
73
|
if ((0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
|
|
@@ -91,8 +91,5 @@ var getControlHeightCSSValue = exports.getControlHeightCSSValue = function getCo
|
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
var shouldMaskNodeControls = exports.shouldMaskNodeControls = function shouldMaskNodeControls(nodeType, isTopLevelNode) {
|
|
94
|
-
return (
|
|
95
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
96
|
-
isTopLevelNode && ['table'].includes(nodeType) && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')
|
|
97
|
-
);
|
|
94
|
+
return isTopLevelNode && ['table'].includes(nodeType);
|
|
98
95
|
};
|
|
@@ -64,7 +64,7 @@ var getTrMetadata = exports.getTrMetadata = function getTrMetadata(tr, flags) {
|
|
|
64
64
|
}
|
|
65
65
|
// Fixes drag handle and quick insert button overlap issues
|
|
66
66
|
if (flags.toolbarFlagsEnabled) {
|
|
67
|
-
//
|
|
67
|
+
// fixes drag handle and quick insert button overlap issues
|
|
68
68
|
isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
|
|
69
69
|
}
|
|
70
70
|
var mappedTo = tr.mapping.map(s.to);
|