@atlaskit/editor-plugin-selection 1.1.2 → 1.2.0
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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#91934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91934) [`b76a78c6a199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b76a78c6a199) - bumped editor-prosemirror version to 4.0.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 1.1.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#90897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90897) [`f7d77187a439`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f7d77187a439) - [ux] [ED-22841] Adjust isCollpasedExpand function to allow for the new singlePlayerExpand plugin which replaces the standard expand when livePage and the `platform.editor.single-player-expand` feature flag is enabled.
|
|
18
|
+
|
|
3
19
|
## 1.1.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -4,21 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createOnKeydown = createOnKeydown;
|
|
7
|
+
var _expand = require("@atlaskit/editor-common/expand");
|
|
7
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
10
|
/*
|
|
9
|
-
* The way expand was built, no browser
|
|
11
|
+
* The way expand was built, no browser recognize selection on it.
|
|
10
12
|
* For instance, when a selection going to a "collapsed" expand
|
|
11
13
|
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
12
14
|
* this behavior is caused because the expand content is never true hidden
|
|
13
15
|
* we just set the height to 1px.
|
|
14
16
|
*
|
|
15
17
|
* So, we need to capture a possible selection event
|
|
16
|
-
* when a collapsed
|
|
18
|
+
* when a collapsed expand is the next node in the common depth.
|
|
17
19
|
* If that is true, we create a new TextSelection and stop the event bubble
|
|
18
20
|
*/
|
|
19
|
-
var
|
|
21
|
+
var isCollapsedExpand = function isCollapsedExpand(node, _ref) {
|
|
20
22
|
var __livePage = _ref.__livePage;
|
|
21
|
-
|
|
23
|
+
var currentExpandedState;
|
|
24
|
+
if (__livePage && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.single-player-expand')) {
|
|
25
|
+
currentExpandedState = node ? !_expand.expandedState.get(node) : undefined;
|
|
26
|
+
} else if (__livePage) {
|
|
27
|
+
currentExpandedState = node === null || node === void 0 ? void 0 : node.attrs.__expanded;
|
|
28
|
+
} else {
|
|
29
|
+
currentExpandedState = !(node !== null && node !== void 0 && node.attrs.__expanded);
|
|
30
|
+
}
|
|
31
|
+
return Boolean(node && ['expand', 'nestedExpand'].includes(node.type.name) && currentExpandedState);
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
/**
|
|
@@ -41,7 +51,7 @@ var isTable = function isTable(node) {
|
|
|
41
51
|
};
|
|
42
52
|
var isProblematicNode = function isProblematicNode(node, _ref2) {
|
|
43
53
|
var __livePage = _ref2.__livePage;
|
|
44
|
-
return
|
|
54
|
+
return isCollapsedExpand(node, {
|
|
45
55
|
__livePage: __livePage
|
|
46
56
|
}) || isBodiedExtension(node) || isTable(node);
|
|
47
57
|
};
|
|
@@ -1,19 +1,30 @@
|
|
|
1
|
+
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
1
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
|
|
2
5
|
/*
|
|
3
|
-
* The way expand was built, no browser
|
|
6
|
+
* The way expand was built, no browser recognize selection on it.
|
|
4
7
|
* For instance, when a selection going to a "collapsed" expand
|
|
5
8
|
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
6
9
|
* this behavior is caused because the expand content is never true hidden
|
|
7
10
|
* we just set the height to 1px.
|
|
8
11
|
*
|
|
9
12
|
* So, we need to capture a possible selection event
|
|
10
|
-
* when a collapsed
|
|
13
|
+
* when a collapsed expand is the next node in the common depth.
|
|
11
14
|
* If that is true, we create a new TextSelection and stop the event bubble
|
|
12
15
|
*/
|
|
13
|
-
const
|
|
16
|
+
const isCollapsedExpand = (node, {
|
|
14
17
|
__livePage
|
|
15
18
|
}) => {
|
|
16
|
-
|
|
19
|
+
let currentExpandedState;
|
|
20
|
+
if (__livePage && getBooleanFF('platform.editor.single-player-expand')) {
|
|
21
|
+
currentExpandedState = node ? !expandedState.get(node) : undefined;
|
|
22
|
+
} else if (__livePage) {
|
|
23
|
+
currentExpandedState = node === null || node === void 0 ? void 0 : node.attrs.__expanded;
|
|
24
|
+
} else {
|
|
25
|
+
currentExpandedState = !(node !== null && node !== void 0 && node.attrs.__expanded);
|
|
26
|
+
}
|
|
27
|
+
return Boolean(node && ['expand', 'nestedExpand'].includes(node.type.name) && currentExpandedState);
|
|
17
28
|
};
|
|
18
29
|
|
|
19
30
|
/**
|
|
@@ -37,7 +48,7 @@ const isTable = node => {
|
|
|
37
48
|
const isProblematicNode = (node, {
|
|
38
49
|
__livePage
|
|
39
50
|
}) => {
|
|
40
|
-
return
|
|
51
|
+
return isCollapsedExpand(node, {
|
|
41
52
|
__livePage
|
|
42
53
|
}) || isBodiedExtension(node) || isTable(node);
|
|
43
54
|
};
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
+
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
1
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
|
|
2
5
|
/*
|
|
3
|
-
* The way expand was built, no browser
|
|
6
|
+
* The way expand was built, no browser recognize selection on it.
|
|
4
7
|
* For instance, when a selection going to a "collapsed" expand
|
|
5
8
|
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
6
9
|
* this behavior is caused because the expand content is never true hidden
|
|
7
10
|
* we just set the height to 1px.
|
|
8
11
|
*
|
|
9
12
|
* So, we need to capture a possible selection event
|
|
10
|
-
* when a collapsed
|
|
13
|
+
* when a collapsed expand is the next node in the common depth.
|
|
11
14
|
* If that is true, we create a new TextSelection and stop the event bubble
|
|
12
15
|
*/
|
|
13
|
-
var
|
|
16
|
+
var isCollapsedExpand = function isCollapsedExpand(node, _ref) {
|
|
14
17
|
var __livePage = _ref.__livePage;
|
|
15
|
-
|
|
18
|
+
var currentExpandedState;
|
|
19
|
+
if (__livePage && getBooleanFF('platform.editor.single-player-expand')) {
|
|
20
|
+
currentExpandedState = node ? !expandedState.get(node) : undefined;
|
|
21
|
+
} else if (__livePage) {
|
|
22
|
+
currentExpandedState = node === null || node === void 0 ? void 0 : node.attrs.__expanded;
|
|
23
|
+
} else {
|
|
24
|
+
currentExpandedState = !(node !== null && node !== void 0 && node.attrs.__expanded);
|
|
25
|
+
}
|
|
26
|
+
return Boolean(node && ['expand', 'nestedExpand'].includes(node.type.name) && currentExpandedState);
|
|
16
27
|
};
|
|
17
28
|
|
|
18
29
|
/**
|
|
@@ -35,7 +46,7 @@ var isTable = function isTable(node) {
|
|
|
35
46
|
};
|
|
36
47
|
var isProblematicNode = function isProblematicNode(node, _ref2) {
|
|
37
48
|
var __livePage = _ref2.__livePage;
|
|
38
|
-
return
|
|
49
|
+
return isCollapsedExpand(node, {
|
|
39
50
|
__livePage: __livePage
|
|
40
51
|
}) || isBodiedExtension(node) || isTable(node);
|
|
41
52
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
"runReact18": false
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/editor-common": "^78.
|
|
25
|
-
"@atlaskit/editor-prosemirror": "
|
|
24
|
+
"@atlaskit/editor-common": "^78.31.0",
|
|
25
|
+
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
26
26
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
27
|
-
"@atlaskit/editor-tables": "^2.
|
|
27
|
+
"@atlaskit/editor-tables": "^2.7.0",
|
|
28
|
+
"@atlaskit/platform-feature-flags": "^0.2.4",
|
|
28
29
|
"@babel/runtime": "^7.0.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
@@ -80,6 +81,9 @@
|
|
|
80
81
|
"platform-feature-flags": {
|
|
81
82
|
"platform.editor.change-navigation-for-atom-nodes": {
|
|
82
83
|
"type": "boolean"
|
|
84
|
+
},
|
|
85
|
+
"platform.editor.single-player-expand": {
|
|
86
|
+
"type": "boolean"
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
}
|