@atlaskit/editor-plugin-block-controls 7.9.0 → 7.10.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 +24 -5
- package/dist/cjs/blockControlsPlugin.js +1 -1
- package/dist/cjs/editor-commands/show-drag-handle.js +2 -2
- package/dist/cjs/pm-plugins/decorations-anchor.js +1 -1
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +1 -1
- package/dist/cjs/pm-plugins/decorations-drop-target.js +1 -2
- package/dist/cjs/pm-plugins/handle-mouse-down.js +1 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +3 -3
- package/dist/cjs/pm-plugins/main.js +5 -5
- package/dist/cjs/ui/drag-handle.js +10 -10
- package/dist/cjs/ui/drop-target-layout.js +2 -2
- package/dist/cjs/ui/drop-target.js +2 -2
- package/dist/cjs/ui/global-styles.js +4 -5
- package/dist/cjs/ui/inline-drop-target.js +5 -5
- package/dist/cjs/ui/utils/anchor-name.js +1 -1
- package/dist/cjs/ui/utils/dom-attr-name.js +2 -2
- package/dist/es2019/blockControlsPlugin.js +1 -1
- package/dist/es2019/editor-commands/show-drag-handle.js +2 -2
- package/dist/es2019/pm-plugins/decorations-anchor.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drop-target.js +1 -2
- package/dist/es2019/pm-plugins/handle-mouse-down.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +3 -3
- package/dist/es2019/pm-plugins/main.js +5 -5
- package/dist/es2019/ui/drag-handle.js +10 -10
- package/dist/es2019/ui/drop-target-layout.js +2 -2
- package/dist/es2019/ui/drop-target.js +2 -2
- package/dist/es2019/ui/global-styles.js +4 -5
- package/dist/es2019/ui/inline-drop-target.js +5 -5
- package/dist/es2019/ui/utils/anchor-name.js +1 -1
- package/dist/es2019/ui/utils/dom-attr-name.js +2 -2
- package/dist/esm/blockControlsPlugin.js +1 -1
- package/dist/esm/editor-commands/show-drag-handle.js +2 -2
- package/dist/esm/pm-plugins/decorations-anchor.js +1 -1
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +1 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +1 -2
- package/dist/esm/pm-plugins/handle-mouse-down.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +3 -3
- package/dist/esm/pm-plugins/main.js +5 -5
- package/dist/esm/ui/drag-handle.js +10 -10
- package/dist/esm/ui/drop-target-layout.js +2 -2
- package/dist/esm/ui/drop-target.js +2 -2
- package/dist/esm/ui/global-styles.js +4 -5
- package/dist/esm/ui/inline-drop-target.js +5 -5
- package/dist/esm/ui/utils/anchor-name.js +1 -1
- package/dist/esm/ui/utils/dom-attr-name.js +2 -2
- package/package.json +4 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7583860e8637f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7583860e8637f) -
|
|
8
|
+
EDITOR-3621 Clean up platform_editor_block_menu_keyboard_navigation feature gate
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.10.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`d84e4018e7a77`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d84e4018e7a77) -
|
|
16
|
+
ED-29689 create new exp
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 7.9.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -214,7 +233,7 @@
|
|
|
214
233
|
### Patch Changes
|
|
215
234
|
|
|
216
235
|
- [`9ca86d5ced1c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ca86d5ced1c4) -
|
|
217
|
-
ED-294112 fix extended hover zone for
|
|
236
|
+
ED-294112 fix extended hover zone for platform_editor_native_anchor_with_dnd to match existing
|
|
218
237
|
behaviour; no hover zones for inline elements, headerCells or (when advanced_layouts is off)
|
|
219
238
|
layout columns
|
|
220
239
|
- Updated dependencies
|
|
@@ -247,7 +266,7 @@
|
|
|
247
266
|
- [`0b0ef25b2f529`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b0ef25b2f529) -
|
|
248
267
|
Cleanup various feature gates and align them to aifc_create_enabled
|
|
249
268
|
- [`3feef799ad0a5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3feef799ad0a5) -
|
|
250
|
-
[ED-29333] Fix 2 issues when
|
|
269
|
+
[ED-29333] Fix 2 issues when platform_editor_native_anchor_with_dnd is enabled
|
|
251
270
|
1. Drag handle is rendered for media node
|
|
252
271
|
2. When advanced_layouts experiment is off, quick insert button is rendered based on child node
|
|
253
272
|
inside layout column (as opposed to layout section node )
|
|
@@ -270,7 +289,7 @@
|
|
|
270
289
|
|
|
271
290
|
- [`606c3303a0d61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/606c3303a0d61) -
|
|
272
291
|
[ux] ED-29331 fix block controls misalignment on first line of empty document with
|
|
273
|
-
|
|
292
|
+
platform_editor_native_anchor_with_dnd on
|
|
274
293
|
- Updated dependencies
|
|
275
294
|
|
|
276
295
|
## 7.2.10
|
|
@@ -279,7 +298,7 @@
|
|
|
279
298
|
|
|
280
299
|
- [`2470543de66c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2470543de66c4) -
|
|
281
300
|
[ux] ED-29341 fix block quote drag handle is hard to trigger behind with
|
|
282
|
-
|
|
301
|
+
platform_editor_native_anchor_with_dnd on
|
|
283
302
|
- Updated dependencies
|
|
284
303
|
|
|
285
304
|
## 7.2.9
|
|
@@ -294,7 +313,7 @@
|
|
|
294
313
|
### Patch Changes
|
|
295
314
|
|
|
296
315
|
- [`435745247f7ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/435745247f7ef) -
|
|
297
|
-
[ED-29337] Fix drag handle cannot be focus via shorcut when
|
|
316
|
+
[ED-29337] Fix drag handle cannot be focus via shorcut when platform_editor_native_anchor_with_dnd
|
|
298
317
|
is enabled
|
|
299
318
|
|
|
300
319
|
## 7.2.7
|
|
@@ -133,7 +133,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
133
133
|
toggleMenuMeta = _objectSpread(_objectSpread({}, toggleMenuMeta), {}, {
|
|
134
134
|
moveUp: moveUp,
|
|
135
135
|
moveDown: moveDown,
|
|
136
|
-
openedViaKeyboard:
|
|
136
|
+
openedViaKeyboard: options === null || options === void 0 ? void 0 : options.openedViaKeyboard
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
@@ -39,7 +39,7 @@ var findParentPosForHandle = function findParentPosForHandle(state) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// else find closest parent node
|
|
42
|
-
return (0, _expValEquals.expValEquals)('
|
|
42
|
+
return (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ?
|
|
43
43
|
// With native anchor enabled, all nodes have anchor name attribute despite no drag handle support, e.g. listItem, caption,
|
|
44
44
|
// as opposed to old approach, node decoration is only added to the node that have drag handle,
|
|
45
45
|
// hence, we need to return the exact position of the node that can have drag handle
|
|
@@ -113,7 +113,7 @@ var findNextAnchorNode = function findNextAnchorNode(view) {
|
|
|
113
113
|
};
|
|
114
114
|
var showDragHandleAtSelection = exports.showDragHandleAtSelection = function showDragHandleAtSelection(api) {
|
|
115
115
|
return function (state, _, view) {
|
|
116
|
-
if (view && (0, _expValEquals.expValEquals)('
|
|
116
|
+
if (view && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
117
117
|
var anchorNode = findNextAnchorNode(view);
|
|
118
118
|
if (api && anchorNode) {
|
|
119
119
|
var pos = anchorNode.pos,
|
|
@@ -107,7 +107,7 @@ var findNodeDecs = exports.findNodeDecs = function findNodeDecs(state, decoratio
|
|
|
107
107
|
};
|
|
108
108
|
var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newState, from, to) {
|
|
109
109
|
var decs = [];
|
|
110
|
-
if ((0, _expValEquals.expValEquals)('
|
|
110
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
111
111
|
return [];
|
|
112
112
|
}
|
|
113
113
|
var docFrom = from === undefined || from < 0 ? 0 : from;
|
|
@@ -239,7 +239,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
_activeAnchorTracker.defaultActiveAnchorTracker.emit((0, _expValEquals.expValEquals)('
|
|
242
|
+
_activeAnchorTracker.defaultActiveAnchorTracker.emit((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(rootNodeWithPos.node, rootNodeWithPos.pos) || '' : (0, _decorationsCommon.getNodeAnchor)(rootNodeWithPos.node));
|
|
243
243
|
return {
|
|
244
244
|
decsToAdd: decsToAdd,
|
|
245
245
|
decsToRemove: decsToRemove
|
|
@@ -11,7 +11,6 @@ var _uuid = _interopRequireDefault(require("uuid"));
|
|
|
11
11
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _consts = require("../ui/consts");
|
|
@@ -138,7 +137,7 @@ var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration
|
|
|
138
137
|
element.setAttribute('data-blocks-drop-target-container', 'true');
|
|
139
138
|
element.setAttribute('data-blocks-drop-target-key', key);
|
|
140
139
|
element.style.clear = 'unset';
|
|
141
|
-
var DropTargetLayoutComponent = (0, _expValEquals.expValEquals)('
|
|
140
|
+
var DropTargetLayoutComponent = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? _dropTargetLayout.DropTargetLayoutNativeAnchorSupport : _dropTargetLayout.DropTargetLayout;
|
|
142
141
|
nodeViewPortalProviderAPI.render(function () {
|
|
143
142
|
return /*#__PURE__*/(0, _react.createElement)(DropTargetLayoutComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
144
143
|
getPos: getPos,
|
|
@@ -21,7 +21,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
|
|
|
21
21
|
if (!rootNode) {
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
|
-
if ((0, _expValEquals.expValEquals)('
|
|
24
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
25
25
|
var _rootNode$type$name, _rootNode$type$name2;
|
|
26
26
|
var anchorName = api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(rootNode, rootPos);
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ var getNodeSelector = function getNodeSelector(ignoreNodes, ignoreNodeDescendant
|
|
|
30
30
|
return "[data-prosemirror-node-name=\"".concat(node, "\"]");
|
|
31
31
|
});
|
|
32
32
|
var ignoreNodeDescendantsSelectorList = ignoreNodeDescendants.map(function (node) {
|
|
33
|
-
if (node === 'table'
|
|
33
|
+
if (node === 'table') {
|
|
34
34
|
// Special case for table to exclude its direct descendants
|
|
35
35
|
return ["[data-prosemirror-node-name=\"tableCell\"] > [data-node-anchor]", "[data-prosemirror-node-name=\"tableHeader\"] > [data-node-anchor]"];
|
|
36
36
|
}
|
|
@@ -70,7 +70,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
70
70
|
// Ignored via go/ees005
|
|
71
71
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
72
72
|
var target = event.target;
|
|
73
|
-
var isNativeAnchorSupported = (0, _expValEquals.expValEquals)('
|
|
73
|
+
var isNativeAnchorSupported = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
74
74
|
if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
@@ -108,7 +108,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
var anchorName;
|
|
111
|
-
if ((0, _expValEquals.expValEquals)('
|
|
111
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
112
112
|
anchorName = rootElement.getAttribute((0, _domAttrName.getAnchorAttrName)());
|
|
113
113
|
|
|
114
114
|
// don't show handles if we can't find an anchor
|
|
@@ -358,7 +358,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
358
358
|
var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
|
|
359
359
|
var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
|
|
360
360
|
// Skip expensive anchor node decoration recalculations when native anchor support is enabled
|
|
361
|
-
!((0, _expValEquals.expValEquals)('
|
|
361
|
+
!((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('editor_native_anchor_remove_decoration_in_apply'));
|
|
362
362
|
var isActiveNodeModified = false;
|
|
363
363
|
if (api && shouldRedrawNodeDecs) {
|
|
364
364
|
var oldNodeDecs = (0, _decorationsAnchor.findNodeDecs)(newState, decorations, from, to);
|
|
@@ -516,7 +516,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
var isEmptyDoc = (0, _utils.isEmptyDocument)(newState.doc);
|
|
519
|
-
if (isEmptyDoc && !(0, _expValEquals.expValEquals)('
|
|
519
|
+
if (isEmptyDoc && !(0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
520
520
|
var hasNodeDecoration = !!(0, _decorationsAnchor.findNodeDecs)(newState, decorations).length;
|
|
521
521
|
if (!hasNodeDecoration) {
|
|
522
522
|
decorations = decorations.add(newState.doc, [(0, _decorationsDragHandle.emptyParagraphNodeDecorations)()]);
|
|
@@ -560,7 +560,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
560
560
|
blockMenuOptions: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
561
561
|
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
562
562
|
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
563
|
-
openedViaKeyboard: (
|
|
563
|
+
openedViaKeyboard: (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard
|
|
564
564
|
} : undefined,
|
|
565
565
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
566
566
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -772,7 +772,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
772
772
|
}
|
|
773
773
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
774
774
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
775
|
-
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
775
|
+
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
|
|
776
776
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
777
777
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
778
778
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -799,7 +799,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
799
799
|
}
|
|
800
800
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
801
801
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
802
|
-
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
802
|
+
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
|
|
803
803
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
804
804
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
805
805
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !_isBlockMenuOpen) {
|
|
@@ -501,7 +501,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
501
501
|
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.toggleBlockMenu({
|
|
502
502
|
anchorName: anchorName,
|
|
503
503
|
triggerByNode: triggerByNode,
|
|
504
|
-
openedViaKeyboard:
|
|
504
|
+
openedViaKeyboard: false
|
|
505
505
|
})({
|
|
506
506
|
tr: tr
|
|
507
507
|
});
|
|
@@ -511,7 +511,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
511
511
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
|
|
512
512
|
anchorName: anchorName,
|
|
513
513
|
triggerByNode: triggerByNode,
|
|
514
|
-
openedViaKeyboard:
|
|
514
|
+
openedViaKeyboard: false
|
|
515
515
|
})({
|
|
516
516
|
tr: tr
|
|
517
517
|
});
|
|
@@ -744,7 +744,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
744
744
|
} else {
|
|
745
745
|
var domAtPos = view.domAtPos.bind(view);
|
|
746
746
|
var previewContent = [];
|
|
747
|
-
expandedSlice.content.descendants(function (node, pos
|
|
747
|
+
expandedSlice.content.descendants(function (node, pos) {
|
|
748
748
|
// Get the dom element of the node
|
|
749
749
|
//eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
750
750
|
var nodeDomElement = (0, _utils.findDomRefAtPos)(sliceFrom + pos, domAtPos);
|
|
@@ -815,7 +815,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
815
815
|
setRecalculatePosition(recalculatePosition);
|
|
816
816
|
}
|
|
817
817
|
var pos = getPos();
|
|
818
|
-
var $pos = (0, _expValEquals.expValEquals)('
|
|
818
|
+
var $pos = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? typeof pos === 'number' && view.state.doc.resolve(pos) : pos && view.state.doc.resolve(pos);
|
|
819
819
|
var parentPos = $pos && $pos.depth ? $pos.before() : undefined;
|
|
820
820
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
821
821
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
@@ -850,7 +850,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
850
850
|
var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
851
851
|
return _objectSpread({
|
|
852
852
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
853
|
-
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start)+ ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('
|
|
853
|
+
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start)+ ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType), "px)")
|
|
854
854
|
}, bottom);
|
|
855
855
|
}
|
|
856
856
|
var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -861,7 +861,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
861
861
|
}, [anchorName, getPos, view, nodeType, macroInteractionUpdates, anchorRectCache, isTopLevelNode, isLayoutColumn, recalculatePosition]);
|
|
862
862
|
var calculatePositionOld = (0, _react.useCallback)(function () {
|
|
863
863
|
var pos = getPos();
|
|
864
|
-
var $pos = (0, _expValEquals.expValEquals)('
|
|
864
|
+
var $pos = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? typeof pos === 'number' && view.state.doc.resolve(pos) : pos && view.state.doc.resolve(pos);
|
|
865
865
|
var parentPos = $pos && $pos.depth ? $pos.before() : undefined;
|
|
866
866
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
867
867
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
@@ -896,7 +896,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
896
896
|
var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
897
897
|
return _objectSpread({
|
|
898
898
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
899
|
-
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('
|
|
899
|
+
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType), "px)")
|
|
900
900
|
}, bottom);
|
|
901
901
|
}
|
|
902
902
|
var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -1075,13 +1075,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1075
1075
|
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1076
1076
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1077
1077
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1078
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) &&
|
|
1078
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? focusedStyles : focusedStylesOld, (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') && dragHandleButtonDenseModeStyles],
|
|
1079
1079
|
ref: buttonRef
|
|
1080
1080
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1081
1081
|
,
|
|
1082
1082
|
style: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1083
1083
|
onClick: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? handleOnClickNew : handleOnClick,
|
|
1084
|
-
onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
1084
|
+
onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
1085
1085
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1086
1086
|
,
|
|
1087
1087
|
onDrop: handleOnDrop,
|
|
@@ -1089,7 +1089,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1089
1089
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1090
1090
|
"data-testid": "block-ctrl-drag-handle",
|
|
1091
1091
|
"aria-label": (0, _expValEquals.expValEquals)('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
1092
|
-
onBlur: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
1092
|
+
onBlur: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? function () {
|
|
1093
1093
|
return setIsFocused(false);
|
|
1094
1094
|
} : undefined
|
|
1095
1095
|
}, (0, _react2.jsx)(_primitives.Box, {
|
|
@@ -129,7 +129,7 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
129
129
|
}, isDraggedOver ? (0, _react2.jsx)(_box.DropIndicator, {
|
|
130
130
|
edge: "right",
|
|
131
131
|
gap: "-".concat(DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH, "px")
|
|
132
|
-
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('
|
|
132
|
+
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) && (0, _react2.jsx)("div", {
|
|
133
133
|
"data-testid": "block-ctrl-drop-hint",
|
|
134
134
|
css: dropTargetLayoutHintStyle
|
|
135
135
|
}));
|
|
@@ -244,7 +244,7 @@ var DropTargetLayoutNativeAnchorSupport = exports.DropTargetLayoutNativeAnchorSu
|
|
|
244
244
|
}, isDraggedOver ? (0, _react2.jsx)(_box.DropIndicator, {
|
|
245
245
|
edge: "right",
|
|
246
246
|
gap: "-".concat(DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH, "px")
|
|
247
|
-
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('
|
|
247
|
+
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) && (0, _react2.jsx)("div", {
|
|
248
248
|
"data-testid": "block-ctrl-drop-hint",
|
|
249
249
|
css: dropTargetLayoutHintStyle
|
|
250
250
|
}));
|
|
@@ -91,7 +91,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
91
91
|
var ref = (0, _react.useRef)(null);
|
|
92
92
|
var isRemainingheight = dropTargetStyle === 'remainingHeight';
|
|
93
93
|
var anchorName = (0, _react.useMemo)(function () {
|
|
94
|
-
if ((0, _expValEquals.expValEquals)('
|
|
94
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
95
95
|
if (node && typeof pos === 'number') {
|
|
96
96
|
var posOffset = position === 'upper' ? -node.nodeSize : 0;
|
|
97
97
|
return (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos + posOffset)) || '';
|
|
@@ -144,7 +144,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
144
144
|
// only apply upper drop zone
|
|
145
145
|
if (isRemainingheight && position === 'upper') {
|
|
146
146
|
// previous node
|
|
147
|
-
var _anchorName = node ? (0, _expValEquals.expValEquals)('
|
|
147
|
+
var _anchorName = node ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos || -1)) || '' : (0, _decorationsCommon.getNodeAnchor)(node) : '';
|
|
148
148
|
var top = 'unset';
|
|
149
149
|
if (_anchorName) {
|
|
150
150
|
var enabledDropZone = enableDropZone.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
|
|
@@ -12,7 +12,6 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
|
12
12
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
13
|
var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _constants = require("@atlaskit/theme/constants");
|
|
17
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -465,13 +464,13 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
465
464
|
var isDragging = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isDragging', {
|
|
466
465
|
disabled: !(0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
467
466
|
});
|
|
468
|
-
var shouldRenderAnchors = (0, _styles.isCSSAnchorSupported)() && (0, _expValEquals.expValEquals)('
|
|
467
|
+
var shouldRenderAnchors = (0, _styles.isCSSAnchorSupported)() && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
469
468
|
var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
470
469
|
return (0, _react.jsx)(_react.Global, {
|
|
471
|
-
styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('
|
|
470
|
+
styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
472
471
|
exposure: true
|
|
473
|
-
}) ? (0, _expValEquals.expValEquals)('
|
|
472
|
+
}) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
474
473
|
// platform_editor_controls note: this allows drag handles to render on empty lines
|
|
475
|
-
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _expValEquals.expValEquals)('
|
|
474
|
+
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? withRelativePosStyleNext : withRelativePosStyle, topLevelNodeMarginStyles, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone, shouldRenderAnchors && (isDragging ? dragAnchorStyles : dragHandlerAnchorStyles)]
|
|
476
475
|
});
|
|
477
476
|
};
|
|
@@ -101,7 +101,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
101
101
|
isDraggedOver = _useState2[0],
|
|
102
102
|
setIsDraggedOver = _useState2[1];
|
|
103
103
|
var anchorName = (0, _react.useMemo)(function () {
|
|
104
|
-
if ((0, _expValEquals.expValEquals)('
|
|
104
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
105
105
|
var _getPos;
|
|
106
106
|
return nextNode ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode, (_getPos = getPos()) !== null && _getPos !== void 0 ? _getPos : -1)) || '' : '';
|
|
107
107
|
}
|
|
@@ -134,7 +134,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
134
134
|
innerContainerWidth = "calc(var(--ak-editor--line-length) * ".concat(percentageWidth, ")");
|
|
135
135
|
}
|
|
136
136
|
} else if (nextNode.type.name === 'table' && nextNode.firstChild) {
|
|
137
|
-
var tableWidthAnchor = (0, _expValEquals.expValEquals)('
|
|
137
|
+
var tableWidthAnchor = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? typeof nextNodePos === 'number' ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '' : '' : (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
|
|
138
138
|
var isNumberColumnEnabled = Boolean(nextNode.attrs.isNumberColumnEnabled);
|
|
139
139
|
if ((0, _anchorUtils.isAnchorSupported)()) {
|
|
140
140
|
innerContainerWidth = isNumberColumnEnabled ? "calc(anchor-size(".concat(tableWidthAnchor, " width) + ").concat(TABLE_NUMBERED_COLUMN_WIDTH, "px)") : "anchor-size(".concat(tableWidthAnchor, " width)");
|
|
@@ -147,7 +147,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
147
147
|
innerContainerWidth = "min(".concat(nextNode.attrs.width, "px, ").concat(innerContainerWidth, ")");
|
|
148
148
|
}
|
|
149
149
|
} else if (nextNode.type.name === 'mediaSingle' && nextNode.firstChild) {
|
|
150
|
-
if ((0, _expValEquals.expValEquals)('
|
|
150
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
151
151
|
var _nextNode$firstChild;
|
|
152
152
|
// check pos is a number
|
|
153
153
|
if (typeof nextNodePos === 'number' && ((_nextNode$firstChild = nextNode.firstChild) === null || _nextNode$firstChild === void 0 ? void 0 : _nextNode$firstChild.type.name) === 'media') {
|
|
@@ -162,7 +162,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
162
162
|
var heightTargetAnchorName = targetAnchorName;
|
|
163
163
|
if (nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
|
|
164
164
|
if (isLeftPosition) {
|
|
165
|
-
if ((0, _expValEquals.expValEquals)('
|
|
165
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
166
166
|
if (typeof nextNodePos === 'number') {
|
|
167
167
|
heightTargetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '';
|
|
168
168
|
} else {
|
|
@@ -172,7 +172,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
172
172
|
heightTargetAnchorName = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
|
|
173
173
|
}
|
|
174
174
|
} else {
|
|
175
|
-
if ((0, _expValEquals.expValEquals)('
|
|
175
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
176
176
|
if (typeof nextNodePos === 'number') {
|
|
177
177
|
var lastNodeStartPos = nextNode.content.size - nextNode.lastChild.nodeSize;
|
|
178
178
|
heightTargetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.lastChild, lastNodeStartPos + 1)) || '';
|
|
@@ -16,7 +16,7 @@ var refreshAnchorName = exports.refreshAnchorName = function refreshAnchorName(_
|
|
|
16
16
|
view = _ref.view,
|
|
17
17
|
anchorName = _ref.anchorName;
|
|
18
18
|
var newAnchorName = anchorName || '';
|
|
19
|
-
if ((0, _expValEquals.expValEquals)('
|
|
19
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
20
20
|
return newAnchorName;
|
|
21
21
|
}
|
|
22
22
|
var pos = getPos();
|
|
@@ -8,13 +8,13 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
|
8
8
|
var NODE_ANCHOR_ATTR_NAME = exports.NODE_ANCHOR_ATTR_NAME = 'data-node-anchor';
|
|
9
9
|
var NODE_NODE_TYPE_ATTR_NAME = exports.NODE_NODE_TYPE_ATTR_NAME = 'data-prosemirror-node-name';
|
|
10
10
|
var getAnchorAttrName = exports.getAnchorAttrName = function getAnchorAttrName() {
|
|
11
|
-
if ((0, _expValEquals.expValEquals)('
|
|
11
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
12
12
|
return NODE_ANCHOR_ATTR_NAME;
|
|
13
13
|
}
|
|
14
14
|
return 'data-drag-handler-anchor-name';
|
|
15
15
|
};
|
|
16
16
|
var getTypeNameAttrName = exports.getTypeNameAttrName = function getTypeNameAttrName() {
|
|
17
|
-
if ((0, _expValEquals.expValEquals)('
|
|
17
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
18
18
|
return NODE_NODE_TYPE_ATTR_NAME;
|
|
19
19
|
}
|
|
20
20
|
return 'data-drag-handler-node-type';
|
|
@@ -126,7 +126,7 @@ export const blockControlsPlugin = ({
|
|
|
126
126
|
...toggleMenuMeta,
|
|
127
127
|
moveUp,
|
|
128
128
|
moveDown,
|
|
129
|
-
openedViaKeyboard:
|
|
129
|
+
openedViaKeyboard: options === null || options === void 0 ? void 0 : options.openedViaKeyboard
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
tr.setMeta(key, {
|
|
@@ -38,7 +38,7 @@ const findParentPosForHandle = state => {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// else find closest parent node
|
|
41
|
-
return expValEquals('
|
|
41
|
+
return expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ?
|
|
42
42
|
// With native anchor enabled, all nodes have anchor name attribute despite no drag handle support, e.g. listItem, caption,
|
|
43
43
|
// as opposed to old approach, node decoration is only added to the node that have drag handle,
|
|
44
44
|
// hence, we need to return the exact position of the node that can have drag handle
|
|
@@ -111,7 +111,7 @@ const findNextAnchorNode = view => {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
export const showDragHandleAtSelection = api => (state, _, view) => {
|
|
114
|
-
if (view && expValEquals('
|
|
114
|
+
if (view && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
115
115
|
const anchorNode = findNextAnchorNode(view);
|
|
116
116
|
if (api && anchorNode) {
|
|
117
117
|
const {
|
|
@@ -95,7 +95,7 @@ export const findNodeDecs = (state, decorations, from, to) => {
|
|
|
95
95
|
};
|
|
96
96
|
export const nodeDecorations = (newState, from, to) => {
|
|
97
97
|
const decs = [];
|
|
98
|
-
if (expValEquals('
|
|
98
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
99
99
|
return [];
|
|
100
100
|
}
|
|
101
101
|
const docFrom = from === undefined || from < 0 ? 0 : from;
|
|
@@ -220,7 +220,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
defaultActiveAnchorTracker.emit(expValEquals('
|
|
223
|
+
defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(rootNodeWithPos.node, rootNodeWithPos.pos) || '' : getNodeAnchor(rootNodeWithPos.node));
|
|
224
224
|
return {
|
|
225
225
|
decsToAdd,
|
|
226
226
|
decsToRemove
|
|
@@ -4,7 +4,6 @@ import uuid from 'uuid';
|
|
|
4
4
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
5
5
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
9
|
import { nodeMargins } from '../ui/consts';
|
|
@@ -127,7 +126,7 @@ export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProvi
|
|
|
127
126
|
element.setAttribute('data-blocks-drop-target-container', 'true');
|
|
128
127
|
element.setAttribute('data-blocks-drop-target-key', key);
|
|
129
128
|
element.style.clear = 'unset';
|
|
130
|
-
const DropTargetLayoutComponent = expValEquals('
|
|
129
|
+
const DropTargetLayoutComponent = expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? DropTargetLayoutNativeAnchorSupport : DropTargetLayout;
|
|
131
130
|
nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(DropTargetLayoutComponent, {
|
|
132
131
|
...props,
|
|
133
132
|
getPos,
|
|
@@ -14,7 +14,7 @@ export const handleMouseDown = api => (view, event) => {
|
|
|
14
14
|
if (!rootNode) {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
|
-
if (expValEquals('
|
|
17
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
18
18
|
var _rootNode$type$name, _rootNode$type$name2;
|
|
19
19
|
const anchorName = api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(rootNode, rootPos);
|
|
20
20
|
|
|
@@ -20,7 +20,7 @@ const getNodeSelector = (ignoreNodes, ignoreNodeDescendants) => {
|
|
|
20
20
|
}
|
|
21
21
|
const ignoreNodeSelectorList = ignoreNodes.map(node => `[data-prosemirror-node-name="${node}"]`);
|
|
22
22
|
const ignoreNodeDescendantsSelectorList = ignoreNodeDescendants.map(node => {
|
|
23
|
-
if (node === 'table'
|
|
23
|
+
if (node === 'table') {
|
|
24
24
|
// Special case for table to exclude its direct descendants
|
|
25
25
|
return [`[data-prosemirror-node-name="tableCell"] > [data-node-anchor]`, `[data-prosemirror-node-name="tableHeader"] > [data-node-anchor]`];
|
|
26
26
|
}
|
|
@@ -62,7 +62,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
62
62
|
// Ignored via go/ees005
|
|
63
63
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
64
64
|
const target = event.target;
|
|
65
|
-
const isNativeAnchorSupported = expValEquals('
|
|
65
|
+
const isNativeAnchorSupported = expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
66
66
|
if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
@@ -100,7 +100,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
let anchorName;
|
|
103
|
-
if (expValEquals('
|
|
103
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
104
104
|
anchorName = rootElement.getAttribute(getAnchorAttrName());
|
|
105
105
|
|
|
106
106
|
// don't show handles if we can't find an anchor
|