@atlaskit/editor-plugin-block-controls 1.4.28 → 1.4.29

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.4.29
4
+
5
+ ### Patch Changes
6
+
7
+ - [#113919](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113919)
8
+ [`b23ee751fde25`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b23ee751fde25) -
9
+ [ux] fix : the page is not scrolled down when click on the handle of a long node
10
+ - [#113848](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113848)
11
+ [`173e8cc6ecdb3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/173e8cc6ecdb3) -
12
+ ED-23779 fix undo caused wrong selector position
13
+
3
14
  ## 1.4.28
4
15
 
5
16
  ### Patch Changes
@@ -89,7 +89,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
89
89
  return initialState;
90
90
  },
91
91
  apply: function apply(tr, currentState, oldState, newState) {
92
- var _meta$activeNode, _meta$isDragging, _meta$editorHeight;
92
+ var _meta$activeNode, _meta$activeNode2, _meta$isDragging, _meta$editorHeight;
93
93
  if (initialState.isDocSizeLimitEnabled && newState.doc.nodeSize > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
94
94
  return initialState;
95
95
  }
@@ -123,7 +123,15 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
123
123
 
124
124
  // This is not targeted enough - it's trying to catch events like expand being set to breakout
125
125
  var maybeWidthUpdated = tr.docChanged && oldState.doc.nodeSize === newState.doc.nodeSize && !nodeCountChanged;
126
- var redrawDecorations = decorations === _view.DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || maybeWidthUpdated || nodeCountChanged || resizerMeta === false || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
126
+
127
+ // This addresses scenarios such as undoing table resizing,
128
+ // where a keyboard shortcut triggers a width change, and
129
+ // the node's actual width is then updated in a separate renderering cycle.
130
+ // The tr.meta.activeNode is triggered by the showDragHandleAt function during the mouse entry event
131
+ // (when the table node rerenders)
132
+ // The activeNode is from the previous rendering cycle, and verify if they share the same anchor.
133
+ var maybeNodeWidthUpdated = (meta === null || meta === void 0 ? void 0 : meta.activeNode) && (meta === null || meta === void 0 || (_meta$activeNode = meta.activeNode) === null || _meta$activeNode === void 0 ? void 0 : _meta$activeNode.nodeType) === 'table' && meta.activeNode.anchorName === (activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName);
134
+ var redrawDecorations = decorations === _view.DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || maybeWidthUpdated || nodeCountChanged || maybeNodeWidthUpdated || resizerMeta === false || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
127
135
 
128
136
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
129
137
  if (redrawDecorations && !isResizerResizing && api) {
@@ -204,7 +212,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
204
212
  return {
205
213
  decorations: decorations,
206
214
  decorationState: decorationState,
207
- activeNode: isEmptyDoc ? null : (_meta$activeNode = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode !== void 0 ? _meta$activeNode : mappedActiveNodePos,
215
+ activeNode: isEmptyDoc ? null : (_meta$activeNode2 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode2 !== void 0 ? _meta$activeNode2 : mappedActiveNodePos,
208
216
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
209
217
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
210
218
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -89,7 +89,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
89
89
  }
90
90
  }, [anchorName, nodeType, view.dom]);
91
91
  var handleOnClick = (0, _react.useCallback)(function () {
92
- var _api$core, _api$core2;
92
+ var _api$core;
93
93
  setDragHandleSelected(!dragHandleSelected);
94
94
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
95
95
  var tr = _ref2.tr;
@@ -102,15 +102,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
102
102
  });
103
103
  return tr;
104
104
  });
105
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
106
- }, [start, api, dragHandleSelected, setDragHandleSelected, nodeType]);
105
+ view.focus();
106
+ }, [start, api, view, dragHandleSelected, setDragHandleSelected, nodeType]);
107
107
 
108
108
  // handleMouseDown required along with onClick to ensure the correct selection
109
109
  // is set immediately when the drag handle is clicked. Otherwise browser native
110
110
  // drag and drop can take over and cause unpredictable behaviour.
111
111
  var handleMouseDown = (0, _react.useCallback)(function () {
112
- var _api$core3, _api$core4;
113
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
112
+ var _api$core2;
113
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
114
114
  var tr = _ref3.tr;
115
115
  if (start === undefined) {
116
116
  return tr;
@@ -121,8 +121,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
121
121
  });
122
122
  return tr;
123
123
  });
124
- api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.focus();
125
- }, [start, api, nodeType]);
124
+ view.focus();
125
+ }, [start, api, view, nodeType]);
126
126
  (0, _react.useEffect)(function () {
127
127
  var element = buttonRef.current;
128
128
  if (!element) {
@@ -151,11 +151,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
151
151
  });
152
152
  },
153
153
  onDragStart: function onDragStart() {
154
- var _api$core5, _api$core6;
154
+ var _api$core3;
155
155
  if (start === undefined) {
156
156
  return;
157
157
  }
158
- api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref6) {
158
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref6) {
159
159
  var _api$blockControls, _api$analytics;
160
160
  var tr = _ref6.tr;
161
161
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.setNodeDragged(start, anchorName, nodeType)({
@@ -163,6 +163,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
163
163
  });
164
164
  var resolvedMovingNode = tr.doc.resolve(start);
165
165
  var maybeNode = resolvedMovingNode.nodeAfter;
166
+ tr.setMeta('scrollIntoView', false);
166
167
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
167
168
  eventType: _analytics.EVENT_TYPE.UI,
168
169
  action: _analytics.ACTION.DRAGGED,
@@ -175,7 +176,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
175
176
  })(tr);
176
177
  return tr;
177
178
  });
178
- api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.focus();
179
+ view.focus();
179
180
  }
180
181
  });
181
182
  }, [anchorName, api, nodeType, view, start]);
@@ -32,7 +32,7 @@ var getSelection = exports.getSelection = function getSelection(tr, start) {
32
32
  return true;
33
33
  });
34
34
  var inlineNodeDepth = inlineNodePos - start;
35
- return new _state.TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(start + nodeSize - inlineNodeDepth));
35
+ return new _state.TextSelection(tr.doc.resolve(start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
36
36
  }
37
37
  };
38
38
  var selectNode = exports.selectNode = function selectNode(tr, start, nodeType) {
@@ -83,7 +83,7 @@ export const createPlugin = api => {
83
83
  return initialState;
84
84
  },
85
85
  apply(tr, currentState, oldState, newState) {
86
- var _meta$activeNode, _meta$isDragging, _meta$editorHeight;
86
+ var _meta$activeNode, _meta$activeNode2, _meta$isDragging, _meta$editorHeight;
87
87
  if (initialState.isDocSizeLimitEnabled && newState.doc.nodeSize > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
88
88
  return initialState;
89
89
  }
@@ -116,7 +116,15 @@ export const createPlugin = api => {
116
116
 
117
117
  // This is not targeted enough - it's trying to catch events like expand being set to breakout
118
118
  const maybeWidthUpdated = tr.docChanged && oldState.doc.nodeSize === newState.doc.nodeSize && !nodeCountChanged;
119
- const redrawDecorations = decorations === DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || maybeWidthUpdated || nodeCountChanged || resizerMeta === false || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
119
+
120
+ // This addresses scenarios such as undoing table resizing,
121
+ // where a keyboard shortcut triggers a width change, and
122
+ // the node's actual width is then updated in a separate renderering cycle.
123
+ // The tr.meta.activeNode is triggered by the showDragHandleAt function during the mouse entry event
124
+ // (when the table node rerenders)
125
+ // The activeNode is from the previous rendering cycle, and verify if they share the same anchor.
126
+ const maybeNodeWidthUpdated = (meta === null || meta === void 0 ? void 0 : meta.activeNode) && (meta === null || meta === void 0 ? void 0 : (_meta$activeNode = meta.activeNode) === null || _meta$activeNode === void 0 ? void 0 : _meta$activeNode.nodeType) === 'table' && meta.activeNode.anchorName === (activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName);
127
+ const redrawDecorations = decorations === DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || maybeWidthUpdated || nodeCountChanged || maybeNodeWidthUpdated || resizerMeta === false || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
120
128
 
121
129
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
122
130
  if (redrawDecorations && !isResizerResizing && api) {
@@ -197,7 +205,7 @@ export const createPlugin = api => {
197
205
  return {
198
206
  decorations,
199
207
  decorationState,
200
- activeNode: isEmptyDoc ? null : (_meta$activeNode = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode !== void 0 ? _meta$activeNode : mappedActiveNodePos,
208
+ activeNode: isEmptyDoc ? null : (_meta$activeNode2 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode2 !== void 0 ? _meta$activeNode2 : mappedActiveNodePos,
201
209
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
202
210
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
203
211
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -74,7 +74,7 @@ export const DragHandle = ({
74
74
  }
75
75
  }, [anchorName, nodeType, view.dom]);
76
76
  const handleOnClick = useCallback(() => {
77
- var _api$core, _api$core2;
77
+ var _api$core;
78
78
  setDragHandleSelected(!dragHandleSelected);
79
79
  api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
80
80
  tr
@@ -88,15 +88,15 @@ export const DragHandle = ({
88
88
  });
89
89
  return tr;
90
90
  });
91
- api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.focus();
92
- }, [start, api, dragHandleSelected, setDragHandleSelected, nodeType]);
91
+ view.focus();
92
+ }, [start, api, view, dragHandleSelected, setDragHandleSelected, nodeType]);
93
93
 
94
94
  // handleMouseDown required along with onClick to ensure the correct selection
95
95
  // is set immediately when the drag handle is clicked. Otherwise browser native
96
96
  // drag and drop can take over and cause unpredictable behaviour.
97
97
  const handleMouseDown = useCallback(() => {
98
- var _api$core3, _api$core4;
99
- api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(({
98
+ var _api$core2;
99
+ api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
100
100
  tr
101
101
  }) => {
102
102
  if (start === undefined) {
@@ -108,8 +108,8 @@ export const DragHandle = ({
108
108
  });
109
109
  return tr;
110
110
  });
111
- api === null || api === void 0 ? void 0 : (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions.focus();
112
- }, [start, api, nodeType]);
111
+ view.focus();
112
+ }, [start, api, view, nodeType]);
113
113
  useEffect(() => {
114
114
  const element = buttonRef.current;
115
115
  if (!element) {
@@ -138,11 +138,11 @@ export const DragHandle = ({
138
138
  });
139
139
  },
140
140
  onDragStart() {
141
- var _api$core5, _api$core6;
141
+ var _api$core3;
142
142
  if (start === undefined) {
143
143
  return;
144
144
  }
145
- api === null || api === void 0 ? void 0 : (_api$core5 = api.core) === null || _api$core5 === void 0 ? void 0 : _api$core5.actions.execute(({
145
+ api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(({
146
146
  tr
147
147
  }) => {
148
148
  var _api$blockControls, _api$analytics;
@@ -151,6 +151,7 @@ export const DragHandle = ({
151
151
  });
152
152
  const resolvedMovingNode = tr.doc.resolve(start);
153
153
  const maybeNode = resolvedMovingNode.nodeAfter;
154
+ tr.setMeta('scrollIntoView', false);
154
155
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
155
156
  eventType: EVENT_TYPE.UI,
156
157
  action: ACTION.DRAGGED,
@@ -163,7 +164,7 @@ export const DragHandle = ({
163
164
  })(tr);
164
165
  return tr;
165
166
  });
166
- api === null || api === void 0 ? void 0 : (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions.focus();
167
+ view.focus();
167
168
  }
168
169
  });
169
170
  }, [anchorName, api, nodeType, view, start]);
@@ -26,7 +26,7 @@ export const getSelection = (tr, start) => {
26
26
  return true;
27
27
  });
28
28
  const inlineNodeDepth = inlineNodePos - start;
29
- return new TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(start + nodeSize - inlineNodeDepth));
29
+ return new TextSelection(tr.doc.resolve(start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
30
30
  }
31
31
  };
32
32
  export const selectNode = (tr, start, nodeType) => {
@@ -82,7 +82,7 @@ export var createPlugin = function createPlugin(api) {
82
82
  return initialState;
83
83
  },
84
84
  apply: function apply(tr, currentState, oldState, newState) {
85
- var _meta$activeNode, _meta$isDragging, _meta$editorHeight;
85
+ var _meta$activeNode, _meta$activeNode2, _meta$isDragging, _meta$editorHeight;
86
86
  if (initialState.isDocSizeLimitEnabled && newState.doc.nodeSize > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
87
87
  return initialState;
88
88
  }
@@ -116,7 +116,15 @@ export var createPlugin = function createPlugin(api) {
116
116
 
117
117
  // This is not targeted enough - it's trying to catch events like expand being set to breakout
118
118
  var maybeWidthUpdated = tr.docChanged && oldState.doc.nodeSize === newState.doc.nodeSize && !nodeCountChanged;
119
- var redrawDecorations = decorations === DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || maybeWidthUpdated || nodeCountChanged || resizerMeta === false || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
119
+
120
+ // This addresses scenarios such as undoing table resizing,
121
+ // where a keyboard shortcut triggers a width change, and
122
+ // the node's actual width is then updated in a separate renderering cycle.
123
+ // The tr.meta.activeNode is triggered by the showDragHandleAt function during the mouse entry event
124
+ // (when the table node rerenders)
125
+ // The activeNode is from the previous rendering cycle, and verify if they share the same anchor.
126
+ var maybeNodeWidthUpdated = (meta === null || meta === void 0 ? void 0 : meta.activeNode) && (meta === null || meta === void 0 || (_meta$activeNode = meta.activeNode) === null || _meta$activeNode === void 0 ? void 0 : _meta$activeNode.nodeType) === 'table' && meta.activeNode.anchorName === (activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName);
127
+ var redrawDecorations = decorations === DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || maybeWidthUpdated || nodeCountChanged || maybeNodeWidthUpdated || resizerMeta === false || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
120
128
 
121
129
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
122
130
  if (redrawDecorations && !isResizerResizing && api) {
@@ -197,7 +205,7 @@ export var createPlugin = function createPlugin(api) {
197
205
  return {
198
206
  decorations: decorations,
199
207
  decorationState: decorationState,
200
- activeNode: isEmptyDoc ? null : (_meta$activeNode = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode !== void 0 ? _meta$activeNode : mappedActiveNodePos,
208
+ activeNode: isEmptyDoc ? null : (_meta$activeNode2 = meta === null || meta === void 0 ? void 0 : meta.activeNode) !== null && _meta$activeNode2 !== void 0 ? _meta$activeNode2 : mappedActiveNodePos,
201
209
  isDragging: (_meta$isDragging = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging !== void 0 ? _meta$isDragging : isDragging,
202
210
  isMenuOpen: meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen,
203
211
  editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : currentState.editorHeight,
@@ -81,7 +81,7 @@ export var DragHandle = function DragHandle(_ref) {
81
81
  }
82
82
  }, [anchorName, nodeType, view.dom]);
83
83
  var handleOnClick = useCallback(function () {
84
- var _api$core, _api$core2;
84
+ var _api$core;
85
85
  setDragHandleSelected(!dragHandleSelected);
86
86
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
87
87
  var tr = _ref2.tr;
@@ -94,15 +94,15 @@ export var DragHandle = function DragHandle(_ref) {
94
94
  });
95
95
  return tr;
96
96
  });
97
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
98
- }, [start, api, dragHandleSelected, setDragHandleSelected, nodeType]);
97
+ view.focus();
98
+ }, [start, api, view, dragHandleSelected, setDragHandleSelected, nodeType]);
99
99
 
100
100
  // handleMouseDown required along with onClick to ensure the correct selection
101
101
  // is set immediately when the drag handle is clicked. Otherwise browser native
102
102
  // drag and drop can take over and cause unpredictable behaviour.
103
103
  var handleMouseDown = useCallback(function () {
104
- var _api$core3, _api$core4;
105
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
104
+ var _api$core2;
105
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
106
106
  var tr = _ref3.tr;
107
107
  if (start === undefined) {
108
108
  return tr;
@@ -113,8 +113,8 @@ export var DragHandle = function DragHandle(_ref) {
113
113
  });
114
114
  return tr;
115
115
  });
116
- api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.focus();
117
- }, [start, api, nodeType]);
116
+ view.focus();
117
+ }, [start, api, view, nodeType]);
118
118
  useEffect(function () {
119
119
  var element = buttonRef.current;
120
120
  if (!element) {
@@ -143,11 +143,11 @@ export var DragHandle = function DragHandle(_ref) {
143
143
  });
144
144
  },
145
145
  onDragStart: function onDragStart() {
146
- var _api$core5, _api$core6;
146
+ var _api$core3;
147
147
  if (start === undefined) {
148
148
  return;
149
149
  }
150
- api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref6) {
150
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref6) {
151
151
  var _api$blockControls, _api$analytics;
152
152
  var tr = _ref6.tr;
153
153
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.setNodeDragged(start, anchorName, nodeType)({
@@ -155,6 +155,7 @@ export var DragHandle = function DragHandle(_ref) {
155
155
  });
156
156
  var resolvedMovingNode = tr.doc.resolve(start);
157
157
  var maybeNode = resolvedMovingNode.nodeAfter;
158
+ tr.setMeta('scrollIntoView', false);
158
159
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
159
160
  eventType: EVENT_TYPE.UI,
160
161
  action: ACTION.DRAGGED,
@@ -167,7 +168,7 @@ export var DragHandle = function DragHandle(_ref) {
167
168
  })(tr);
168
169
  return tr;
169
170
  });
170
- api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.focus();
171
+ view.focus();
171
172
  }
172
173
  });
173
174
  }, [anchorName, api, nodeType, view, start]);
@@ -26,7 +26,7 @@ export var getSelection = function getSelection(tr, start) {
26
26
  return true;
27
27
  });
28
28
  var inlineNodeDepth = inlineNodePos - start;
29
- return new TextSelection(tr.doc.resolve(inlineNodePos), tr.doc.resolve(start + nodeSize - inlineNodeDepth));
29
+ return new TextSelection(tr.doc.resolve(start + nodeSize - inlineNodeDepth), tr.doc.resolve(inlineNodePos));
30
30
  }
31
31
  };
32
32
  export var selectNode = function selectNode(tr, start, nodeType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.4.28",
3
+ "version": "1.4.29",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^37.0.0",
35
- "@atlaskit/editor-common": "^82.12.0",
35
+ "@atlaskit/editor-common": "^82.13.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.3.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.5",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",