@atlaskit/editor-plugin-extension 1.0.1 → 1.0.3

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,19 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#74716](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74716) [`e4dcc12c4f8d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e4dcc12c4f8d) - ED-22048 Disable MBE partial selection to fix unwanted extensionFrame deletion.
8
+ - Updated dependencies
9
+
10
+ ## 1.0.2
11
+
12
+ ### Patch Changes
13
+
14
+ - [#72671](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72671) [`c446a8ca183b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c446a8ca183b) - ED-21912 Adding support for left arrow navigation from within MBE tabs.
15
+ - Updated dependencies
16
+
3
17
  ## 1.0.1
4
18
 
5
19
  ### Patch Changes
@@ -180,7 +180,6 @@ function _onChangeAction() {
180
180
  _ref6,
181
181
  positions,
182
182
  node,
183
- newAttributes,
184
183
  newNode,
185
184
  positionUpdated,
186
185
  transaction,
@@ -238,18 +237,15 @@ function _onChangeAction() {
238
237
  return _context3.abrupt("return");
239
238
  case 23:
240
239
  node = nodeWithPos.node;
241
- newAttributes = _objectSpread(_objectSpread({}, node.attrs), {}, {
242
- parameters: _objectSpread(_objectSpread(_objectSpread({}, oldParameters), newParameters), {}, {
243
- macroParams: _objectSpread(_objectSpread({}, oldParameters === null || oldParameters === void 0 ? void 0 : oldParameters.macroParams), newParameters === null || newParameters === void 0 ? void 0 : newParameters.macroParams)
244
- })
245
- });
246
- newNode = (0, _actions.buildExtensionNode)(nodeWithPos.node.toJSON().type, editorView.state.schema, newAttributes, node.content, node.marks);
240
+ newNode = (0, _actions.buildExtensionNode)(nodeWithPos.node.toJSON().type, editorView.state.schema, _objectSpread(_objectSpread({}, node.attrs), {}, {
241
+ parameters: _objectSpread(_objectSpread({}, oldParameters), newParameters)
242
+ }), node.content, node.marks);
247
243
  if (newNode) {
248
- _context3.next = 28;
244
+ _context3.next = 27;
249
245
  break;
250
246
  }
251
247
  return _context3.abrupt("return");
252
- case 28:
248
+ case 27:
253
249
  positionUpdated = positions[key];
254
250
  transaction = editorView.state.tr.replaceWith(positionUpdated, positionUpdated + newNode.nodeSize, newNode); // Ensure we preserve the selection, tr.replaceWith causes it to be lost in some cases
255
251
  // when replacing the node
@@ -262,13 +258,13 @@ function _onChangeAction() {
262
258
  }
263
259
  positionsLess = _objectSpread({}, (0, _main.getPluginState)(editorView.state).positions);
264
260
  delete positionsLess[key];
265
- _context3.next = 36;
261
+ _context3.next = 35;
266
262
  return (0, _commands.updateState)({
267
263
  positions: positionsLess
268
264
  })(editorView.state, editorView.dispatch);
269
- case 36:
265
+ case 35:
270
266
  editorView.dispatch(transaction);
271
- case 37:
267
+ case 36:
272
268
  case "end":
273
269
  return _context3.stop();
274
270
  }
@@ -29,9 +29,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
29
29
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
30
30
  var _extensibility = require("@atlaskit/editor-common/extensibility");
31
31
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
32
- var _selection = require("@atlaskit/editor-common/selection");
32
+ var _selection2 = require("@atlaskit/editor-common/selection");
33
33
  var _state = require("@atlaskit/editor-prosemirror/state");
34
34
  var _utils = require("@atlaskit/editor-prosemirror/utils");
35
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
35
36
  var _commands = require("../commands");
36
37
  var _pluginFactory = require("../plugin-factory");
37
38
  var _pluginKey = require("../plugin-key");
@@ -238,7 +239,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
238
239
  var maybeBodiedExtension = selection instanceof _state.TextSelection ? (0, _utils.findParentNodeOfTypeClosestToPos)($head, bodiedExtension) : (0, _utils.findSelectedNodeOfType)(bodiedExtension)(selection);
239
240
  if (maybeBodiedExtension) {
240
241
  var end = maybeBodiedExtension.pos + maybeBodiedExtension.node.nodeSize;
241
- if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && (0, _selection.isSelectionAtStartOfNode)($head, maybeBodiedExtension)) {
242
+ if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && (0, _selection2.isSelectionAtStartOfNode)($head, maybeBodiedExtension)) {
242
243
  var anchor = end + 1;
243
244
 
244
245
  // an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
@@ -248,7 +249,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
248
249
  view.dispatch(tr.setSelection(newSelection));
249
250
  return true;
250
251
  }
251
- if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && (0, _selection.isSelectionAtEndOfNode)($head, maybeBodiedExtension)) {
252
+ if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && (0, _selection2.isSelectionAtEndOfNode)($head, maybeBodiedExtension)) {
252
253
  var _anchor = maybeBodiedExtension.pos - 1;
253
254
  var _head = end + 1;
254
255
  var _newSelection = _state.TextSelection.create(doc, Math.min(_anchor, selection.anchor), _head);
@@ -258,6 +259,34 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
258
259
  }
259
260
  }
