@atlaskit/editor-plugin-block-controls 2.16.1 → 2.16.2
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 +6 -0
- package/dist/cjs/blockControlsPlugin.js +2 -0
- package/dist/cjs/editor-commands/move-node.js +4 -1
- package/dist/cjs/editor-commands/move-to-layout.js +8 -2
- package/dist/cjs/editor-commands/show-drag-handle.js +12 -0
- package/dist/cjs/pm-plugins/decorations-anchor.js +7 -2
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +4 -1
- package/dist/cjs/pm-plugins/decorations-drop-target.js +15 -3
- package/dist/cjs/pm-plugins/handle-mouse-over.js +6 -0
- package/dist/cjs/pm-plugins/keymap.js +20 -5
- package/dist/cjs/pm-plugins/main.js +14 -2
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +4 -1
- package/dist/cjs/pm-plugins/utils/fire-analytics.js +4 -1
- package/dist/cjs/pm-plugins/utils/inline-drop-target.js +4 -1
- package/dist/cjs/pm-plugins/utils/update-column-widths.js +4 -1
- package/dist/cjs/pm-plugins/utils/validation.js +3 -0
- package/dist/cjs/ui/drag-preview.js +7 -1
- package/dist/cjs/ui/drop-target-v2.js +8 -2
- package/dist/es2019/blockControlsPlugin.js +2 -0
- package/dist/es2019/editor-commands/move-node.js +4 -1
- package/dist/es2019/editor-commands/move-to-layout.js +8 -2
- package/dist/es2019/editor-commands/show-drag-handle.js +12 -0
- package/dist/es2019/pm-plugins/decorations-anchor.js +7 -2
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +4 -1
- package/dist/es2019/pm-plugins/decorations-drop-target.js +15 -3
- package/dist/es2019/pm-plugins/handle-mouse-over.js +6 -0
- package/dist/es2019/pm-plugins/keymap.js +20 -5
- package/dist/es2019/pm-plugins/main.js +14 -2
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +4 -1
- package/dist/es2019/pm-plugins/utils/fire-analytics.js +4 -1
- package/dist/es2019/pm-plugins/utils/inline-drop-target.js +4 -1
- package/dist/es2019/pm-plugins/utils/update-column-widths.js +4 -1
- package/dist/es2019/pm-plugins/utils/validation.js +3 -0
- package/dist/es2019/ui/drag-preview.js +7 -1
- package/dist/es2019/ui/drop-target-v2.js +8 -2
- package/dist/esm/blockControlsPlugin.js +2 -0
- package/dist/esm/editor-commands/move-node.js +4 -1
- package/dist/esm/editor-commands/move-to-layout.js +8 -2
- package/dist/esm/editor-commands/show-drag-handle.js +12 -0
- package/dist/esm/pm-plugins/decorations-anchor.js +7 -2
- package/dist/esm/pm-plugins/decorations-drag-handle.js +4 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +15 -3
- package/dist/esm/pm-plugins/handle-mouse-over.js +6 -0
- package/dist/esm/pm-plugins/keymap.js +20 -5
- package/dist/esm/pm-plugins/main.js +14 -2
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +4 -1
- package/dist/esm/pm-plugins/utils/fire-analytics.js +4 -1
- package/dist/esm/pm-plugins/utils/inline-drop-target.js +4 -1
- package/dist/esm/pm-plugins/utils/update-column-widths.js +4 -1
- package/dist/esm/pm-plugins/utils/validation.js +3 -0
- package/dist/esm/ui/drag-preview.js +7 -1
- package/dist/esm/ui/drop-target-v2.js +8 -2
- package/dist/types/pm-plugins/utils/active-anchor-tracker.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/active-anchor-tracker.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,8 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
30
30
|
commands: {
|
|
31
31
|
moveNode: (0, _moveNode.moveNode)(api),
|
|
32
32
|
moveToLayout: (0, _moveToLayout.moveToLayout)(api),
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
33
35
|
showDragHandleAt: function showDragHandleAt(pos, anchorName, nodeType, handleOptions) {
|
|
34
36
|
return function (_ref3) {
|
|
35
37
|
var tr = _ref3.tr;
|
|
@@ -159,7 +159,10 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
159
159
|
var moveNode = exports.moveNode = function moveNode(api) {
|
|
160
160
|
return function (start, to) {
|
|
161
161
|
var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _analytics.INPUT_METHOD.DRAG_AND_DROP;
|
|
162
|
-
var formatMessage
|
|
162
|
+
var formatMessage
|
|
163
|
+
// Ignored via go/ees005
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
165
|
+
= arguments.length > 3 ? arguments[3] : undefined;
|
|
163
166
|
return function (_ref4) {
|
|
164
167
|
var _node$nodeSize;
|
|
165
168
|
var tr = _ref4.tr;
|
|
@@ -38,7 +38,10 @@ var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
|
38
38
|
}
|
|
39
39
|
return null;
|
|
40
40
|
};
|
|
41
|
-
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, $originalFrom, $originalTo, api
|
|
41
|
+
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, $originalFrom, $originalTo, api
|
|
42
|
+
// Ignored via go/ees005
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
44
|
+
) {
|
|
42
45
|
var isSameLayout = (0, _validation.isInSameLayout)($originalFrom, $originalTo);
|
|
43
46
|
if (isSameLayout) {
|
|
44
47
|
var _$originalFrom$nodeAf;
|
|
@@ -82,7 +85,10 @@ var insertToDestinationNoWidthUpdate = function insertToDestinationNoWidthUpdate
|
|
|
82
85
|
tr.insert(to, content);
|
|
83
86
|
return tr;
|
|
84
87
|
};
|
|
85
|
-
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos
|
|
88
|
+
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos
|
|
89
|
+
// Ignored via go/ees005
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
91
|
+
) {
|
|
86
92
|
var _ref3 = (0, _updateColumnWidths.updateColumnWidths)(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
87
93
|
newColumnWidth = _ref3.newColumnWidth;
|
|
88
94
|
var _ref4 = tr.doc.type.schema.nodes || {},
|
|
@@ -23,13 +23,21 @@ var showDragHandleAtSelection = exports.showDragHandleAtSelection = function sho
|
|
|
23
23
|
var parentPos = (0, _utils.isInTable)(state) ? $from.before(1) : shouldFocusParentNode ? $from.before(1) : (0, _getNestedNodePosition.getNestedNodePosition)(state) + 1;
|
|
24
24
|
var parentElement = view === null || view === void 0 || (_view$domAtPos = view.domAtPos(parentPos, 0)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
25
25
|
if (parentElement) {
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
28
|
var anchorName = parentElement.getAttribute('data-drag-handler-anchor-name');
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
31
|
var nodeType = parentElement.getAttribute('data-drag-handler-node-type');
|
|
28
32
|
if (!anchorName || !nodeType) {
|
|
29
33
|
// for nodes like panel and mediaSingle, the drag handle decoration is not applied to the dom node at the node position but to the parent node
|
|
30
34
|
var closestParentElement = parentElement.closest('[data-drag-handler-anchor-name]');
|
|
31
35
|
if (closestParentElement) {
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32
38
|
anchorName = closestParentElement.getAttribute('data-drag-handler-anchor-name');
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
33
41
|
nodeType = closestParentElement.getAttribute('data-drag-handler-node-type');
|
|
34
42
|
}
|
|
35
43
|
}
|
|
@@ -46,7 +54,11 @@ var showDragHandleAtSelection = exports.showDragHandleAtSelection = function sho
|
|
|
46
54
|
var nodeElement = dom === null || dom === void 0 ? void 0 : dom.node.childNodes[dom === null || dom === void 0 ? void 0 : dom.offset];
|
|
47
55
|
var rootNode = nodeElement && !nodeElement.hasAttribute('data-drag-handler-anchor-name') && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24321') ? nodeElement.querySelector('[data-drag-handler-anchor-name]') : nodeElement;
|
|
48
56
|
if (rootNode) {
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
59
|
var _anchorName = rootNode.getAttribute('data-drag-handler-anchor-name');
|
|
60
|
+
// Ignored via go/ees005
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
50
62
|
var _nodeType = rootNode.getAttribute('data-drag-handler-node-type');
|
|
51
63
|
if (api && _anchorName && _nodeType) {
|
|
52
64
|
api.core.actions.execute(api.blockControls.commands.showDragHandleAt(rootPos, _anchorName, _nodeType, {
|
|
@@ -27,7 +27,10 @@ var shouldDescendIntoNode = exports.shouldDescendIntoNode = function shouldDesce
|
|
|
27
27
|
}
|
|
28
28
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
29
29
|
};
|
|
30
|
-
var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, parent
|
|
30
|
+
var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, parent
|
|
31
|
+
// Ignored via go/ees005
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
33
|
+
) {
|
|
31
34
|
var isEmbedCard = 'embedCard' === node.type.name && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3');
|
|
32
35
|
|
|
33
36
|
// TODO use isWrappedMedia when clean up the feature flag
|
|
@@ -62,7 +65,7 @@ var findNodeDecs = exports.findNodeDecs = function findNodeDecs(decorations, fro
|
|
|
62
65
|
|
|
63
66
|
// return empty array if range reversed
|
|
64
67
|
if (newfrom !== undefined && newTo !== undefined && newfrom > newTo) {
|
|
65
|
-
return
|
|
68
|
+
return [];
|
|
66
69
|
}
|
|
67
70
|
return decorations.find(newfrom, newTo, function (spec) {
|
|
68
71
|
return spec.type === _decorationsCommon.TYPE_NODE_DEC;
|
|
@@ -73,6 +76,8 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
|
|
|
73
76
|
var docFrom = from === undefined || from < 0 ? 0 : from;
|
|
74
77
|
var docTo = to === undefined || to > newState.doc.nodeSize - 2 ? newState.doc.nodeSize - 2 : to;
|
|
75
78
|
var ignore_nodes = (0, _experiments.editorExperiment)('advanced_layouts', true) ? IGNORE_NODES_NEXT : IGNORE_NODES;
|
|
79
|
+
// Ignored via go/ees005
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
76
81
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
77
82
|
var depth = 0;
|
|
78
83
|
var anchorName;
|
|
@@ -29,7 +29,10 @@ var findHandleDec = exports.findHandleDec = function findHandleDec(decorations,
|
|
|
29
29
|
return spec.type === _decorationsCommon.TYPE_HANDLE_DEC;
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions
|
|
32
|
+
var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
35
|
+
) {
|
|
33
36
|
(0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
34
37
|
var unbind;
|
|
35
38
|
var key = (0, _uuid.default)();
|
|
@@ -88,7 +88,10 @@ var findDropTargetDecs = exports.findDropTargetDecs = function findDropTargetDec
|
|
|
88
88
|
return spec.type === _decorationsCommon.TYPE_DROP_TARGET_DEC;
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
-
var createDropTargetDecoration = exports.createDropTargetDecoration = function createDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout
|
|
91
|
+
var createDropTargetDecoration = exports.createDropTargetDecoration = function createDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout
|
|
92
|
+
// Ignored via go/ees005
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
94
|
+
) {
|
|
92
95
|
var key = (0, _uuid.default)();
|
|
93
96
|
return _view.Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
94
97
|
var getPos = function getPos() {
|
|
@@ -143,7 +146,10 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
|
|
|
143
146
|
side: side
|
|
144
147
|
});
|
|
145
148
|
};
|
|
146
|
-
var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache
|
|
149
|
+
var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache
|
|
150
|
+
// Ignored via go/ees005
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
152
|
+
) {
|
|
147
153
|
var key = (0, _uuid.default)();
|
|
148
154
|
return _view.Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
149
155
|
var getPos = function getPos() {
|
|
@@ -175,7 +181,10 @@ var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration
|
|
|
175
181
|
type: _decorationsCommon.TYPE_DROP_TARGET_DEC
|
|
176
182
|
});
|
|
177
183
|
};
|
|
178
|
-
var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to
|
|
184
|
+
var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to
|
|
185
|
+
// Ignored via go/ees005
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
187
|
+
) {
|
|
179
188
|
(0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
180
189
|
var decs = [];
|
|
181
190
|
var POS_END_OF_DOC = newState.doc.nodeSize - 2;
|
|
@@ -200,6 +209,9 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
200
209
|
prevNodeStack.push(node);
|
|
201
210
|
};
|
|
202
211
|
var isAdvancedLayoutsPreRelease2 = (0, _experiments.editorExperiment)('advanced_layouts', true);
|
|
212
|
+
|
|
213
|
+
// Ignored via go/ees005
|
|
214
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
203
215
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
204
216
|
var depth = 0;
|
|
205
217
|
// drop target deco at the end position
|
|
@@ -24,6 +24,9 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
24
24
|
if (isDragging) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
27
30
|
var target = event.target;
|
|
28
31
|
if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
|
|
29
32
|
return false;
|
|
@@ -58,6 +61,9 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
58
61
|
rootElement = parentElement;
|
|
59
62
|
}
|
|
60
63
|
}
|
|
64
|
+
|
|
65
|
+
// Ignored via go/ees005
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
61
67
|
var anchorName = rootElement.getAttribute('data-drag-handler-anchor-name');
|
|
62
68
|
// No need to update handle position if its already there
|
|
63
69
|
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
|
|
@@ -14,16 +14,31 @@ var _consts = require("./utils/consts");
|
|
|
14
14
|
function keymapList(api, formatMessage) {
|
|
15
15
|
var keymapList = {};
|
|
16
16
|
if (api && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
|
|
17
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
17
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
18
|
+
// Ignored via go/ees005
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
+
_keymaps.showElementDragHandle.common, function (state, dispatch, view) {
|
|
18
21
|
(0, _showDragHandle.showDragHandleAtSelection)(api)(state, dispatch, view);
|
|
19
22
|
//we always want to handle this shortcut to prevent default browser special char insert when option + alphabetical key is used
|
|
20
23
|
return true;
|
|
21
24
|
}, keymapList);
|
|
22
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
23
|
-
|
|
25
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
|
+
_keymaps.dragToMoveUp.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.UP, formatMessage), keymapList);
|
|
29
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
30
|
+
// Ignored via go/ees005
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32
|
+
_keymaps.dragToMoveDown.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.DOWN, formatMessage), keymapList);
|
|
24
33
|
if ((0, _experiments.editorExperiment)('nested-dnd', true) && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_a11y')) {
|
|
25
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
26
|
-
|
|
34
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
+
_keymaps.dragToMoveLeft.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.LEFT, formatMessage), keymapList);
|
|
38
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
41
|
+
_keymaps.dragToMoveRight.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.RIGHT, formatMessage), keymapList);
|
|
27
42
|
}
|
|
28
43
|
}
|
|
29
44
|
return keymapList;
|
|
@@ -98,7 +98,10 @@ var initialState = {
|
|
|
98
98
|
isDocSizeLimitEnabled: null,
|
|
99
99
|
isPMDragging: false
|
|
100
100
|
};
|
|
101
|
-
var newApply = exports.newApply = function newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
101
|
+
var newApply = exports.newApply = function newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
102
|
+
// Ignored via go/ees005
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
104
|
+
) {
|
|
102
105
|
var _meta$activeNode, _activeNode, _activeNode2, _meta$activeNode$hand, _meta$isDragging, _meta$isDragging2, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
|
|
103
106
|
var activeNode = currentState.activeNode,
|
|
104
107
|
decorations = currentState.decorations,
|
|
@@ -229,7 +232,10 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
|
|
|
229
232
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging
|
|
230
233
|
};
|
|
231
234
|
};
|
|
232
|
-
var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
235
|
+
var oldApply = exports.oldApply = function oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
236
|
+
// Ignored via go/ees005
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
238
|
+
) {
|
|
233
239
|
var _meta$activeNode2, _meta$activeNode$hand2, _activeNodeWithNewNod, _meta$activeNode8, _meta$isDragging4, _meta$editorHeight2, _meta$editorWidthLeft2, _meta$editorWidthRigh2, _meta$isPMDragging2;
|
|
234
240
|
var isNestedEnabled = flags.isNestedEnabled;
|
|
235
241
|
var activeNode = currentState.activeNode,
|
|
@@ -443,6 +449,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
443
449
|
init: function init() {
|
|
444
450
|
return initialState;
|
|
445
451
|
},
|
|
452
|
+
// Ignored via go/ees005
|
|
453
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
446
454
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
447
455
|
if (isNestedEnabled) {
|
|
448
456
|
return newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
@@ -578,7 +586,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
578
586
|
}
|
|
579
587
|
if (!isResizerResizing) {
|
|
580
588
|
var _editorContentArea = entries[0].target;
|
|
589
|
+
// Ignored via go/ees005
|
|
590
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
581
591
|
var editorWidthRight = _editorContentArea.getBoundingClientRect().right;
|
|
592
|
+
// Ignored via go/ees005
|
|
593
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
582
594
|
var editorWidthLeft = _editorContentArea.getBoundingClientRect().left;
|
|
583
595
|
transaction.setMeta(key, {
|
|
584
596
|
editorWidthLeft: editorWidthLeft,
|
|
@@ -38,7 +38,10 @@ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type)
|
|
|
38
38
|
return "".concat(dom.offsetTop, "px");
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, type, innerContainer, macroInteractionUpdates, parentType
|
|
41
|
+
var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, type, innerContainer, macroInteractionUpdates, parentType
|
|
42
|
+
// Ignored via go/ees005
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
44
|
+
) {
|
|
42
45
|
if (!dom) {
|
|
43
46
|
return 'auto';
|
|
44
47
|
}
|
|
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.fireMoveNodeAnalytics = exports.fireInsertLayoutAnalytics = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
-
var fireMoveNodeAnalytics = exports.fireMoveNodeAnalytics = function fireMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
8
|
+
var fireMoveNodeAnalytics = exports.fireMoveNodeAnalytics = function fireMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
9
|
+
// Ignored via go/ees005
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
|
+
) {
|
|
9
12
|
var _api$analytics;
|
|
10
13
|
return api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.attachAnalyticsEvent({
|
|
11
14
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -10,7 +10,10 @@ var _checkMediaLayout = require("./check-media-layout");
|
|
|
10
10
|
var _consts = require("./consts");
|
|
11
11
|
var shouldAllowInlineDropTarget = exports.shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
|
|
12
12
|
var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
13
|
-
var activeNode
|
|
13
|
+
var activeNode
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
|
+
= arguments.length > 3 ? arguments[3] : undefined;
|
|
14
17
|
if ((0, _experiments.editorExperiment)('advanced_layouts', false) || isNested) {
|
|
15
18
|
return false;
|
|
16
19
|
}
|
|
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.updateColumnWidths = void 0;
|
|
7
7
|
var _consts = require("../../ui/consts");
|
|
8
|
-
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount
|
|
8
|
+
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount
|
|
9
|
+
// Ignored via go/ees005
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
|
+
) {
|
|
9
12
|
var newColumnWidth = _consts.DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
10
13
|
if (newColumnWidth) {
|
|
11
14
|
layoutNode.content.forEach(function (node, offset) {
|
|
@@ -78,6 +78,9 @@ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNes
|
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
// Ignored via go/ees005
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
81
84
|
function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
82
85
|
var srcNodeType = srcNode.type;
|
|
83
86
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
@@ -50,7 +50,13 @@ var dragPreview = exports.dragPreview = function dragPreview(container, dom, nod
|
|
|
50
50
|
parent.setAttribute('data-testid', 'block-ctrl-generic-drag-preview');
|
|
51
51
|
} else {
|
|
52
52
|
var resizer = dom.querySelector('.resizer-item');
|
|
53
|
-
var clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ?
|
|
53
|
+
var clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ?
|
|
54
|
+
// Ignored via go/ees005
|
|
55
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
56
|
+
resizer.cloneNode(true) :
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
59
|
+
dom.cloneNode(true);
|
|
54
60
|
|
|
55
61
|
// Remove any margin from the cloned element to ensure is doesn't position incorrectly
|
|
56
62
|
clonedDom.style.marginLeft = '0';
|
|
@@ -253,9 +253,15 @@ var DropTargetV2 = exports.DropTargetV2 = function DropTargetV2(props) {
|
|
|
253
253
|
anchorRectCache: anchorRectCache,
|
|
254
254
|
position: "lower",
|
|
255
255
|
isNestedDropTarget: isNestedDropTarget
|
|
256
|
-
}), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout, activeNode) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget
|
|
256
|
+
}), (0, _inlineDropTarget.shouldAllowInlineDropTarget)(isNestedDropTarget, nextNode, isSameLayout, activeNode) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget
|
|
257
|
+
// Ignored via go/ees005
|
|
258
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
259
|
+
, (0, _extends2.default)({}, props, {
|
|
257
260
|
position: "left"
|
|
258
|
-
})), (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget
|
|
261
|
+
})), (0, _react2.jsx)(_inlineDropTarget2.InlineDropTarget
|
|
262
|
+
// Ignored via go/ees005
|
|
263
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
264
|
+
, (0, _extends2.default)({}, props, {
|
|
259
265
|
position: "right"
|
|
260
266
|
}))));
|
|
261
267
|
};
|
|
@@ -22,6 +22,8 @@ export const blockControlsPlugin = ({
|
|
|
22
22
|
commands: {
|
|
23
23
|
moveNode: moveNode(api),
|
|
24
24
|
moveToLayout: moveToLayout(api),
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
27
|
showDragHandleAt: (pos, anchorName, nodeType, handleOptions) => ({
|
|
26
28
|
tr
|
|
27
29
|
}) => {
|
|
@@ -153,7 +153,10 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
153
153
|
return false;
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
|
-
export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_DROP, formatMessage
|
|
156
|
+
export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_DROP, formatMessage
|
|
157
|
+
// Ignored via go/ees005
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
159
|
+
) => ({
|
|
157
160
|
tr
|
|
158
161
|
}) => {
|
|
159
162
|
var _node$nodeSize;
|
|
@@ -33,7 +33,10 @@ const createNewLayout = (schema, layoutContents) => {
|
|
|
33
33
|
}
|
|
34
34
|
return null;
|
|
35
35
|
};
|
|
36
|
-
const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $originalFrom, $originalTo, api
|
|
36
|
+
const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $originalFrom, $originalTo, api
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
39
|
+
) => {
|
|
37
40
|
const isSameLayout = isInSameLayout($originalFrom, $originalTo);
|
|
38
41
|
if (isSameLayout) {
|
|
39
42
|
var _$originalFrom$nodeAf;
|
|
@@ -78,7 +81,10 @@ const insertToDestinationNoWidthUpdate = (tr, to, sourceNode) => {
|
|
|
78
81
|
tr.insert(to, content);
|
|
79
82
|
return tr;
|
|
80
83
|
};
|
|
81
|
-
const insertToDestination = (tr, to, sourceNode, toLayout, toLayoutPos
|
|
84
|
+
const insertToDestination = (tr, to, sourceNode, toLayout, toLayoutPos
|
|
85
|
+
// Ignored via go/ees005
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
87
|
+
) => {
|
|
82
88
|
const {
|
|
83
89
|
newColumnWidth
|
|
84
90
|
} = updateColumnWidths(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {};
|
|
@@ -19,13 +19,21 @@ export const showDragHandleAtSelection = (api, shouldFocusParentNode) => (state,
|
|
|
19
19
|
const parentPos = isInTable(state) ? $from.before(1) : shouldFocusParentNode ? $from.before(1) : getNestedNodePosition(state) + 1;
|
|
20
20
|
const parentElement = view === null || view === void 0 ? void 0 : (_view$domAtPos = view.domAtPos(parentPos, 0)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
21
21
|
if (parentElement) {
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
24
|
let anchorName = parentElement.getAttribute('data-drag-handler-anchor-name');
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
27
|
let nodeType = parentElement.getAttribute('data-drag-handler-node-type');
|
|
24
28
|
if (!anchorName || !nodeType) {
|
|
25
29
|
// for nodes like panel and mediaSingle, the drag handle decoration is not applied to the dom node at the node position but to the parent node
|
|
26
30
|
const closestParentElement = parentElement.closest('[data-drag-handler-anchor-name]');
|
|
27
31
|
if (closestParentElement) {
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
34
|
anchorName = closestParentElement.getAttribute('data-drag-handler-anchor-name');
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
29
37
|
nodeType = closestParentElement.getAttribute('data-drag-handler-node-type');
|
|
30
38
|
}
|
|
31
39
|
}
|
|
@@ -42,7 +50,11 @@ export const showDragHandleAtSelection = (api, shouldFocusParentNode) => (state,
|
|
|
42
50
|
const nodeElement = dom === null || dom === void 0 ? void 0 : dom.node.childNodes[dom === null || dom === void 0 ? void 0 : dom.offset];
|
|
43
51
|
const rootNode = nodeElement && !nodeElement.hasAttribute('data-drag-handler-anchor-name') && fg('platform_editor_element_drag_and_drop_ed_24321') ? nodeElement.querySelector('[data-drag-handler-anchor-name]') : nodeElement;
|
|
44
52
|
if (rootNode) {
|
|
53
|
+
// Ignored via go/ees005
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
55
|
const anchorName = rootNode.getAttribute('data-drag-handler-anchor-name');
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
46
58
|
const nodeType = rootNode.getAttribute('data-drag-handler-node-type');
|
|
47
59
|
if (api && anchorName && nodeType) {
|
|
48
60
|
api.core.actions.execute(api.blockControls.commands.showDragHandleAt(rootPos, anchorName, nodeType, {
|
|
@@ -19,7 +19,10 @@ export const shouldDescendIntoNode = node => {
|
|
|
19
19
|
}
|
|
20
20
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
21
21
|
};
|
|
22
|
-
const shouldIgnoreNode = (node, ignore_nodes, depth, parent
|
|
22
|
+
const shouldIgnoreNode = (node, ignore_nodes, depth, parent
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
+
) => {
|
|
23
26
|
const isEmbedCard = 'embedCard' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_3');
|
|
24
27
|
|
|
25
28
|
// TODO use isWrappedMedia when clean up the feature flag
|
|
@@ -54,7 +57,7 @@ export const findNodeDecs = (decorations, from, to) => {
|
|
|
54
57
|
|
|
55
58
|
// return empty array if range reversed
|
|
56
59
|
if (newfrom !== undefined && newTo !== undefined && newfrom > newTo) {
|
|
57
|
-
return
|
|
60
|
+
return [];
|
|
58
61
|
}
|
|
59
62
|
return decorations.find(newfrom, newTo, spec => spec.type === TYPE_NODE_DEC);
|
|
60
63
|
};
|
|
@@ -63,6 +66,8 @@ export const nodeDecorations = (newState, from, to) => {
|
|
|
63
66
|
const docFrom = from === undefined || from < 0 ? 0 : from;
|
|
64
67
|
const docTo = to === undefined || to > newState.doc.nodeSize - 2 ? newState.doc.nodeSize - 2 : to;
|
|
65
68
|
const ignore_nodes = editorExperiment('advanced_layouts', true) ? IGNORE_NODES_NEXT : IGNORE_NODES;
|
|
69
|
+
// Ignored via go/ees005
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
66
71
|
newState.doc.nodesBetween(docFrom, docTo, (node, pos, parent, index) => {
|
|
67
72
|
let depth = 0;
|
|
68
73
|
let anchorName;
|
|
@@ -20,7 +20,10 @@ export const emptyParagraphNodeDecorations = () => {
|
|
|
20
20
|
export const findHandleDec = (decorations, from, to) => {
|
|
21
21
|
return decorations.find(from, to, spec => spec.type === TYPE_HANDLE_DEC);
|
|
22
22
|
};
|
|
23
|
-
export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions
|
|
23
|
+
export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
+
) => {
|
|
24
27
|
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
25
28
|
let unbind;
|
|
26
29
|
const key = uuid();
|
|
@@ -76,7 +76,10 @@ const getGapAndOffset = (prevNode, nextNode, parentNode) => {
|
|
|
76
76
|
export const findDropTargetDecs = (decorations, from, to) => {
|
|
77
77
|
return decorations.find(from, to, spec => spec.type === TYPE_DROP_TARGET_DEC);
|
|
78
78
|
};
|
|
79
|
-
export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout
|
|
79
|
+
export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout
|
|
80
|
+
// Ignored via go/ees005
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
82
|
+
) => {
|
|
80
83
|
const key = uuid();
|
|
81
84
|
return Decoration.widget(pos, (_, getPosUnsafe) => {
|
|
82
85
|
const getPos = () => {
|
|
@@ -132,7 +135,10 @@ export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI
|
|
|
132
135
|
side
|
|
133
136
|
});
|
|
134
137
|
};
|
|
135
|
-
export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, anchorRectCache
|
|
138
|
+
export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, anchorRectCache
|
|
139
|
+
// Ignored via go/ees005
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
141
|
+
) => {
|
|
136
142
|
const key = uuid();
|
|
137
143
|
return Decoration.widget(pos, (_, getPosUnsafe) => {
|
|
138
144
|
const getPos = () => {
|
|
@@ -164,7 +170,10 @@ export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProvi
|
|
|
164
170
|
type: TYPE_DROP_TARGET_DEC
|
|
165
171
|
});
|
|
166
172
|
};
|
|
167
|
-
export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to
|
|
173
|
+
export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to
|
|
174
|
+
// Ignored via go/ees005
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
176
|
+
) => {
|
|
168
177
|
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
169
178
|
const decs = [];
|
|
170
179
|
const POS_END_OF_DOC = newState.doc.nodeSize - 2;
|
|
@@ -189,6 +198,9 @@ export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPort
|
|
|
189
198
|
prevNodeStack.push(node);
|
|
190
199
|
};
|
|
191
200
|
const isAdvancedLayoutsPreRelease2 = editorExperiment('advanced_layouts', true);
|
|
201
|
+
|
|
202
|
+
// Ignored via go/ees005
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
192
204
|
newState.doc.nodesBetween(docFrom, docTo, (node, pos, parent, index) => {
|
|
193
205
|
let depth = 0;
|
|
194
206
|
// drop target deco at the end position
|
|
@@ -19,6 +19,9 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
19
19
|
if (isDragging) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
22
25
|
const target = event.target;
|
|
23
26
|
if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
|
|
24
27
|
return false;
|
|
@@ -53,6 +56,9 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
53
56
|
rootElement = parentElement;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
59
|
+
|
|
60
|
+
// Ignored via go/ees005
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
62
|
const anchorName = rootElement.getAttribute('data-drag-handler-anchor-name');
|
|
57
63
|
// No need to update handle position if its already there
|
|
58
64
|
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
|
|
@@ -8,16 +8,31 @@ import { DIRECTION } from './utils/consts';
|
|
|
8
8
|
function keymapList(api, formatMessage) {
|
|
9
9
|
let keymapList = {};
|
|
10
10
|
if (api && fg('platform_editor_element_drag_and_drop_ed_23873')) {
|
|
11
|
-
bindKeymapWithCommand(
|
|
11
|
+
bindKeymapWithCommand(
|
|
12
|
+
// Ignored via go/ees005
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
|
+
showElementDragHandle.common, (state, dispatch, view) => {
|
|
12
15
|
showDragHandleAtSelection(api)(state, dispatch, view);
|
|
13
16
|
//we always want to handle this shortcut to prevent default browser special char insert when option + alphabetical key is used
|
|
14
17
|
return true;
|
|
15
18
|
}, keymapList);
|
|
16
|
-
bindKeymapWithCommand(
|
|
17
|
-
|
|
19
|
+
bindKeymapWithCommand(
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
|
+
dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP, formatMessage), keymapList);
|
|
23
|
+
bindKeymapWithCommand(
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
|
+
dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN, formatMessage), keymapList);
|
|
18
27
|
if (editorExperiment('nested-dnd', true) && fg('platform_editor_element_dnd_nested_a11y')) {
|
|
19
|
-
bindKeymapWithCommand(
|
|
20
|
-
|
|
28
|
+
bindKeymapWithCommand(
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
31
|
+
dragToMoveLeft.common, moveNodeViaShortcut(api, DIRECTION.LEFT, formatMessage), keymapList);
|
|
32
|
+
bindKeymapWithCommand(
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
+
dragToMoveRight.common, moveNodeViaShortcut(api, DIRECTION.RIGHT, formatMessage), keymapList);
|
|
21
36
|
}
|
|
22
37
|
}
|
|
23
38
|
return keymapList;
|
|
@@ -92,7 +92,10 @@ const initialState = {
|
|
|
92
92
|
isDocSizeLimitEnabled: null,
|
|
93
93
|
isPMDragging: false
|
|
94
94
|
};
|
|
95
|
-
export const newApply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
95
|
+
export const newApply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
96
|
+
// Ignored via go/ees005
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
98
|
+
) => {
|
|
96
99
|
var _meta$activeNode, _activeNode, _activeNode2, _meta$activeNode$hand, _meta$isDragging, _meta$isDragging2, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
|
|
97
100
|
let {
|
|
98
101
|
activeNode,
|
|
@@ -226,7 +229,10 @@ export const newApply = (api, formatMessage, tr, currentState, newState, flags,
|
|
|
226
229
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging
|
|
227
230
|
};
|
|
228
231
|
};
|
|
229
|
-
export const oldApply = (api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
232
|
+
export const oldApply = (api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
233
|
+
// Ignored via go/ees005
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
235
|
+
) => {
|
|
230
236
|
var _meta$activeNode2, _meta$activeNode$hand2, _activeNodeWithNewNod, _meta$activeNode8, _meta$isDragging4, _meta$editorHeight2, _meta$editorWidthLeft2, _meta$editorWidthRigh2, _meta$isPMDragging2;
|
|
231
237
|
const {
|
|
232
238
|
isNestedEnabled
|
|
@@ -418,6 +424,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
418
424
|
init() {
|
|
419
425
|
return initialState;
|
|
420
426
|
},
|
|
427
|
+
// Ignored via go/ees005
|
|
428
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
421
429
|
apply(tr, currentState, oldState, newState) {
|
|
422
430
|
if (isNestedEnabled) {
|
|
423
431
|
return newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
@@ -558,7 +566,11 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
558
566
|
}
|
|
559
567
|
if (!isResizerResizing) {
|
|
560
568
|
const editorContentArea = entries[0].target;
|
|
569
|
+
// Ignored via go/ees005
|
|
570
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
561
571
|
const editorWidthRight = editorContentArea.getBoundingClientRect().right;
|
|
572
|
+
// Ignored via go/ees005
|
|
573
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
562
574
|
const editorWidthLeft = editorContentArea.getBoundingClientRect().left;
|
|
563
575
|
transaction.setMeta(key, {
|
|
564
576
|
editorWidthLeft,
|
|
@@ -32,7 +32,10 @@ export const getTopPosition = (dom, type) => {
|
|
|
32
32
|
return `${dom.offsetTop}px`;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdates, parentType
|
|
35
|
+
export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdates, parentType
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
38
|
+
) => {
|
|
36
39
|
if (!dom) {
|
|
37
40
|
return 'auto';
|
|
38
41
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export const fireMoveNodeAnalytics = (tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
2
|
+
export const fireMoveNodeAnalytics = (tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
5
|
+
) => {
|
|
3
6
|
var _api$analytics, _api$analytics$action;
|
|
4
7
|
return api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
5
8
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -6,7 +6,10 @@ export const shouldAllowInlineDropTarget = (isNested, node,
|
|
|
6
6
|
/**
|
|
7
7
|
* Is the active node in the same layout as the target node
|
|
8
8
|
*/
|
|
9
|
-
isSameLayout = false, activeNode
|
|
9
|
+
isSameLayout = false, activeNode
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
|
+
) => {
|
|
10
13
|
if (editorExperiment('advanced_layouts', false) || isNested) {
|
|
11
14
|
return false;
|
|
12
15
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../../ui/consts';
|
|
2
|
-
export const updateColumnWidths = (tr, layoutNode, layoutNodePos, childCount
|
|
2
|
+
export const updateColumnWidths = (tr, layoutNode, layoutNodePos, childCount
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
5
|
+
) => {
|
|
3
6
|
const newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
4
7
|
if (newColumnWidth) {
|
|
5
8
|
layoutNode.content.forEach((node, offset) => {
|
|
@@ -72,6 +72,9 @@ export const memoizedTransformExpandToNestedExpand = memoizeOne(node => {
|
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
+
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
75
78
|
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
76
79
|
let srcNodeType = srcNode.type;
|
|
77
80
|
const parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
@@ -44,7 +44,13 @@ export const dragPreview = (container, dom, nodeType) => {
|
|
|
44
44
|
parent.setAttribute('data-testid', 'block-ctrl-generic-drag-preview');
|
|
45
45
|
} else {
|
|
46
46
|
const resizer = dom.querySelector('.resizer-item');
|
|
47
|
-
const clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ?
|
|
47
|
+
const clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ?
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
50
|
+
resizer.cloneNode(true) :
|
|
51
|
+
// Ignored via go/ees005
|
|
52
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
53
|
+
dom.cloneNode(true);
|
|
48
54
|
|
|
49
55
|
// Remove any margin from the cloned element to ensure is doesn't position incorrectly
|
|
50
56
|
clonedDom.style.marginLeft = '0';
|
|
@@ -238,9 +238,15 @@ export const DropTargetV2 = props => {
|
|
|
238
238
|
anchorRectCache: anchorRectCache,
|
|
239
239
|
position: "lower",
|
|
240
240
|
isNestedDropTarget: isNestedDropTarget
|
|
241
|
-
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode) && jsx(Fragment, null, jsx(InlineDropTarget
|
|
241
|
+
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode) && jsx(Fragment, null, jsx(InlineDropTarget
|
|
242
|
+
// Ignored via go/ees005
|
|
243
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
244
|
+
, _extends({}, props, {
|
|
242
245
|
position: "left"
|
|
243
|
-
})), jsx(InlineDropTarget
|
|
246
|
+
})), jsx(InlineDropTarget
|
|
247
|
+
// Ignored via go/ees005
|
|
248
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
249
|
+
, _extends({}, props, {
|
|
244
250
|
position: "right"
|
|
245
251
|
}))));
|
|
246
252
|
};
|
|
@@ -23,6 +23,8 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
23
23
|
commands: {
|
|
24
24
|
moveNode: moveNode(api),
|
|
25
25
|
moveToLayout: moveToLayout(api),
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
28
|
showDragHandleAt: function showDragHandleAt(pos, anchorName, nodeType, handleOptions) {
|
|
27
29
|
return function (_ref3) {
|
|
28
30
|
var tr = _ref3.tr;
|
|
@@ -153,7 +153,10 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
153
153
|
export var moveNode = function moveNode(api) {
|
|
154
154
|
return function (start, to) {
|
|
155
155
|
var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : INPUT_METHOD.DRAG_AND_DROP;
|
|
156
|
-
var formatMessage
|
|
156
|
+
var formatMessage
|
|
157
|
+
// Ignored via go/ees005
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
159
|
+
= arguments.length > 3 ? arguments[3] : undefined;
|
|
157
160
|
return function (_ref4) {
|
|
158
161
|
var _node$nodeSize;
|
|
159
162
|
var tr = _ref4.tr;
|
|
@@ -32,7 +32,10 @@ var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
|
32
32
|
}
|
|
33
33
|
return null;
|
|
34
34
|
};
|
|
35
|
-
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, $originalFrom, $originalTo, api
|
|
35
|
+
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, $originalFrom, $originalTo, api
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
38
|
+
) {
|
|
36
39
|
var isSameLayout = isInSameLayout($originalFrom, $originalTo);
|
|
37
40
|
if (isSameLayout) {
|
|
38
41
|
var _$originalFrom$nodeAf;
|
|
@@ -76,7 +79,10 @@ var insertToDestinationNoWidthUpdate = function insertToDestinationNoWidthUpdate
|
|
|
76
79
|
tr.insert(to, content);
|
|
77
80
|
return tr;
|
|
78
81
|
};
|
|
79
|
-
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos
|
|
82
|
+
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos
|
|
83
|
+
// Ignored via go/ees005
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
85
|
+
) {
|
|
80
86
|
var _ref3 = updateColumnWidths(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
81
87
|
newColumnWidth = _ref3.newColumnWidth;
|
|
82
88
|
var _ref4 = tr.doc.type.schema.nodes || {},
|
|
@@ -17,13 +17,21 @@ export var showDragHandleAtSelection = function showDragHandleAtSelection(api, s
|
|
|
17
17
|
var parentPos = isInTable(state) ? $from.before(1) : shouldFocusParentNode ? $from.before(1) : getNestedNodePosition(state) + 1;
|
|
18
18
|
var parentElement = view === null || view === void 0 || (_view$domAtPos = view.domAtPos(parentPos, 0)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
19
19
|
if (parentElement) {
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
22
|
var anchorName = parentElement.getAttribute('data-drag-handler-anchor-name');
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
21
25
|
var nodeType = parentElement.getAttribute('data-drag-handler-node-type');
|
|
22
26
|
if (!anchorName || !nodeType) {
|
|
23
27
|
// for nodes like panel and mediaSingle, the drag handle decoration is not applied to the dom node at the node position but to the parent node
|
|
24
28
|
var closestParentElement = parentElement.closest('[data-drag-handler-anchor-name]');
|
|
25
29
|
if (closestParentElement) {
|
|
30
|
+
// Ignored via go/ees005
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
32
|
anchorName = closestParentElement.getAttribute('data-drag-handler-anchor-name');
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
35
|
nodeType = closestParentElement.getAttribute('data-drag-handler-node-type');
|
|
28
36
|
}
|
|
29
37
|
}
|
|
@@ -40,7 +48,11 @@ export var showDragHandleAtSelection = function showDragHandleAtSelection(api, s
|
|
|
40
48
|
var nodeElement = dom === null || dom === void 0 ? void 0 : dom.node.childNodes[dom === null || dom === void 0 ? void 0 : dom.offset];
|
|
41
49
|
var rootNode = nodeElement && !nodeElement.hasAttribute('data-drag-handler-anchor-name') && fg('platform_editor_element_drag_and_drop_ed_24321') ? nodeElement.querySelector('[data-drag-handler-anchor-name]') : nodeElement;
|
|
42
50
|
if (rootNode) {
|
|
51
|
+
// Ignored via go/ees005
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
53
|
var _anchorName = rootNode.getAttribute('data-drag-handler-anchor-name');
|
|
54
|
+
// Ignored via go/ees005
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
56
|
var _nodeType = rootNode.getAttribute('data-drag-handler-node-type');
|
|
45
57
|
if (api && _anchorName && _nodeType) {
|
|
46
58
|
api.core.actions.execute(api.blockControls.commands.showDragHandleAt(rootPos, _anchorName, _nodeType, {
|
|
@@ -20,7 +20,10 @@ export var shouldDescendIntoNode = function shouldDescendIntoNode(node) {
|
|
|
20
20
|
}
|
|
21
21
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
22
22
|
};
|
|
23
|
-
var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, parent
|
|
23
|
+
var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, parent
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
+
) {
|
|
24
27
|
var isEmbedCard = 'embedCard' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_3');
|
|
25
28
|
|
|
26
29
|
// TODO use isWrappedMedia when clean up the feature flag
|
|
@@ -55,7 +58,7 @@ export var findNodeDecs = function findNodeDecs(decorations, from, to) {
|
|
|
55
58
|
|
|
56
59
|
// return empty array if range reversed
|
|
57
60
|
if (newfrom !== undefined && newTo !== undefined && newfrom > newTo) {
|
|
58
|
-
return
|
|
61
|
+
return [];
|
|
59
62
|
}
|
|
60
63
|
return decorations.find(newfrom, newTo, function (spec) {
|
|
61
64
|
return spec.type === TYPE_NODE_DEC;
|
|
@@ -66,6 +69,8 @@ export var nodeDecorations = function nodeDecorations(newState, from, to) {
|
|
|
66
69
|
var docFrom = from === undefined || from < 0 ? 0 : from;
|
|
67
70
|
var docTo = to === undefined || to > newState.doc.nodeSize - 2 ? newState.doc.nodeSize - 2 : to;
|
|
68
71
|
var ignore_nodes = editorExperiment('advanced_layouts', true) ? IGNORE_NODES_NEXT : IGNORE_NODES;
|
|
72
|
+
// Ignored via go/ees005
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
69
74
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
70
75
|
var depth = 0;
|
|
71
76
|
var anchorName;
|
|
@@ -22,7 +22,10 @@ export var findHandleDec = function findHandleDec(decorations, from, to) {
|
|
|
22
22
|
return spec.type === TYPE_HANDLE_DEC;
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
export var dragHandleDecoration = function dragHandleDecoration(api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions
|
|
25
|
+
export var dragHandleDecoration = function dragHandleDecoration(api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
28
|
+
) {
|
|
26
29
|
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
27
30
|
var unbind;
|
|
28
31
|
var key = uuid();
|
|
@@ -81,7 +81,10 @@ export var findDropTargetDecs = function findDropTargetDecs(decorations, from, t
|
|
|
81
81
|
return spec.type === TYPE_DROP_TARGET_DEC;
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
-
export var createDropTargetDecoration = function createDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout
|
|
84
|
+
export var createDropTargetDecoration = function createDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout
|
|
85
|
+
// Ignored via go/ees005
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
87
|
+
) {
|
|
85
88
|
var key = uuid();
|
|
86
89
|
return Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
87
90
|
var getPos = function getPos() {
|
|
@@ -136,7 +139,10 @@ export var createDropTargetDecoration = function createDropTargetDecoration(pos,
|
|
|
136
139
|
side: side
|
|
137
140
|
});
|
|
138
141
|
};
|
|
139
|
-
export var createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache
|
|
142
|
+
export var createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache
|
|
143
|
+
// Ignored via go/ees005
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
145
|
+
) {
|
|
140
146
|
var key = uuid();
|
|
141
147
|
return Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
142
148
|
var getPos = function getPos() {
|
|
@@ -168,7 +174,10 @@ export var createLayoutDropTargetDecoration = function createLayoutDropTargetDec
|
|
|
168
174
|
type: TYPE_DROP_TARGET_DEC
|
|
169
175
|
});
|
|
170
176
|
};
|
|
171
|
-
export var dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to
|
|
177
|
+
export var dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to
|
|
178
|
+
// Ignored via go/ees005
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
180
|
+
) {
|
|
172
181
|
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
173
182
|
var decs = [];
|
|
174
183
|
var POS_END_OF_DOC = newState.doc.nodeSize - 2;
|
|
@@ -193,6 +202,9 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
193
202
|
prevNodeStack.push(node);
|
|
194
203
|
};
|
|
195
204
|
var isAdvancedLayoutsPreRelease2 = editorExperiment('advanced_layouts', true);
|
|
205
|
+
|
|
206
|
+
// Ignored via go/ees005
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
196
208
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
197
209
|
var depth = 0;
|
|
198
210
|
// drop target deco at the end position
|
|
@@ -18,6 +18,9 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
18
18
|
if (isDragging) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
21
24
|
var target = event.target;
|
|
22
25
|
if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
|
|
23
26
|
return false;
|
|
@@ -52,6 +55,9 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
52
55
|
rootElement = parentElement;
|
|
53
56
|
}
|
|
54
57
|
}
|
|
58
|
+
|
|
59
|
+
// Ignored via go/ees005
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
55
61
|
var anchorName = rootElement.getAttribute('data-drag-handler-anchor-name');
|
|
56
62
|
// No need to update handle position if its already there
|
|
57
63
|
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
|
|
@@ -8,16 +8,31 @@ import { DIRECTION } from './utils/consts';
|
|
|
8
8
|
function keymapList(api, formatMessage) {
|
|
9
9
|
var keymapList = {};
|
|
10
10
|
if (api && fg('platform_editor_element_drag_and_drop_ed_23873')) {
|
|
11
|
-
bindKeymapWithCommand(
|
|
11
|
+
bindKeymapWithCommand(
|
|
12
|
+
// Ignored via go/ees005
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
|
+
showElementDragHandle.common, function (state, dispatch, view) {
|
|
12
15
|
showDragHandleAtSelection(api)(state, dispatch, view);
|
|
13
16
|
//we always want to handle this shortcut to prevent default browser special char insert when option + alphabetical key is used
|
|
14
17
|
return true;
|
|
15
18
|
}, keymapList);
|
|
16
|
-
bindKeymapWithCommand(
|
|
17
|
-
|
|
19
|
+
bindKeymapWithCommand(
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
|
+
dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP, formatMessage), keymapList);
|
|
23
|
+
bindKeymapWithCommand(
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
|
+
dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN, formatMessage), keymapList);
|
|
18
27
|
if (editorExperiment('nested-dnd', true) && fg('platform_editor_element_dnd_nested_a11y')) {
|
|
19
|
-
bindKeymapWithCommand(
|
|
20
|
-
|
|
28
|
+
bindKeymapWithCommand(
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
31
|
+
dragToMoveLeft.common, moveNodeViaShortcut(api, DIRECTION.LEFT, formatMessage), keymapList);
|
|
32
|
+
bindKeymapWithCommand(
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
+
dragToMoveRight.common, moveNodeViaShortcut(api, DIRECTION.RIGHT, formatMessage), keymapList);
|
|
21
36
|
}
|
|
22
37
|
}
|
|
23
38
|
return keymapList;
|
|
@@ -91,7 +91,10 @@ var initialState = {
|
|
|
91
91
|
isDocSizeLimitEnabled: null,
|
|
92
92
|
isPMDragging: false
|
|
93
93
|
};
|
|
94
|
-
export var newApply = function newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
94
|
+
export var newApply = function newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
95
|
+
// Ignored via go/ees005
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
97
|
+
) {
|
|
95
98
|
var _meta$activeNode, _activeNode, _activeNode2, _meta$activeNode$hand, _meta$isDragging, _meta$isDragging2, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
|
|
96
99
|
var activeNode = currentState.activeNode,
|
|
97
100
|
decorations = currentState.decorations,
|
|
@@ -222,7 +225,10 @@ export var newApply = function newApply(api, formatMessage, tr, currentState, ne
|
|
|
222
225
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging
|
|
223
226
|
};
|
|
224
227
|
};
|
|
225
|
-
export var oldApply = function oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
228
|
+
export var oldApply = function oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache
|
|
229
|
+
// Ignored via go/ees005
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
231
|
+
) {
|
|
226
232
|
var _meta$activeNode2, _meta$activeNode$hand2, _activeNodeWithNewNod, _meta$activeNode8, _meta$isDragging4, _meta$editorHeight2, _meta$editorWidthLeft2, _meta$editorWidthRigh2, _meta$isPMDragging2;
|
|
227
233
|
var isNestedEnabled = flags.isNestedEnabled;
|
|
228
234
|
var activeNode = currentState.activeNode,
|
|
@@ -436,6 +442,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
436
442
|
init: function init() {
|
|
437
443
|
return initialState;
|
|
438
444
|
},
|
|
445
|
+
// Ignored via go/ees005
|
|
446
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
439
447
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
440
448
|
if (isNestedEnabled) {
|
|
441
449
|
return newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
@@ -571,7 +579,11 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
571
579
|
}
|
|
572
580
|
if (!isResizerResizing) {
|
|
573
581
|
var _editorContentArea = entries[0].target;
|
|
582
|
+
// Ignored via go/ees005
|
|
583
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
574
584
|
var editorWidthRight = _editorContentArea.getBoundingClientRect().right;
|
|
585
|
+
// Ignored via go/ees005
|
|
586
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
575
587
|
var editorWidthLeft = _editorContentArea.getBoundingClientRect().left;
|
|
576
588
|
transaction.setMeta(key, {
|
|
577
589
|
editorWidthLeft: editorWidthLeft,
|
|
@@ -32,7 +32,10 @@ export var getTopPosition = function getTopPosition(dom, type) {
|
|
|
32
32
|
return "".concat(dom.offsetTop, "px");
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
export var getLeftPosition = function getLeftPosition(dom, type, innerContainer, macroInteractionUpdates, parentType
|
|
35
|
+
export var getLeftPosition = function getLeftPosition(dom, type, innerContainer, macroInteractionUpdates, parentType
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
38
|
+
) {
|
|
36
39
|
if (!dom) {
|
|
37
40
|
return 'auto';
|
|
38
41
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export var fireMoveNodeAnalytics = function fireMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
2
|
+
export var fireMoveNodeAnalytics = function fireMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
5
|
+
) {
|
|
3
6
|
var _api$analytics;
|
|
4
7
|
return api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.attachAnalyticsEvent({
|
|
5
8
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -4,7 +4,10 @@ import { isWrappedMedia } from './check-media-layout';
|
|
|
4
4
|
import { maxLayoutColumnSupported } from './consts';
|
|
5
5
|
export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
|
|
6
6
|
var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7
|
-
var activeNode
|
|
7
|
+
var activeNode
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
|
+
= arguments.length > 3 ? arguments[3] : undefined;
|
|
8
11
|
if (editorExperiment('advanced_layouts', false) || isNested) {
|
|
9
12
|
return false;
|
|
10
13
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../../ui/consts';
|
|
2
|
-
export var updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount
|
|
2
|
+
export var updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
5
|
+
) {
|
|
3
6
|
var newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
4
7
|
if (newColumnWidth) {
|
|
5
8
|
layoutNode.content.forEach(function (node, offset) {
|
|
@@ -70,6 +70,9 @@ export var memoizedTransformExpandToNestedExpand = memoizeOne(function (node) {
|
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
|
|
74
|
+
// Ignored via go/ees005
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
73
76
|
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
74
77
|
var srcNodeType = srcNode.type;
|
|
75
78
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
@@ -44,7 +44,13 @@ export var dragPreview = function dragPreview(container, dom, nodeType) {
|
|
|
44
44
|
parent.setAttribute('data-testid', 'block-ctrl-generic-drag-preview');
|
|
45
45
|
} else {
|
|
46
46
|
var resizer = dom.querySelector('.resizer-item');
|
|
47
|
-
var clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ?
|
|
47
|
+
var clonedDom = resizer && ['mediaSingle', 'table'].includes(nodeType) ?
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
50
|
+
resizer.cloneNode(true) :
|
|
51
|
+
// Ignored via go/ees005
|
|
52
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
53
|
+
dom.cloneNode(true);
|
|
48
54
|
|
|
49
55
|
// Remove any margin from the cloned element to ensure is doesn't position incorrectly
|
|
50
56
|
clonedDom.style.marginLeft = '0';
|
|
@@ -245,9 +245,15 @@ export var DropTargetV2 = function DropTargetV2(props) {
|
|
|
245
245
|
anchorRectCache: anchorRectCache,
|
|
246
246
|
position: "lower",
|
|
247
247
|
isNestedDropTarget: isNestedDropTarget
|
|
248
|
-
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode) && jsx(Fragment, null, jsx(InlineDropTarget
|
|
248
|
+
}), shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode) && jsx(Fragment, null, jsx(InlineDropTarget
|
|
249
|
+
// Ignored via go/ees005
|
|
250
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
251
|
+
, _extends({}, props, {
|
|
249
252
|
position: "left"
|
|
250
|
-
})), jsx(InlineDropTarget
|
|
253
|
+
})), jsx(InlineDropTarget
|
|
254
|
+
// Ignored via go/ees005
|
|
255
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
256
|
+
, _extends({}, props, {
|
|
251
257
|
position: "right"
|
|
252
258
|
}))));
|
|
253
259
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference path="../../../../../../../typings/events.d.ts" />
|
|
2
1
|
/// <reference types="node" />
|
|
3
2
|
/// <reference types="node/events" />
|
|
3
|
+
/// <reference types="typings/events" />
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
export declare class ActiveAnchorTracker {
|
|
6
6
|
emitter: EventEmitter | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference path="../../../../../../../typings/events.d.ts" />
|
|
2
1
|
/// <reference types="node" />
|
|
3
2
|
/// <reference types="node/events" />
|
|
3
|
+
/// <reference types="typings/events" />
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
export declare class ActiveAnchorTracker {
|
|
6
6
|
emitter: EventEmitter | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
34
|
-
"@atlaskit/editor-common": "^97.
|
|
34
|
+
"@atlaskit/editor-common": "^97.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-quick-insert": "^1.8.0",
|
|
40
|
-
"@atlaskit/editor-plugin-width": "^
|
|
40
|
+
"@atlaskit/editor-plugin-width": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.8.0",
|