@atlaskit/editor-plugin-block-controls 1.4.32 → 1.4.33
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 +12 -0
- package/dist/cjs/pm-plugins/main.js +17 -0
- package/dist/cjs/utils/getSelection.js +4 -0
- package/dist/es2019/pm-plugins/main.js +19 -1
- package/dist/es2019/utils/getSelection.js +4 -0
- package/dist/esm/pm-plugins/main.js +18 -1
- package/dist/esm/utils/getSelection.js +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.4.33
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#111344](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111344)
|
|
8
|
+
[`a89589001c3b1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a89589001c3b1) -
|
|
9
|
+
[ED-23591] Select media node when there is only one within mediaGroup
|
|
10
|
+
- [#114726](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114726)
|
|
11
|
+
[`3735569cbd151`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3735569cbd151) -
|
|
12
|
+
ED-23811 Set selection when command+shift+up is pressed in blocks plugin
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.4.32
|
|
4
16
|
|
|
5
17
|
### 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");
|
|
@@ -299,6 +300,22 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
299
300
|
(0, _handleMouseOver.handleMouseOver)(view, event, api);
|
|
300
301
|
}
|
|
301
302
|
return false;
|
|
303
|
+
},
|
|
304
|
+
keydown: function keydown(view, event) {
|
|
305
|
+
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
306
|
+
var _view$state = view.state,
|
|
307
|
+
selection = _view$state.selection,
|
|
308
|
+
doc = _view$state.doc,
|
|
309
|
+
tr = _view$state.tr;
|
|
310
|
+
var metaKey = _utils.browser.mac ? event.metaKey : event.ctrlKey;
|
|
311
|
+
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
312
|
+
if (selection instanceof _state.TextSelection || selection instanceof _state.NodeSelection) {
|
|
313
|
+
var newSelection = _state.TextSelection.create(doc, selection.head, 1);
|
|
314
|
+
view.dispatch(tr.setSelection(newSelection));
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
302
319
|
}
|
|
303
320
|
}
|
|
304
321
|
},
|
|
@@ -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 {
|
|
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';
|
|
@@ -294,6 +295,23 @@ export const createPlugin = api => {
|
|
|
294
295
|
handleMouseOver(view, event, api);
|
|
295
296
|
}
|
|
296
297
|
return false;
|
|
298
|
+
},
|
|
299
|
+
keydown(view, event) {
|
|
300
|
+
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
301
|
+
const {
|
|
302
|
+
selection,
|
|
303
|
+
doc,
|
|
304
|
+
tr
|
|
305
|
+
} = view.state;
|
|
306
|
+
const metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
307
|
+
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
308
|
+
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
309
|
+
const newSelection = TextSelection.create(doc, selection.head, 1);
|
|
310
|
+
view.dispatch(tr.setSelection(newSelection));
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return false;
|
|
297
315
|
}
|
|
298
316
|
}
|
|
299
317
|
},
|
|
@@ -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 {
|
|
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';
|
|
@@ -292,6 +293,22 @@ export var createPlugin = function createPlugin(api) {
|
|
|
292
293
|
handleMouseOver(view, event, api);
|
|
293
294
|
}
|
|
294
295
|
return false;
|
|
296
|
+
},
|
|
297
|
+
keydown: function keydown(view, event) {
|
|
298
|
+
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
299
|
+
var _view$state = view.state,
|
|
300
|
+
selection = _view$state.selection,
|
|
301
|
+
doc = _view$state.doc,
|
|
302
|
+
tr = _view$state.tr;
|
|
303
|
+
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
304
|
+
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
305
|
+
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
306
|
+
var newSelection = TextSelection.create(doc, selection.head, 1);
|
|
307
|
+
view.dispatch(tr.setSelection(newSelection));
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
295
312
|
}
|
|
296
313
|
}
|
|
297
314
|
},
|
|
@@ -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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.33",
|
|
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.
|
|
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",
|