@atlaskit/editor-plugin-block-controls 2.16.0 → 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.
Files changed (55) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/blockControlsPlugin.js +2 -0
  3. package/dist/cjs/editor-commands/move-node.js +4 -1
  4. package/dist/cjs/editor-commands/move-to-layout.js +8 -2
  5. package/dist/cjs/editor-commands/show-drag-handle.js +12 -0
  6. package/dist/cjs/pm-plugins/decorations-anchor.js +7 -2
  7. package/dist/cjs/pm-plugins/decorations-drag-handle.js +4 -1
  8. package/dist/cjs/pm-plugins/decorations-drop-target.js +15 -3
  9. package/dist/cjs/pm-plugins/handle-mouse-over.js +6 -0
  10. package/dist/cjs/pm-plugins/keymap.js +20 -5
  11. package/dist/cjs/pm-plugins/main.js +14 -2
  12. package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +4 -1
  13. package/dist/cjs/pm-plugins/utils/fire-analytics.js +4 -1
  14. package/dist/cjs/pm-plugins/utils/inline-drop-target.js +4 -1
  15. package/dist/cjs/pm-plugins/utils/update-column-widths.js +4 -1
  16. package/dist/cjs/pm-plugins/utils/validation.js +3 -0
  17. package/dist/cjs/ui/drag-preview.js +7 -1
  18. package/dist/cjs/ui/drop-target-v2.js +8 -2
  19. package/dist/es2019/blockControlsPlugin.js +2 -0
  20. package/dist/es2019/editor-commands/move-node.js +4 -1
  21. package/dist/es2019/editor-commands/move-to-layout.js +8 -2
  22. package/dist/es2019/editor-commands/show-drag-handle.js +12 -0
  23. package/dist/es2019/pm-plugins/decorations-anchor.js +7 -2
  24. package/dist/es2019/pm-plugins/decorations-drag-handle.js +4 -1
  25. package/dist/es2019/pm-plugins/decorations-drop-target.js +15 -3
  26. package/dist/es2019/pm-plugins/handle-mouse-over.js +6 -0
  27. package/dist/es2019/pm-plugins/keymap.js +20 -5
  28. package/dist/es2019/pm-plugins/main.js +14 -2
  29. package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +4 -1
  30. package/dist/es2019/pm-plugins/utils/fire-analytics.js +4 -1
  31. package/dist/es2019/pm-plugins/utils/inline-drop-target.js +4 -1
  32. package/dist/es2019/pm-plugins/utils/update-column-widths.js +4 -1
  33. package/dist/es2019/pm-plugins/utils/validation.js +3 -0
  34. package/dist/es2019/ui/drag-preview.js +7 -1
  35. package/dist/es2019/ui/drop-target-v2.js +8 -2
  36. package/dist/esm/blockControlsPlugin.js +2 -0
  37. package/dist/esm/editor-commands/move-node.js +4 -1
  38. package/dist/esm/editor-commands/move-to-layout.js +8 -2
  39. package/dist/esm/editor-commands/show-drag-handle.js +12 -0
  40. package/dist/esm/pm-plugins/decorations-anchor.js +7 -2
  41. package/dist/esm/pm-plugins/decorations-drag-handle.js +4 -1
  42. package/dist/esm/pm-plugins/decorations-drop-target.js +15 -3
  43. package/dist/esm/pm-plugins/handle-mouse-over.js +6 -0
  44. package/dist/esm/pm-plugins/keymap.js +20 -5
  45. package/dist/esm/pm-plugins/main.js +14 -2
  46. package/dist/esm/pm-plugins/utils/drag-handle-positions.js +4 -1
  47. package/dist/esm/pm-plugins/utils/fire-analytics.js +4 -1
  48. package/dist/esm/pm-plugins/utils/inline-drop-target.js +4 -1
  49. package/dist/esm/pm-plugins/utils/update-column-widths.js +4 -1
  50. package/dist/esm/pm-plugins/utils/validation.js +3 -0
  51. package/dist/esm/ui/drag-preview.js +7 -1
  52. package/dist/esm/ui/drop-target-v2.js +8 -2
  53. package/dist/types/pm-plugins/utils/active-anchor-tracker.d.ts +1 -1
  54. package/dist/types-ts4.5/pm-plugins/utils/active-anchor-tracker.d.ts +1 -1
  55. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.16.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 2.16.0
4
16
 
5
17
  ### Minor Changes
@@ -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 = arguments.length > 3 ? arguments[3] : undefined;
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 new Array();
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)(_keymaps.showElementDragHandle.common, function (state, dispatch, view) {
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)(_keymaps.dragToMoveUp.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.UP, formatMessage), keymapList);
23
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.dragToMoveDown.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.DOWN, formatMessage), keymapList);
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)(_keymaps.dragToMoveLeft.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.LEFT, formatMessage), keymapList);
26
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.dragToMoveRight.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.RIGHT, formatMessage), keymapList);
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 = arguments.length > 3 ? arguments[3] : undefined;
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) ? resizer.cloneNode(true) : dom.cloneNode(true);
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, (0, _extends2.default)({}, props, {
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, (0, _extends2.default)({}, props, {
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 new Array();
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(showElementDragHandle.common, (state, dispatch, view) => {
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(dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP, formatMessage), keymapList);
17
- bindKeymapWithCommand(dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN, formatMessage), keymapList);
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(dragToMoveLeft.common, moveNodeViaShortcut(api, DIRECTION.LEFT, formatMessage), keymapList);
20
- bindKeymapWithCommand(dragToMoveRight.common, moveNodeViaShortcut(api, DIRECTION.RIGHT, formatMessage), keymapList);
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;