@atlaskit/editor-plugin-selection 2.1.7 → 2.1.9
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 +18 -0
- package/dist/cjs/pm-plugins/auto-expand-selection-range-on-inline-node-main.js +8 -14
- package/dist/cjs/pm-plugins/gap-cursor/actions.js +4 -2
- package/dist/es2019/pm-plugins/auto-expand-selection-range-on-inline-node-main.js +8 -14
- package/dist/es2019/pm-plugins/gap-cursor/actions.js +4 -2
- package/dist/esm/pm-plugins/auto-expand-selection-range-on-inline-node-main.js +8 -14
- package/dist/esm/pm-plugins/gap-cursor/actions.js +4 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 2.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142352](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142352)
|
|
8
|
+
[`05903fde6d94d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05903fde6d94d) -
|
|
9
|
+
Internal change to use Compiled variant of `@atlaskit/primitives`.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.1.8
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#133479](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/133479)
|
|
17
|
+
[`57fe747245f32`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/57fe747245f32) -
|
|
18
|
+
Clean up experiment
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.1.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -7,7 +7,6 @@ exports.createAutoExpandSelectionRangeOnInlineNodePlugin = void 0;
|
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
10
|
var _autoExpandSelectionRangeOnInlineNodeKey = require("./auto-expand-selection-range-on-inline-node-key");
|
|
12
11
|
var createAutoExpandSelectionRangeOnInlineNodePlugin = exports.createAutoExpandSelectionRangeOnInlineNodePlugin = function createAutoExpandSelectionRangeOnInlineNodePlugin() {
|
|
13
12
|
var mouseDownElement = null;
|
|
@@ -54,21 +53,16 @@ var createAutoExpandSelectionRangeOnInlineNodePlugin = exports.createAutoExpandS
|
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
exposure: true
|
|
60
|
-
})) {
|
|
61
|
-
// find the document position of the mouse up element
|
|
62
|
-
var elementStartPosition = view.posAtDOM(mouseUpElement, 0);
|
|
56
|
+
// find the document position of the mouse up element
|
|
57
|
+
var elementStartPosition = view.posAtDOM(mouseUpElement, 0);
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
// find out the direction of selection
|
|
60
|
+
var isAnchorBeforeElement = selection.$anchor.pos <= elementStartPosition;
|
|
61
|
+
var expandedSelectionHeadPosition = isAnchorBeforeElement ? elementStartPosition + 1 : elementStartPosition;
|
|
67
62
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
63
|
+
// expand the selection to include the mouse up element
|
|
64
|
+
var tr = state.tr.setSelection(_state.TextSelection.create(state.doc, selection.$anchor.pos, expandedSelectionHeadPosition));
|
|
65
|
+
dispatch(tr);
|
|
72
66
|
}
|
|
73
67
|
}
|
|
74
68
|
}
|
|
@@ -23,8 +23,10 @@ var shouldSkipGapCursor = exports.shouldSkipGapCursor = function shouldSkipGapCu
|
|
|
23
23
|
}
|
|
24
24
|
return (0, _utils.isPositionNearTableRow)($pos, schema, 'before') || (0, _utils3.isTextBlockNearPos)(doc, schema, $pos, -1) || (0, _utils.isNodeBeforeMediaNode)($pos, state);
|
|
25
25
|
case _direction.Direction.DOWN:
|
|
26
|
-
return (
|
|
27
|
-
|
|
26
|
+
return (
|
|
27
|
+
// end of a paragraph
|
|
28
|
+
(0, _selection.atTheEndOfDoc)(state) || (0, _utils3.isTextBlockNearPos)(doc, schema, $pos, 1) || (0, _utils.isPositionNearTableRow)($pos, schema, 'after') || ((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.type.name) === 'text' && !$pos.nodeAfter
|
|
29
|
+
);
|
|
28
30
|
default:
|
|
29
31
|
return false;
|
|
30
32
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { autoExpandSelectionRangeOnInlineNodePluginKey } from './auto-expand-selection-range-on-inline-node-key';
|
|
6
5
|
export const createAutoExpandSelectionRangeOnInlineNodePlugin = () => {
|
|
7
6
|
let mouseDownElement = null;
|
|
@@ -52,21 +51,16 @@ export const createAutoExpandSelectionRangeOnInlineNodePlugin = () => {
|
|
|
52
51
|
return;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
exposure: true
|
|
58
|
-
})) {
|
|
59
|
-
// find the document position of the mouse up element
|
|
60
|
-
const elementStartPosition = view.posAtDOM(mouseUpElement, 0);
|
|
54
|
+
// find the document position of the mouse up element
|
|
55
|
+
const elementStartPosition = view.posAtDOM(mouseUpElement, 0);
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
// find out the direction of selection
|
|
58
|
+
const isAnchorBeforeElement = selection.$anchor.pos <= elementStartPosition;
|
|
59
|
+
const expandedSelectionHeadPosition = isAnchorBeforeElement ? elementStartPosition + 1 : elementStartPosition;
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
61
|
+
// expand the selection to include the mouse up element
|
|
62
|
+
const tr = state.tr.setSelection(TextSelection.create(state.doc, selection.$anchor.pos, expandedSelectionHeadPosition));
|
|
63
|
+
dispatch(tr);
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
66
|
}
|
|
@@ -19,8 +19,10 @@ export const shouldSkipGapCursor = (direction, state, $pos) => {
|
|
|
19
19
|
}
|
|
20
20
|
return isPositionNearTableRow($pos, schema, 'before') || isTextBlockNearPos(doc, schema, $pos, -1) || isNodeBeforeMediaNode($pos, state);
|
|
21
21
|
case Direction.DOWN:
|
|
22
|
-
return
|
|
23
|
-
|
|
22
|
+
return (
|
|
23
|
+
// end of a paragraph
|
|
24
|
+
atTheEndOfDoc(state) || isTextBlockNearPos(doc, schema, $pos, 1) || isPositionNearTableRow($pos, schema, 'after') || ((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.type.name) === 'text' && !$pos.nodeAfter
|
|
25
|
+
);
|
|
24
26
|
default:
|
|
25
27
|
return false;
|
|
26
28
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { autoExpandSelectionRangeOnInlineNodePluginKey } from './auto-expand-selection-range-on-inline-node-key';
|
|
6
5
|
export var createAutoExpandSelectionRangeOnInlineNodePlugin = function createAutoExpandSelectionRangeOnInlineNodePlugin() {
|
|
7
6
|
var mouseDownElement = null;
|
|
@@ -48,21 +47,16 @@ export var createAutoExpandSelectionRangeOnInlineNodePlugin = function createAut
|
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
exposure: true
|
|
54
|
-
})) {
|
|
55
|
-
// find the document position of the mouse up element
|
|
56
|
-
var elementStartPosition = view.posAtDOM(mouseUpElement, 0);
|
|
50
|
+
// find the document position of the mouse up element
|
|
51
|
+
var elementStartPosition = view.posAtDOM(mouseUpElement, 0);
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
// find out the direction of selection
|
|
54
|
+
var isAnchorBeforeElement = selection.$anchor.pos <= elementStartPosition;
|
|
55
|
+
var expandedSelectionHeadPosition = isAnchorBeforeElement ? elementStartPosition + 1 : elementStartPosition;
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
57
|
+
// expand the selection to include the mouse up element
|
|
58
|
+
var tr = state.tr.setSelection(TextSelection.create(state.doc, selection.$anchor.pos, expandedSelectionHeadPosition));
|
|
59
|
+
dispatch(tr);
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
}
|
|
@@ -17,8 +17,10 @@ export var shouldSkipGapCursor = function shouldSkipGapCursor(direction, state,
|
|
|
17
17
|
}
|
|
18
18
|
return isPositionNearTableRow($pos, schema, 'before') || isTextBlockNearPos(doc, schema, $pos, -1) || isNodeBeforeMediaNode($pos, state);
|
|
19
19
|
case Direction.DOWN:
|
|
20
|
-
return
|
|
21
|
-
|
|
20
|
+
return (
|
|
21
|
+
// end of a paragraph
|
|
22
|
+
atTheEndOfDoc(state) || isTextBlockNearPos(doc, schema, $pos, 1) || isPositionNearTableRow($pos, schema, 'after') || ((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.type.name) === 'text' && !$pos.nodeAfter
|
|
23
|
+
);
|
|
22
24
|
default:
|
|
23
25
|
return false;
|
|
24
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"runReact18": true
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaskit/editor-common": "^103.
|
|
23
|
+
"@atlaskit/editor-common": "^103.12.0",
|
|
24
24
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
25
25
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
26
26
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
27
27
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
28
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
29
|
-
"@atlaskit/tokens": "^4.
|
|
28
|
+
"@atlaskit/tmp-editor-statsig": "^4.12.0",
|
|
29
|
+
"@atlaskit/tokens": "^4.8.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|