@atlaskit/editor-plugin-block-menu 5.2.5 → 5.2.6
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 +8 -0
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +13 -1
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +12 -0
- package/dist/esm/editor-commands/transform-node-utils/utils.js +12 -0
- package/dist/types/editor-commands/transform-node-utils/utils.d.ts +2 -2
- package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 5.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fa50da8ee6860`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fa50da8ee6860) -
|
|
8
|
+
EDITOR-3879 [multi-select] Detect nodes from multi-selection
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.2.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isListType = exports.getTargetNodeTypeNameInContext = exports.getSelectedNode = exports.expandSelectionToBlockRange = void 0;
|
|
6
|
+
exports.isListType = exports.getTargetNodeTypeNameInContext = exports.getSelectedNode = exports.getBlockNodesInRange = exports.expandSelectionToBlockRange = void 0;
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -95,4 +95,16 @@ var isListType = exports.isListType = function isListType(node, schema) {
|
|
|
95
95
|
return lists.some(function (list) {
|
|
96
96
|
return list === node.type;
|
|
97
97
|
});
|
|
98
|
+
};
|
|
99
|
+
var getBlockNodesInRange = exports.getBlockNodesInRange = function getBlockNodesInRange(range) {
|
|
100
|
+
if (range.endIndex - range.startIndex <= 1) {
|
|
101
|
+
return [range.parent.child(range.startIndex)];
|
|
102
|
+
}
|
|
103
|
+
var blockNodes = [];
|
|
104
|
+
for (var i = range.startIndex; i < range.endIndex; i++) {
|
|
105
|
+
if (range.parent.child(i).isBlock) {
|
|
106
|
+
blockNodes.push(range.parent.child(i));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return blockNodes;
|
|
98
110
|
};
|
|
@@ -90,4 +90,16 @@ export const expandSelectionToBlockRange = (selection, schema) => {
|
|
|
90
90
|
export const isListType = (node, schema) => {
|
|
91
91
|
const lists = [schema.nodes.taskList, schema.nodes.bulletList, schema.nodes.orderedList];
|
|
92
92
|
return lists.some(list => list === node.type);
|
|
93
|
+
};
|
|
94
|
+
export const getBlockNodesInRange = range => {
|
|
95
|
+
if (range.endIndex - range.startIndex <= 1) {
|
|
96
|
+
return [range.parent.child(range.startIndex)];
|
|
97
|
+
}
|
|
98
|
+
const blockNodes = [];
|
|
99
|
+
for (let i = range.startIndex; i < range.endIndex; i++) {
|
|
100
|
+
if (range.parent.child(i).isBlock) {
|
|
101
|
+
blockNodes.push(range.parent.child(i));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return blockNodes;
|
|
93
105
|
};
|
|
@@ -89,4 +89,16 @@ export var isListType = function isListType(node, schema) {
|
|
|
89
89
|
return lists.some(function (list) {
|
|
90
90
|
return list === node.type;
|
|
91
91
|
});
|
|
92
|
+
};
|
|
93
|
+
export var getBlockNodesInRange = function getBlockNodesInRange(range) {
|
|
94
|
+
if (range.endIndex - range.startIndex <= 1) {
|
|
95
|
+
return [range.parent.child(range.startIndex)];
|
|
96
|
+
}
|
|
97
|
+
var blockNodes = [];
|
|
98
|
+
for (var i = range.startIndex; i < range.endIndex; i++) {
|
|
99
|
+
if (range.parent.child(i).isBlock) {
|
|
100
|
+
blockNodes.push(range.parent.child(i));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return blockNodes;
|
|
92
104
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
|
+
import type { Schema, Node as PMNode, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
4
|
import type { NodeTypeName } from './types';
|
|
@@ -17,3 +16,4 @@ export declare const expandSelectionToBlockRange: (selection: Selection, schema:
|
|
|
17
16
|
$to: import("prosemirror-model").ResolvedPos;
|
|
18
17
|
};
|
|
19
18
|
export declare const isListType: (node: PMNode, schema: Schema) => boolean;
|
|
19
|
+
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
|
+
import type { Schema, Node as PMNode, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
4
|
import type { NodeTypeName } from './types';
|
|
@@ -17,3 +16,4 @@ export declare const expandSelectionToBlockRange: (selection: Selection, schema:
|
|
|
17
16
|
$to: import("prosemirror-model").ResolvedPos;
|
|
18
17
|
};
|
|
19
18
|
export declare const isListType: (node: PMNode, schema: Schema) => boolean;
|
|
19
|
+
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.6",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
46
46
|
"@atlaskit/primitives": "^16.4.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^15.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^15.9.0",
|
|
48
48
|
"@atlaskit/tokens": "^8.4.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|