@atlaskit/editor-plugin-selection 6.0.1 → 6.0.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 6.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e6583756ddc82`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e6583756ddc82) -
|
|
8
|
+
Selection context includes nested lists if all child nodes are selected
|
|
9
|
+
|
|
3
10
|
## 6.0.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -13,10 +13,11 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
13
13
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
14
14
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
15
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
var listDepth = 3;
|
|
16
17
|
var selectionCoversAllListItems = function selectionCoversAllListItems($from, $to) {
|
|
17
18
|
// Block level lists
|
|
18
19
|
var listParents = ['bulletList', 'orderedList'];
|
|
19
|
-
if ($from.depth
|
|
20
|
+
if ($from.depth >= listDepth && $to.depth >= listDepth && $from.depth === $to.depth) {
|
|
20
21
|
var _greatGrandparentFrom, _greatGrandparentFrom2;
|
|
21
22
|
// Get grandparents (from)
|
|
22
23
|
var grandparentFrom = $from.node($from.depth - 1);
|
|
@@ -66,7 +67,7 @@ var getSliceFromSelection = exports.getSliceFromSelection = function getSliceFro
|
|
|
66
67
|
// For block-level lists (non-nested) specifically use the selection
|
|
67
68
|
if ((0, _platformFeatureFlags.fg)('platform_editor_expand_selection_context')) {
|
|
68
69
|
if (selectionCoversAllListItems($from, $to)) {
|
|
69
|
-
finalDepth =
|
|
70
|
+
finalDepth = $from.depth - listDepth;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
var start = $from.start(finalDepth);
|
|
@@ -2,10 +2,11 @@ import { nodeToJSON } from '@atlaskit/editor-json-transformer';
|
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
const listDepth = 3;
|
|
5
6
|
const selectionCoversAllListItems = ($from, $to) => {
|
|
6
7
|
// Block level lists
|
|
7
8
|
const listParents = ['bulletList', 'orderedList'];
|
|
8
|
-
if ($from.depth
|
|
9
|
+
if ($from.depth >= listDepth && $to.depth >= listDepth && $from.depth === $to.depth) {
|
|
9
10
|
var _greatGrandparentFrom, _greatGrandparentFrom2;
|
|
10
11
|
// Get grandparents (from)
|
|
11
12
|
const grandparentFrom = $from.node($from.depth - 1);
|
|
@@ -53,7 +54,7 @@ export const getSliceFromSelection = selection => {
|
|
|
53
54
|
// For block-level lists (non-nested) specifically use the selection
|
|
54
55
|
if (fg('platform_editor_expand_selection_context')) {
|
|
55
56
|
if (selectionCoversAllListItems($from, $to)) {
|
|
56
|
-
finalDepth =
|
|
57
|
+
finalDepth = $from.depth - listDepth;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
const start = $from.start(finalDepth);
|
|
@@ -6,10 +6,11 @@ import { nodeToJSON } from '@atlaskit/editor-json-transformer';
|
|
|
6
6
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
var listDepth = 3;
|
|
9
10
|
var selectionCoversAllListItems = function selectionCoversAllListItems($from, $to) {
|
|
10
11
|
// Block level lists
|
|
11
12
|
var listParents = ['bulletList', 'orderedList'];
|
|
12
|
-
if ($from.depth
|
|
13
|
+
if ($from.depth >= listDepth && $to.depth >= listDepth && $from.depth === $to.depth) {
|
|
13
14
|
var _greatGrandparentFrom, _greatGrandparentFrom2;
|
|
14
15
|
// Get grandparents (from)
|
|
15
16
|
var grandparentFrom = $from.node($from.depth - 1);
|
|
@@ -59,7 +60,7 @@ export var getSliceFromSelection = function getSliceFromSelection(selection) {
|
|
|
59
60
|
// For block-level lists (non-nested) specifically use the selection
|
|
60
61
|
if (fg('platform_editor_expand_selection_context')) {
|
|
61
62
|
if (selectionCoversAllListItems($from, $to)) {
|
|
62
|
-
finalDepth =
|
|
63
|
+
finalDepth = $from.depth - listDepth;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
var start = $from.start(finalDepth);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
26
26
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
27
27
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
28
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
28
|
+
"@atlaskit/tmp-editor-statsig": "^13.2.0",
|
|
29
29
|
"@atlaskit/tokens": "^6.4.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0"
|
|
31
31
|
},
|