260
261
  }
262
+
263
+ // Handle non shift key case for MBE
264
+ if (event instanceof KeyboardEvent && !event.shiftKey && event.key === 'ArrowLeft') {
265
+ var _view$state2 = view.state,
266
+ _schema = _view$state2.schema,
267
+ _selection = _view$state2.selection,
268
+ _$head = _view$state2.selection.$head,
269
+ _doc = _view$state2.doc,
270
+ _tr = _view$state2.tr;
271
+ var _schema$nodes = _schema.nodes,
272
+ multiBodiedExtension = _schema$nodes.multiBodiedExtension,
273
+ extensionFrame = _schema$nodes.extensionFrame,
274
+ paragraph = _schema$nodes.paragraph;
275
+ if (_selection instanceof _selection2.GapCursorSelection || _selection instanceof _state.TextSelection && _$head.parent.type === paragraph) {
276
+ var maybeMultiBodiedExtension = (0, _utils.findParentNodeOfTypeClosestToPos)(_$head, multiBodiedExtension);
277
+ if (maybeMultiBodiedExtension) {
278
+ var _tr$doc$nodeAt;
279
+ /* In case of gap cursor, we need to decrement the position by 1 as we need to check the node at previous position
280
+ * In case of text selection, we need to decrement the position by 2 as we need to jump back twice, once from text node and then its parent paragraph node
281
+ */
282
+ var previousPositionDecrement = _selection instanceof _selection2.GapCursorSelection ? 1 : 2;
283
+ if (((_tr$doc$nodeAt = _tr.doc.nodeAt(_$head.pos - previousPositionDecrement)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type) === extensionFrame) {
284
+ var _newSelection2 = _state.TextSelection.create(_doc, _tr.doc.resolve(_$head.pos - previousPositionDecrement).start(_$head.depth - previousPositionDecrement));
285
+ view.dispatch(_tr.setSelection(_newSelection2));
286
+ }
287
+ }
288
+ }
289
+ }
261
290
  return false;
262
291
  }
263
292
  },
@@ -270,7 +299,33 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
270
299
  inlineExtension: (0, _extensibility.ExtensionNodeView)(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
271
300
  multiBodiedExtension: (0, _extensibility.ExtensionNodeView)(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi)
272
301
  },
