@atlaskit/editor-plugin-selection 5.0.1 → 5.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,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 5.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`86e3af7e468bb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/86e3af7e468bb) -
|
|
8
|
+
Add experiment to add additional context to selection fragment data.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
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; } } }; }
|
|
13
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; } }
|
|
14
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; }
|
|
@@ -42,8 +43,9 @@ var getSliceFromSelection = exports.getSliceFromSelection = function getSliceFro
|
|
|
42
43
|
// If we're in a text selection, and share the parent node across the anchor->head
|
|
43
44
|
// make the depth the parent node
|
|
44
45
|
selection instanceof _state.TextSelection && $from.parent.eq($to.parent) ? Math.max(0, $from.sharedDepth(_to) - 1) : $from.sharedDepth(_to);
|
|
45
|
-
var
|
|
46
|
-
var
|
|
46
|
+
var finalDepth = (0, _platformFeatureFlags.fg)('platform_editor_expand_selection_context') ? 0 : depth;
|
|
47
|
+
var start = $from.start(finalDepth);
|
|
48
|
+
var node = $from.node(finalDepth);
|
|
47
49
|
var content = node.content.cut($from.pos - start, $to.pos - start);
|
|
48
50
|
frag = frag.append(content);
|
|
49
51
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
/**
|
|
5
6
|
* Get the slice of the document corresponding to the selection.
|
|
6
7
|
* This is similar to the prosemirror `selection.content()` - but
|
|
@@ -29,8 +30,9 @@ export const getSliceFromSelection = selection => {
|
|
|
29
30
|
// If we're in a text selection, and share the parent node across the anchor->head
|
|
30
31
|
// make the depth the parent node
|
|
31
32
|
selection instanceof TextSelection && $from.parent.eq($to.parent) ? Math.max(0, $from.sharedDepth(to) - 1) : $from.sharedDepth(to);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
33
|
+
const finalDepth = fg('platform_editor_expand_selection_context') ? 0 : depth;
|
|
34
|
+
const start = $from.start(finalDepth);
|
|
35
|
+
const node = $from.node(finalDepth);
|
|
34
36
|
const content = node.content.cut($from.pos - start, $to.pos - start);
|
|
35
37
|
frag = frag.append(content);
|
|
36
38
|
}
|
|
@@ -5,6 +5,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
5
5
|
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
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
/**
|
|
9
10
|
* Get the slice of the document corresponding to the selection.
|
|
10
11
|
* This is similar to the prosemirror `selection.content()` - but
|
|
@@ -35,8 +36,9 @@ export var getSliceFromSelection = function getSliceFromSelection(selection) {
|
|
|
35
36
|
// If we're in a text selection, and share the parent node across the anchor->head
|
|
36
37
|
// make the depth the parent node
|
|
37
38
|
selection instanceof TextSelection && $from.parent.eq($to.parent) ? Math.max(0, $from.sharedDepth(_to) - 1) : $from.sharedDepth(_to);
|
|
38
|
-
var
|
|
39
|
-
var
|
|
39
|
+
var finalDepth = fg('platform_editor_expand_selection_context') ? 0 : depth;
|
|
40
|
+
var start = $from.start(finalDepth);
|
|
41
|
+
var node = $from.node(finalDepth);
|
|
40
42
|
var content = node.content.cut($from.pos - start, $to.pos - start);
|
|
41
43
|
frag = frag.append(content);
|
|
42
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,12 +25,12 @@
|
|
|
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": "^12.
|
|
28
|
+
"@atlaskit/tmp-editor-statsig": "^12.27.0",
|
|
29
29
|
"@atlaskit/tokens": "^6.3.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@atlaskit/editor-common": "^109.
|
|
33
|
+
"@atlaskit/editor-common": "^109.11.0",
|
|
34
34
|
"react": "^18.2.0"
|
|
35
35
|
},
|
|
36
36
|
"techstack": {
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
"platform_editor_nested_tables_gap_cursor": {
|
|
82
82
|
"type": "boolean"
|
|
83
83
|
},
|
|
84
|
+
"platform_editor_expand_selection_context": {
|
|
85
|
+
"type": "boolean"
|
|
86
|
+
},
|
|
84
87
|
"platform_editor_fix_right_arrow_bug_list_in_layout": {
|
|
85
88
|
"type": "boolean"
|
|
86
89
|
},
|