@atlaskit/editor-plugin-block-controls 1.4.32 → 1.4.34

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,31 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.4.34
4
+
5
+ ### Patch Changes
6
+
7
+ - [#115110](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115110)
8
+ [`cc8cc2bbe88f8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cc8cc2bbe88f8) -
9
+ Fix a regression where drag and drop a node at itself duplicates the node
10
+ - [#114841](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114841)
11
+ [`2ea1a74c41971`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2ea1a74c41971) -
12
+ Fix drag handle position when change from paragraph to blockQuote
13
+ - [#115110](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115110)
14
+ [`bfa2f902f0cb3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bfa2f902f0cb3) -
15
+ change doc size limit to child count
16
+
17
+ ## 1.4.33
18
+
19
+ ### Patch Changes
20
+
21
+ - [#111344](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111344)
22
+ [`a89589001c3b1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a89589001c3b1) -
23
+ [ED-23591] Select media node when there is only one within mediaGroup
24
+ - [#114726](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114726)
25
+ [`3735569cbd151`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3735569cbd151) -
26
+ ED-23811 Set selection when command+shift+up is pressed in blocks plugin
27
+ - Updated dependencies
28
+
3
29
  ## 1.4.32
4
30
 
5
31
  ### Patch Changes
@@ -10,6 +10,7 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
10
10
  var _steps = require("@atlaskit/adf-schema/steps");
11
11
  var _analytics = require("@atlaskit/editor-common/analytics");
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
+ var _utils = require("@atlaskit/editor-common/utils");
13
14
  var _state = require("@atlaskit/editor-prosemirror/state");
14
15
  var _view = require("@atlaskit/editor-prosemirror/view");
15
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -77,13 +78,10 @@ var initialState = {
77
78
  isMenuOpen: false,
78
79
  editorHeight: 0,
79
80
  isResizerResizing: false,
80
- isDocSizeLimitEnabled: false,
81
+ isDocSizeLimitEnabled: null,
81
82
  isPMDragging: false
82
83
  };
83
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
84
- initialState.isDocSizeLimitEnabled = true;
85
- }
86
- var DRAG_AND_DROP_DOC_SIZE_LIMIT = 20000;
84
+ var DRAG_AND_DROP_DOC_SIZE_LIMIT = 50;
87
85
  var createPlugin = exports.createPlugin = function createPlugin(api) {
88
86
  return new _safePlugin.SafePlugin({
89
87
  key: key,
@@ -93,7 +91,14 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
93
91
  },
94
92
  apply: function apply(tr, currentState, oldState, newState) {
95
93
  var _meta$activeNode, _meta$activeNode2, _meta$isDragging, _meta$editorHeight, _meta$isPMDragging;
96
- if (initialState.isDocSizeLimitEnabled && newState.doc.nodeSize > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
94
+ if (initialState.isDocSizeLimitEnabled === null) {
95
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
96
+ initialState.isDocSizeLimitEnabled = true;
97
+ } else {
98
+ initialState.isDocSizeLimitEnabled = false;
99
+ }
100
+ }
101
+ if (initialState.isDocSizeLimitEnabled && newState.doc.childCount > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
97
102
  return initialState;
98
103
  }
99
104
  var activeNode = currentState.activeNode,
@@ -165,10 +170,18 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
165
170
  // Note: Quite often the handle is not in the right position after a node is moved
166
171
  // it is safer for now to not show it when a node is moved
167
172
  if (activeNode && !(meta !== null && meta !== void 0 && meta.nodeMoved) && !isDecsMissing) {
168
- var newActiveNode = activeNode && tr.doc.nodeAt(tr.mapping.map(activeNode.pos));
173
+ var mappedPosisiton = tr.mapping.map(activeNode.pos);
174
+ var prevMappedPos = oldState.tr.mapping.map(activeNode.pos);
175
+
176
+ // When a node type changed to be nested inside another node, the position of the active node is off by 1
177
+ // This is a workaround to fix the position of the active node when it is nested
178
+ if (mappedPosisiton === prevMappedPos + 1) {
179
+ mappedPosisiton = prevMappedPos;
180
+ }
181
+ var newActiveNode = tr.doc.nodeAt(mappedPosisiton);
169
182
  var nodeType = activeNode.nodeType;
170
183
  var anchorName = activeNode.anchorName;
171
- if (newActiveNode && (newActiveNode === null || newActiveNode === void 0 ? void 0 : newActiveNode.type.name) !== activeNode.nodeType && !(meta !== null && meta !== void 0 && meta.nodeMoved)) {
184
+ if (newActiveNode && (newActiveNode === null || newActiveNode === void 0 ? void 0 : newActiveNode.type.name) !== activeNode.nodeType) {
172
185
  nodeType = newActiveNode.type.name;
173
186
  anchorName = activeNode.anchorName.replace(activeNode.nodeType, nodeType);
174
187
  }
@@ -255,12 +268,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
255
268
  },
256
269
  handleDOMEvents: {
257
270
  drop: function drop(view, event) {
258
- var _pluginState$activeNo;
259
271
  // prosemirror has sends a default transaction on drop (meta where uiEvent is 'drop'),
260
272
  // this duplicates the an empty version of the node it was dropping,
261
273
  // Adding some check here to prevent that if drop position is within activeNode
262
274
  var state = view.state,
263
- dispatch = view.dispatch;
275
+ dispatch = view.dispatch,
276
+ dragging = view.dragging;
264
277
  var pluginState = key.getState(state);
265
278
  if (pluginState !== null && pluginState !== void 0 && pluginState.isPMDragging) {
266
279
  dispatch(state.tr.setMeta(key, {
@@ -270,9 +283,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
270
283
  if (!(event.target instanceof HTMLElement) || !(pluginState !== null && pluginState !== void 0 && pluginState.activeNode)) {
271
284
  return false;
272
285
  }
273
- var node = view.nodeDOM(pluginState === null || pluginState === void 0 || (_pluginState$activeNo = pluginState.activeNode) === null || _pluginState$activeNo === void 0 ? void 0 : _pluginState$activeNo.pos);
274
- var isActiveNode = event.target === node;
275
- if (isActiveNode) {
286
+ // Currently we can only drag one node at a time
287
+ // so we only need to check first child
288
+ var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
289
+ var activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
290
+ if (draggable === activeNode) {
276
291
  // Prevent the default drop behavior if the position is within the activeNode
277
292
  event.preventDefault();
278
293
  return true;
@@ -299,6 +314,22 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
299
314
  (0, _handleMouseOver.handleMouseOver)(view, event, api);
300
315
  }
301
316
  return false;
317
+ },
318
+ keydown: function keydown(view, event) {
319
+ // Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
320
+ var _view$state = view.state,
321
+ selection = _view$state.selection,
322
+ doc = _view$state.doc,
323
+ tr = _view$state.tr;
324
+ var metaKey = _utils.browser.mac ? event.metaKey : event.ctrlKey;
325
+ if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
326
+ if (selection instanceof _state.TextSelection || selection instanceof _state.NodeSelection) {
327
+ var newSelection = _state.TextSelection.create(doc, selection.head, 1);
328
+ view.dispatch(tr.setSelection(newSelection));
329
+ return true;
330
+ }
331
+ }
332
+ return false;
302
333
  }
303
334
  }
304
335
  },
@@ -15,6 +15,10 @@ var getSelection = exports.getSelection = function getSelection(tr, start) {
15
15
  // decisionList node is not selectable, but we want to select the whole node not just text
16
16
  if (isNodeSelection || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
17
17
  return new _state.NodeSelection($startPos);
18
+ // TODO: support multiple nodes selection
19
+ } else if ((node === null || node === void 0 ? void 0 : node.type.name) === 'mediaGroup' && node.childCount === 1) {
20
+ var $mediaStartPos = tr.doc.resolve(start + 1);
21
+ return new _state.NodeSelection($mediaStartPos);
18
22
  } else {
19
23
  // To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
20
24
  // Find the first inline node in the node
@@ -2,7 +2,8 @@ import rafSchedule from 'raf-schd';
2
2
  import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import { browser } from '@atlaskit/editor-common/utils';
6
+ import { NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
7
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
9
  import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
@@ -71,13 +72,10 @@ const initialState = {
71
72
  isMenuOpen: false,
72
73
  editorHeight: 0,
73
74
  isResizerResizing: false,
74
- isDocSizeLimitEnabled: false,
75
+ isDocSizeLimitEnabled: null,
75
76
  isPMDragging: false
76
77
  };
77
- if (getBooleanFF('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
78
- initialState.isDocSizeLimitEnabled = true;
79
- }
80
- const DRAG_AND_DROP_DOC_SIZE_LIMIT = 20000;
78
+ const DRAG_AND_DROP_DOC_SIZE_LIMIT = 50;
81
79
  export const createPlugin = api => {
82
80
  return new SafePlugin({
83
81
  key,
@@ -87,7 +85,14 @@ export const createPlugin = api => {
87
85
  },
88
86
  apply(tr, currentState, oldState, newState) {
89
87
  var _meta$activeNode, _meta$activeNode2, _meta$isDragging, _meta$editorHeight, _meta$isPMDragging;
90
- if (initialState.isDocSizeLimitEnabled && newState.doc.nodeSize > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
88
+ if (initialState.isDocSizeLimitEnabled === null) {
89
+ if (getBooleanFF('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
90
+ initialState.isDocSizeLimitEnabled = true;
91
+ } else {
92
+ initialState.isDocSizeLimitEnabled = false;
93
+ }
94
+ }
95
+ if (initialState.isDocSizeLimitEnabled && newState.doc.childCount > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
91
96
  return initialState;
92
97
  }
93
98
  let {
@@ -156,10 +161,18 @@ export const createPlugin = api => {
156
161
  // Note: Quite often the handle is not in the right position after a node is moved
157
162
  // it is safer for now to not show it when a node is moved
158
163
  if (activeNode && !(meta !== null && meta !== void 0 && meta.nodeMoved) && !isDecsMissing) {
159
- const newActiveNode = activeNode && tr.doc.nodeAt(tr.mapping.map(activeNode.pos));
164
+ let mappedPosisiton = tr.mapping.map(activeNode.pos);
165
+ const prevMappedPos = oldState.tr.mapping.map(activeNode.pos);
166
+
167
+ // When a node type changed to be nested inside another node, the position of the active node is off by 1
168
+ // This is a workaround to fix the position of the active node when it is nested
169
+ if (mappedPosisiton === prevMappedPos + 1) {
170
+ mappedPosisiton = prevMappedPos;
171
+ }
172
+ const newActiveNode = tr.doc.nodeAt(mappedPosisiton);
160
173
  let nodeType = activeNode.nodeType;
161
174
  let anchorName = activeNode.anchorName;
162
- if (newActiveNode && (newActiveNode === null || newActiveNode === void 0 ? void 0 : newActiveNode.type.name) !== activeNode.nodeType && !(meta !== null && meta !== void 0 && meta.nodeMoved)) {
175
+ if (newActiveNode && (newActiveNode === null || newActiveNode === void 0 ? void 0 : newActiveNode.type.name) !== activeNode.nodeType) {
163
176
  nodeType = newActiveNode.type.name;
164
177
  anchorName = activeNode.anchorName.replace(activeNode.nodeType, nodeType);
165
178
  }
@@ -246,13 +259,13 @@ export const createPlugin = api => {
246
259
  },
247
260
  handleDOMEvents: {
248
261
  drop(view, event) {
249
- var _pluginState$activeNo;
250
262
  // prosemirror has sends a default transaction on drop (meta where uiEvent is 'drop'),
251
263
  // this duplicates the an empty version of the node it was dropping,
252
264
  // Adding some check here to prevent that if drop position is within activeNode
253
265
  const {
254
266
  state,
255
- dispatch
267
+ dispatch,
268
+ dragging
256
269
  } = view;
257
270
  const pluginState = key.getState(state);
258
271
  if (pluginState !== null && pluginState !== void 0 && pluginState.isPMDragging) {
@@ -263,9 +276,11 @@ export const createPlugin = api => {
263
276
  if (!(event.target instanceof HTMLElement) || !(pluginState !== null && pluginState !== void 0 && pluginState.activeNode)) {
264
277
  return false;
265
278
  }
266
- const node = view.nodeDOM(pluginState === null || pluginState === void 0 ? void 0 : (_pluginState$activeNo = pluginState.activeNode) === null || _pluginState$activeNo === void 0 ? void 0 : _pluginState$activeNo.pos);
267
- const isActiveNode = event.target === node;
268
- if (isActiveNode) {
279
+ // Currently we can only drag one node at a time
280
+ // so we only need to check first child
281
+ const draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
282
+ const activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
283
+ if (draggable === activeNode) {
269
284
  // Prevent the default drop behavior if the position is within the activeNode
270
285
  event.preventDefault();
271
286
  return true;
@@ -294,6 +309,23 @@ export const createPlugin = api => {
294
309
  handleMouseOver(view, event, api);
295
310
  }
296
311
  return false;
312
+ },
313
+ keydown(view, event) {
314
+ // Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
315
+ const {
316
+ selection,
317
+ doc,
318
+ tr
319
+ } = view.state;
320
+ const metaKey = browser.mac ? event.metaKey : event.ctrlKey;
321
+ if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
322
+ if (selection instanceof TextSelection || selection instanceof NodeSelection) {
323
+ const newSelection = TextSelection.create(doc, selection.head, 1);
324
+ view.dispatch(tr.setSelection(newSelection));
325
+ return true;
326
+ }
327
+ }
328
+ return false;
297
329
  }
298
330
  }
299
331
  },
@@ -9,6 +9,10 @@ export const getSelection = (tr, start) => {
9
9
  // decisionList node is not selectable, but we want to select the whole node not just text
10
10
  if (isNodeSelection || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
11
11
  return new NodeSelection($startPos);
12
+ // TODO: support multiple nodes selection
13
+ } else if ((node === null || node === void 0 ? void 0 : node.type.name) === 'mediaGroup' && node.childCount === 1) {
14
+ const $mediaStartPos = tr.doc.resolve(start + 1);
15
+ return new NodeSelection($mediaStartPos);
12
16
  } else {
13
17
  // To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
14
18
  // Find the first inline node in the node
@@ -3,7 +3,8 @@ import rafSchedule from 'raf-schd';
3
3
  import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import { browser } from '@atlaskit/editor-common/utils';
7
+ import { NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
8
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
10
  import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
@@ -70,13 +71,10 @@ var initialState = {
70
71
  isMenuOpen: false,
71
72
  editorHeight: 0,
72
73
  isResizerResizing: false,
73
- isDocSizeLimitEnabled: false,
74
+ isDocSizeLimitEnabled: null,
74
75
  isPMDragging: false
75
76
  };
76
- if (getBooleanFF('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
77
- initialState.isDocSizeLimitEnabled = true;
78
- }
79
- var DRAG_AND_DROP_DOC_SIZE_LIMIT = 20000;
77
+ var DRAG_AND_DROP_DOC_SIZE_LIMIT = 50;
80
78
  export var createPlugin = function createPlugin(api) {
81
79
  return new SafePlugin({
82
80
  key: key,
@@ -86,7 +84,14 @@ export var createPlugin = function createPlugin(api) {
86
84
  },
87
85
  apply: function apply(tr, currentState, oldState, newState) {
88
86
  var _meta$activeNode, _meta$activeNode2, _meta$isDragging, _meta$editorHeight, _meta$isPMDragging;
89
- if (initialState.isDocSizeLimitEnabled && newState.doc.nodeSize > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
87
+ if (initialState.isDocSizeLimitEnabled === null) {
88
+ if (getBooleanFF('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
89
+ initialState.isDocSizeLimitEnabled = true;
90
+ } else {
91
+ initialState.isDocSizeLimitEnabled = false;
92
+ }
93
+ }
94
+ if (initialState.isDocSizeLimitEnabled && newState.doc.childCount > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
90
95
  return initialState;
91
96
  }
92
97
  var activeNode = currentState.activeNode,
@@ -158,10 +163,18 @@ export var createPlugin = function createPlugin(api) {
158
163
  // Note: Quite often the handle is not in the right position after a node is moved
159
164
  // it is safer for now to not show it when a node is moved
160
165
  if (activeNode && !(meta !== null && meta !== void 0 && meta.nodeMoved) && !isDecsMissing) {
161
- var newActiveNode = activeNode && tr.doc.nodeAt(tr.mapping.map(activeNode.pos));
166
+ var mappedPosisiton = tr.mapping.map(activeNode.pos);
167
+ var prevMappedPos = oldState.tr.mapping.map(activeNode.pos);
168
+
169
+ // When a node type changed to be nested inside another node, the position of the active node is off by 1
170
+ // This is a workaround to fix the position of the active node when it is nested
171
+ if (mappedPosisiton === prevMappedPos + 1) {
172
+ mappedPosisiton = prevMappedPos;
173
+ }
174
+ var newActiveNode = tr.doc.nodeAt(mappedPosisiton);
162
175
  var nodeType = activeNode.nodeType;
163
176
  var anchorName = activeNode.anchorName;
164
- if (newActiveNode && (newActiveNode === null || newActiveNode === void 0 ? void 0 : newActiveNode.type.name) !== activeNode.nodeType && !(meta !== null && meta !== void 0 && meta.nodeMoved)) {
177
+ if (newActiveNode && (newActiveNode === null || newActiveNode === void 0 ? void 0 : newActiveNode.type.name) !== activeNode.nodeType) {
165
178
  nodeType = newActiveNode.type.name;
166
179
  anchorName = activeNode.anchorName.replace(activeNode.nodeType, nodeType);
167
180
  }
@@ -248,12 +261,12 @@ export var createPlugin = function createPlugin(api) {
248
261
  },
249
262
  handleDOMEvents: {
250
263
  drop: function drop(view, event) {
251
- var _pluginState$activeNo;
252
264
  // prosemirror has sends a default transaction on drop (meta where uiEvent is 'drop'),
253
265
  // this duplicates the an empty version of the node it was dropping,
254
266
  // Adding some check here to prevent that if drop position is within activeNode
255
267
  var state = view.state,
256
- dispatch = view.dispatch;
268
+ dispatch = view.dispatch,
269
+ dragging = view.dragging;
257
270
  var pluginState = key.getState(state);
258
271
  if (pluginState !== null && pluginState !== void 0 && pluginState.isPMDragging) {
259
272
  dispatch(state.tr.setMeta(key, {
@@ -263,9 +276,11 @@ export var createPlugin = function createPlugin(api) {
263
276
  if (!(event.target instanceof HTMLElement) || !(pluginState !== null && pluginState !== void 0 && pluginState.activeNode)) {
264
277
  return false;
265
278
  }
266
- var node = view.nodeDOM(pluginState === null || pluginState === void 0 || (_pluginState$activeNo = pluginState.activeNode) === null || _pluginState$activeNo === void 0 ? void 0 : _pluginState$activeNo.pos);
267
- var isActiveNode = event.target === node;
268
- if (isActiveNode) {
279
+ // Currently we can only drag one node at a time
280
+ // so we only need to check first child
281
+ var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
282
+ var activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
283
+ if (draggable === activeNode) {
269
284
  // Prevent the default drop behavior if the position is within the activeNode
270
285
  event.preventDefault();
271
286
  return true;
@@ -292,6 +307,22 @@ export var createPlugin = function createPlugin(api) {
292
307
  handleMouseOver(view, event, api);
293
308
  }
294
309
  return false;
310
+ },
311
+ keydown: function keydown(view, event) {
312
+ // Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
313
+ var _view$state = view.state,
314
+ selection = _view$state.selection,
315
+ doc = _view$state.doc,
316
+ tr = _view$state.tr;
317
+ var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
318
+ if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
319
+ if (selection instanceof TextSelection || selection instanceof NodeSelection) {
320
+ var newSelection = TextSelection.create(doc, selection.head, 1);
321
+ view.dispatch(tr.setSelection(newSelection));
322
+ return true;
323
+ }
324
+ }
325
+ return false;
295
326
  }
296
327
  }
297
328
  },
@@ -9,6 +9,10 @@ export var getSelection = function getSelection(tr, start) {
9
9
  // decisionList node is not selectable, but we want to select the whole node not just text
10
10
  if (isNodeSelection || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
11
11
  return new NodeSelection($startPos);
12
+ // TODO: support multiple nodes selection
13
+ } else if ((node === null || node === void 0 ? void 0 : node.type.name) === 'mediaGroup' && node.childCount === 1) {
14
+ var $mediaStartPos = tr.doc.resolve(start + 1);
15
+ return new NodeSelection($mediaStartPos);
12
16
  } else {
13
17
  // To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
14
18
  // Find the first inline node in the node
@@ -16,7 +16,7 @@ export interface PluginState {
16
16
  nodeType: string;
17
17
  } | null;
18
18
  isResizerResizing: boolean;
19
- isDocSizeLimitEnabled: boolean;
19
+ isDocSizeLimitEnabled: boolean | null;
20
20
  /**
21
21
  * is dragging the node without using drag handle, i,e, native prosemirror DnD
22
22
  */
@@ -16,7 +16,7 @@ export interface PluginState {
16
16
  nodeType: string;
17
17
  } | null;
18
18
  isResizerResizing: boolean;
19
- isDocSizeLimitEnabled: boolean;
19
+ isDocSizeLimitEnabled: boolean | null;
20
20
  /**
21
21
  * is dragging the node without using drag handle, i,e, native prosemirror DnD
22
22
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.4.32",
3
+ "version": "1.4.34",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/editor-prosemirror": "4.0.1",
41
41
  "@atlaskit/editor-shared-styles": "^2.12.0",
42
42
  "@atlaskit/editor-tables": "^2.7.0",
43
- "@atlaskit/icon": "^22.4.0",
43
+ "@atlaskit/icon": "^22.5.0",
44
44
  "@atlaskit/platform-feature-flags": "^0.2.0",
45
45
  "@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",