273
- handleClickOn: (0, _selection.createSelectionClickHandler)(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
302
+ createSelectionBetween: function createSelectionBetween(view, anchor, head) {
303
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.multi-bodied-extension_0rygg')) {
304
+ return null;
305
+ }
306
+ var _view$state3 = view.state,
307
+ schema = _view$state3.schema,
308
+ doc = _view$state3.doc;
309
+ var multiBodiedExtension = schema.nodes.multiBodiedExtension;
310
+ var isAnchorInMBE = (0, _utils.findParentNodeOfTypeClosestToPos)(anchor, multiBodiedExtension);
311
+ var isHeadInMBE = (0, _utils.findParentNodeOfTypeClosestToPos)(head, multiBodiedExtension);
312
+ if (isAnchorInMBE !== undefined && isHeadInMBE === undefined) {
313
+ // Anchor is in MBE, where user started selecting within MBE and then moved outside
314
+ var newSelection = _state.TextSelection.create(doc, isAnchorInMBE.pos < head.pos ? isAnchorInMBE.pos : isAnchorInMBE.pos + isAnchorInMBE.node.nodeSize,
315
+ // isAnchorInMBE.pos < head.pos represents downwards selection
316
+ head.pos);
317
+ return newSelection;
318
+ }
319
+ if (isAnchorInMBE === undefined && isHeadInMBE !== undefined) {
320
+ // Head is in MBE, where user started selecting outside MBE and then moved inside
321
+ var _newSelection3 = _state.TextSelection.create(doc, anchor.pos, isHeadInMBE.pos < anchor.pos ? isHeadInMBE.pos : isHeadInMBE.pos + isHeadInMBE.node.nodeSize // isHeadInMBE.pos < anchor.pos represents upwards selection
322
+ );
323
+
324
+ return _newSelection3;
325
+ }
326
+ return null;
327
+ },
328
+ handleClickOn: (0, _selection2.createSelectionClickHandler)(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
274
329
  return !target.closest('.extension-content');
275
330
  }, {
276
331
  useLongPressSelection: useLongPressSelection
@@ -152,18 +152,13 @@ export async function onChangeAction(editorView, updatedParameters = {}, oldPara
152
152
  const {
153
153
  node
154
154
  } = nodeWithPos;
155
- const newAttributes = {
155
+ const newNode = buildExtensionNode(nodeWithPos.node.toJSON().type, editorView.state.schema, {
156
156
  ...node.attrs,
157
157
  parameters: {
158
158
  ...oldParameters,
159
- ...newParameters,
160
- macroParams: {
161
- ...(oldParameters === null || oldParameters === void 0 ? void 0 : oldParameters.macroParams),
162
- ...(newParameters === null || newParameters === void 0 ? void 0 : newParameters.macroParams)
163
- }
159
+ ...newParameters
164
160
  }
165
- };
166
- const newNode = buildExtensionNode(nodeWithPos.node.toJSON().type, editorView.state.schema, newAttributes, node.content, node.marks);
161
+ }, node.content, node.marks);
167
162
  if (!newNode) {
168
163
  return;
169
164
  }
@@ -1,8 +1,9 @@
1
1
  import { ExtensionNodeView } from '@atlaskit/editor-common/extensibility';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { createSelectionClickHandler, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
3
+ import { createSelectionClickHandler, GapCursorSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
4
4
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
7
  import { clearEditingContext, updateState } from '../commands';
7
8
  import { createCommand, createPluginState, getPluginState } from '../plugin-factory';
8
9
  import { pluginKey } from '../plugin-key';
@@ -190,6 +191,38 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
190
191
  }
191
192
  }
192
193
  }
194
+
195
+ // Handle non shift key case for MBE
196
+ if (event instanceof KeyboardEvent && !event.shiftKey && event.key === 'ArrowLeft') {
197
+ const {
198
+ schema,
199
+ selection,
200
+ selection: {
201
+ $head
202
+ },
203
+ doc,
204
+ tr
205
+ } = view.state;
206
+ const {
207
+ multiBodiedExtension,
208
+ extensionFrame,
209
+ paragraph
210
+ } = schema.nodes;
211
+ if (selection instanceof GapCursorSelection || selection instanceof TextSelection && $head.parent.type === paragraph) {
212
+ const maybeMultiBodiedExtension = findParentNodeOfTypeClosestToPos($head, multiBodiedExtension);
213
+ if (maybeMultiBodiedExtension) {
214
+ var _tr$doc$nodeAt;
215
+ /* In case of gap cursor, we need to decrement the position by 1 as we need to check the node at previous position
216
+ * In case of text selection, we need to decrement the position by 2 as we need to jump back twice, once from text node and then its parent paragraph node
217
+ */
218
+ const previousPositionDecrement = selection instanceof GapCursorSelection ? 1 : 2;
219
+ if (((_tr$doc$nodeAt = tr.doc.nodeAt($head.pos - previousPositionDecrement)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type) === extensionFrame) {
220
+ const newSelection = TextSelection.create(doc, tr.doc.resolve($head.pos - previousPositionDecrement).start($head.depth - previousPositionDecrement));
221
+ view.dispatch(tr.setSelection(newSelection));
222
+ }
223
+ }
224
+ }
225
+ }
193
226
  return false;
194
227
  }
195
228
  },
