@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
@@ -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) ? resizer.cloneNode(true) : dom.cloneNode(true);
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, _extends({}, props, {
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, _extends({}, props, {
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 = arguments.length > 3 ? arguments[3] : undefined;
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 new Array();
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(showElementDragHandle.common, function (state, dispatch, view) {
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(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;
@@ -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 = arguments.length > 3 ? arguments[3] : undefined;
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) ? resizer.cloneNode(true) : dom.cloneNode(true);
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, _extends({}, props, {
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, _extends({}, props, {
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.0",
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": "^96.8.0",
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": "^1.3.0",
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",