@atlaskit/editor-plugin-block-controls 1.4.0 → 1.4.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,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#102680](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102680)
|
|
14
|
+
[`8b186c4a0475`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b186c4a0475) -
|
|
15
|
+
Show text controls on drag handle click
|
|
16
|
+
|
|
3
17
|
## 1.4.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -9,7 +9,20 @@ var getSelection = exports.getSelection = function getSelection(tr, start) {
|
|
|
9
9
|
var node = tr.doc.nodeAt(start);
|
|
10
10
|
var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
|
|
11
11
|
var nodeSize = node ? node.nodeSize : 1;
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
var $startPos = tr.doc.resolve(start);
|
|
13
|
+
if (isNodeSelection) {
|
|
14
|
+
return new _state.NodeSelection($startPos);
|
|
15
|
+
} else {
|
|
16
|
+
var textNodesPos = [];
|
|
17
|
+
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n, pos) {
|
|
18
|
+
if (n.isText) {
|
|
19
|
+
textNodesPos.push(pos);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
24
|
+
var textNodeStart = textNodesPos[0] || start;
|
|
25
|
+
var textNodeDepth = textNodeStart - start;
|
|
26
|
+
return new _state.TextSelection(tr.doc.resolve(textNodeStart), tr.doc.resolve(start + nodeSize - textNodeDepth));
|
|
27
|
+
}
|
|
15
28
|
};
|
|
@@ -3,7 +3,20 @@ export const getSelection = (tr, start) => {
|
|
|
3
3
|
const node = tr.doc.nodeAt(start);
|
|
4
4
|
const isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
5
5
|
const nodeSize = node ? node.nodeSize : 1;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const $startPos = tr.doc.resolve(start);
|
|
7
|
+
if (isNodeSelection) {
|
|
8
|
+
return new NodeSelection($startPos);
|
|
9
|
+
} else {
|
|
10
|
+
const textNodesPos = [];
|
|
11
|
+
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, (n, pos) => {
|
|
12
|
+
if (n.isText) {
|
|
13
|
+
textNodesPos.push(pos);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
});
|
|
18
|
+
const textNodeStart = textNodesPos[0] || start;
|
|
19
|
+
const textNodeDepth = textNodeStart - start;
|
|
20
|
+
return new TextSelection(tr.doc.resolve(textNodeStart), tr.doc.resolve(start + nodeSize - textNodeDepth));
|
|
21
|
+
}
|
|
9
22
|
};
|
|
@@ -3,7 +3,20 @@ export var getSelection = function getSelection(tr, start) {
|
|
|
3
3
|
var node = tr.doc.nodeAt(start);
|
|
4
4
|
var isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
5
5
|
var nodeSize = node ? node.nodeSize : 1;
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
var $startPos = tr.doc.resolve(start);
|
|
7
|
+
if (isNodeSelection) {
|
|
8
|
+
return new NodeSelection($startPos);
|
|
9
|
+
} else {
|
|
10
|
+
var textNodesPos = [];
|
|
11
|
+
tr.doc.nodesBetween($startPos.pos, $startPos.pos + nodeSize, function (n, pos) {
|
|
12
|
+
if (n.isText) {
|
|
13
|
+
textNodesPos.push(pos);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
});
|
|
18
|
+
var textNodeStart = textNodesPos[0] || start;
|
|
19
|
+
var textNodeDepth = textNodeStart - start;
|
|
20
|
+
return new TextSelection(tr.doc.resolve(textNodeStart), tr.doc.resolve(start + nodeSize - textNodeDepth));
|
|
21
|
+
}
|
|
9
22
|
};
|
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.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/editor-common": "^81.0.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
36
|
-
"@atlaskit/icon": "^22.
|
|
36
|
+
"@atlaskit/icon": "^22.3.0",
|
|
37
37
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
38
38
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
39
39
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
40
|
-
"@atlaskit/tokens": "^1.
|
|
40
|
+
"@atlaskit/tokens": "^1.49.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@emotion/react": "^11.7.1"
|
|
43
43
|
},
|