@@ -202,6 +235,35 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
202
235
  inlineExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
203
236
  multiBodiedExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi)
204
237
  },
238
+ createSelectionBetween: function (view, anchor, head) {
239
+ if (!getBooleanFF('platform.editor.multi-bodied-extension_0rygg')) {
240
+ return null;
241
+ }
242
+ const {
243
+ schema,
244
+ doc
245
+ } = view.state;
246
+ const {
247
+ multiBodiedExtension
248
+ } = schema.nodes;
249
+ const isAnchorInMBE = findParentNodeOfTypeClosestToPos(anchor, multiBodiedExtension);
250
+ const isHeadInMBE = findParentNodeOfTypeClosestToPos(head, multiBodiedExtension);
251
+ if (isAnchorInMBE !== undefined && isHeadInMBE === undefined) {
252
+ // Anchor is in MBE, where user started selecting within MBE and then moved outside
253
+ const newSelection = TextSelection.create(doc, isAnchorInMBE.pos < head.pos ? isAnchorInMBE.pos : isAnchorInMBE.pos + isAnchorInMBE.node.nodeSize,
254
+ // isAnchorInMBE.pos < head.pos represents downwards selection
255
+ head.pos);
256
+ return newSelection;
257
+ }
258
+ if (isAnchorInMBE === undefined && isHeadInMBE !== undefined) {
259
+ // Head is in MBE, where user started selecting outside MBE and then moved inside
260
+ const newSelection = TextSelection.create(doc, anchor.pos, isHeadInMBE.pos < anchor.pos ? isHeadInMBE.pos : isHeadInMBE.pos + isHeadInMBE.node.nodeSize // isHeadInMBE.pos < anchor.pos represents upwards selection
261
+ );
262
+
263
+ return newSelection;
264
+ }
265
+ return null;
266
+ },
205
267
  handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target => !target.closest('.extension-content'), {
206
268
  useLongPressSelection
207
269
  })
@@ -173,7 +173,6 @@ function _onChangeAction() {
173
173
  _ref6,
174
174
  positions,
175
175
  node,
176
- newAttributes,
177
176
  newNode,
178
177
  positionUpdated,
179
178
  transaction,
@@ -231,18 +230,15 @@ function _onChangeAction() {
231
230
  return _context3.abrupt("return");
232
231
  case 23:
233
232
  node = nodeWithPos.node;
234
- newAttributes = _objectSpread(_objectSpread({}, node.attrs), {}, {
235
- parameters: _objectSpread(_objectSpread(_objectSpread({}, oldParameters), newParameters), {}, {
236
- macroParams: _objectSpread(_objectSpread({}, oldParameters === null || oldParameters === void 0 ? void 0 : oldParameters.macroParams), newParameters === null || newParameters === void 0 ? void 0 : newParameters.macroParams)
237
- })
238
- });
239
- newNode = buildExtensionNode(nodeWithPos.node.toJSON().type, editorView.state.schema, newAttributes, node.content, node.marks);
233
+ newNode = buildExtensionNode(nodeWithPos.node.toJSON().type, editorView.state.schema, _objectSpread(_objectSpread({}, node.attrs), {}, {
234
+ parameters: _objectSpread(_objectSpread({}, oldParameters), newParameters)
235
+ }), node.content, node.marks);
240
236
  if (newNode) {
241
- _context3.next = 28;
237
+ _context3.next = 27;
242
238
  break;
243
239
  }
244
240
  return _context3.abrupt("return");
245
- case 28:
241
+ case 27:
246
242
  positionUpdated = positions[key];
247
243
  transaction = editorView.state.tr.replaceWith(positionUpdated, positionUpdated + newNode.nodeSize, newNode); // Ensure we preserve the selection, tr.replaceWith causes it to be lost in some cases
248
244
  // when replacing the node
@@ -255,13 +251,13 @@ function _onChangeAction() {
255
251
  }
256
252
  positionsLess = _objectSpread({}, getPluginState(editorView.state).positions);
257
253
  delete positionsLess[key];
258
- _context3.next = 36;
254
+ _context3.next = 35;
259
255
  return updateState({
260
256
  positions: positionsLess
261
257
  })(editorView.state, editorView.dispatch);
262
- case 36:
258
+ case 35:
263
259
  editorView.dispatch(transaction);
264
- case 37:
260
+ case 36:
265
261
  case "end":
266
262
  return _context3.stop();
267
263
  }
@@ -3,9 +3,10 @@ import _typeof from "@babel/runtime/helpers/typeof";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { ExtensionNodeView } from '@atlaskit/editor-common/extensibility';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
- import { createSelectionClickHandler, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
6
+ import { createSelectionClickHandler, GapCursorSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
7
7
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
8
8
  import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
9
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
10
  import { clearEditingContext, updateState } from '../commands';
10
11
  import { createCommand, createPluginState, getPluginState } from '../plugin-factory';
11
12
  import { pluginKey } from '../plugin-key';
@@ -232,6 +233,34 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
232
233
  }
233
234
  }
234
235
  }
236
+
237
+ // Handle non shift key case for MBE
238
+ if (event instanceof KeyboardEvent && !event.shiftKey && event.key === 'ArrowLeft') {
239
+ var _view$state2 = view.state,
240
+ _schema = _view$state2.schema,
241
+ _selection = _view$state2.selection,
242
+ _$head = _view$state2.selection.$head,
243
+ _doc = _view$state2.doc,
244
+ _tr = _view$state2.tr;
245
+ var _schema$nodes = _schema.nodes,
246
+ multiBodiedExtension = _schema$nodes.multiBodiedExtension,
247
+ extensionFrame = _schema$nodes.extensionFrame,
248
+ paragraph = _schema$nodes.paragraph;
249
+ if (_selection instanceof GapCursorSelection || _selection instanceof TextSelection && _$head.parent.type === paragraph) {
250
+ var maybeMultiBodiedExtension = findParentNodeOfTypeClosestToPos(_$head, multiBodiedExtension);
251
+ if (maybeMultiBodiedExtension) {
252
+ var _tr$doc$nodeAt;
253
+ /* In case of gap cursor, we need to decrement the position by 1 as we need to check the node at previous position
254
+ * In case of text selection, we need to decrement the position by 2 as we need to jump back twice, once from text node and then its parent paragraph node
255
+ */
256
+ var previousPositionDecrement = _selection instanceof GapCursorSelection ? 1 : 2;
257
+ if (((_tr$doc$nodeAt = _tr.doc.nodeAt(_$head.pos - previousPositionDecrement)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type) === extensionFrame) {
258
+ var _newSelection2 = TextSelection.create(_doc, _tr.doc.resolve(_$head.pos - previousPositionDecrement).start(_$head.depth - previousPositionDecrement));
259
+ view.dispatch(_tr.setSelection(_newSelection2));
260
+ }
261
+ }
262
+ }
263
+ }
235
264
  return false;
236
265
  }
237
266
  },
@@ -244,6 +273,32 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
244
273
  inlineExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
245
274
  multiBodiedExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi)
246
275
  },
276
+ createSelectionBetween: function createSelectionBetween(view, anchor, head) {
277
+ if (!getBooleanFF('platform.editor.multi-bodied-extension_0rygg')) {
278
+ return null;
279
+ }
280
+ var _view$state3 = view.state,
281
+ schema = _view$state3.schema,
282
+ doc = _view$state3.doc;
283
+ var multiBodiedExtension = schema.nodes.multiBodiedExtension;
284
+ var isAnchorInMBE = findParentNodeOfTypeClosestToPos(anchor, multiBodiedExtension);
285
+ var isHeadInMBE = findParentNodeOfTypeClosestToPos(head, multiBodiedExtension);
286
+ if (isAnchorInMBE !== undefined && isHeadInMBE === undefined) {
287
+ // Anchor is in MBE, where user started selecting within MBE and then moved outside
288
+ var newSelection = TextSelection.create(doc, isAnchorInMBE.pos < head.pos ? isAnchorInMBE.pos : isAnchorInMBE.pos + isAnchorInMBE.node.nodeSize,
289
+ // isAnchorInMBE.pos < head.pos represents downwards selection
290
+ head.pos);
291
+ return newSelection;
292
+ }
293
+ if (isAnchorInMBE === undefined && isHeadInMBE !== undefined) {
294
+ // Head is in MBE, where user started selecting outside MBE and then moved inside
295
+ var _newSelection3 = TextSelection.create(doc, anchor.pos, isHeadInMBE.pos < anchor.pos ? isHeadInMBE.pos : isHeadInMBE.pos + isHeadInMBE.node.nodeSize // isHeadInMBE.pos < anchor.pos represents upwards selection
296
+ );
297
+
298
+ return _newSelection3;
299
+ }
300
+ return null;
301
+ },
247
302
  handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
248
303
  return !target.closest('.extension-content');
249
304
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,11 +27,11 @@
27
27
  "@atlaskit/adf-schema": "^35.5.1",
28
28
  "@atlaskit/adf-utils": "^19.0.0",
29
29
  "@atlaskit/analytics-next": "^9.2.0",
30
- "@atlaskit/avatar": "^21.4.0",
30
+ "@atlaskit/avatar": "^21.5.0",
31
31
  "@atlaskit/button": "^17.4.0",
32
32
  "@atlaskit/checkbox": "^13.0.0",
33
33
  "@atlaskit/datetime-picker": "^13.0.3",
34
- "@atlaskit/editor-common": "^78.0.0",
34
+ "@atlaskit/editor-common": "^78.4.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.10.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
37
37
  "@atlaskit/editor-plugin-context-identifier": "^1.0.0",
@@ -44,20 +44,20 @@
44
44
  "@atlaskit/editor-tables": "^2.5.0",
45
45
  "@atlaskit/empty-state": "^7.7.0",
46
46
  "@atlaskit/form": "^9.0.3",
47
- "@atlaskit/icon": "^22.0.0",
47
+ "@atlaskit/icon": "^22.1.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.2.0",
49
- "@atlaskit/primitives": "^2.0.0",
49
+ "@atlaskit/primitives": "^2.1.0",
50
50
  "@atlaskit/radio": "^6.0.0",
51
51
  "@atlaskit/section-message": "^6.4.0",
52
52
  "@atlaskit/select": "^17.1.0",
53
- "@atlaskit/smart-user-picker": "^6.7.0",
53
+ "@atlaskit/smart-user-picker": "^6.8.0",
54
54
  "@atlaskit/spinner": "^16.0.0",
55
55
  "@atlaskit/tabs": "^14.0.0",
56
56
  "@atlaskit/textarea": "^5.0.0",
57
57
  "@atlaskit/textfield": "^6.0.0",
58
58
  "@atlaskit/theme": "^12.6.0",
59
59
  "@atlaskit/toggle": "^13.0.0",
60
- "@atlaskit/tokens": "^1.37.0",
60
+ "@atlaskit/tokens": "^1.38.0",
61
61
  "@atlaskit/tooltip": "^18.1.0",
62
62
  "@babel/runtime": "^7.0.0",
63
63
  "@emotion/react": "^11.7.1",