@atlaskit/editor-plugin-block-menu 29.0.3 → 29.0.5
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 +17 -0
- package/dist/cjs/ui/consts.js +1 -3
- package/dist/es2019/ui/consts.js +0 -2
- package/dist/esm/ui/consts.js +0 -2
- package/dist/types/ui/consts.d.ts +0 -1
- package/dist/types/ui/utils/suggested-items-rank.d.ts +0 -1
- package/package.json +3 -4
- package/dist/cjs/editor-commands/selection.js +0 -40
- package/dist/es2019/editor-commands/selection.js +0 -34
- package/dist/esm/editor-commands/selection.js +0 -34
- package/dist/types/editor-commands/selection.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 29.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7efec208f3bb4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7efec208f3bb4) -
|
|
8
|
+
Remove unused runtime dependencies
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 29.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`c5b599e3bc90a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c5b599e3bc90a) -
|
|
16
|
+
Remove unused internal code and replace loose plugin state return types with PluginState. No
|
|
17
|
+
behaviour change.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 29.0.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var BLOCK_MENU_LABEL = exports.BLOCK_MENU_LABEL = 'Editor Block Menu';
|
|
8
|
-
|
|
6
|
+
exports.BLOCK_MENU_ITEM_NAME = void 0;
|
|
9
7
|
/**
|
|
10
8
|
* Constants for block menu analytics menu item names
|
|
11
9
|
*/
|
package/dist/es2019/ui/consts.js
CHANGED
package/dist/esm/ui/consts.js
CHANGED
|
@@ -33,7 +33,6 @@ export declare const BLOCK_MENU_NODE_TYPES: {
|
|
|
33
33
|
readonly TABLE: NodeTypeName;
|
|
34
34
|
readonly TASK_LIST: NodeTypeName;
|
|
35
35
|
};
|
|
36
|
-
export type BlockMenuNodeType = (typeof BLOCK_MENU_NODE_TYPES)[keyof typeof BLOCK_MENU_NODE_TYPES];
|
|
37
36
|
export type SuggestedItemsRankMap = {
|
|
38
37
|
[nodeType: string]: {
|
|
39
38
|
[menuItemKey: string]: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "29.0.
|
|
3
|
+
"version": "29.0.5",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,11 +45,10 @@
|
|
|
45
45
|
"@atlaskit/tmp-editor-statsig": "^248.0.0",
|
|
46
46
|
"@atlaskit/tokens": "^20.8.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
|
-
"bind-event-listener": "^3.0.0"
|
|
49
|
-
"memoize-one": "^6.0.0"
|
|
48
|
+
"bind-event-listener": "^3.0.0"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^134.
|
|
51
|
+
"@atlaskit/editor-common": "^134.2.0",
|
|
53
52
|
"react": "^18.2.0 || ^19.2.0",
|
|
54
53
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
55
54
|
},
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setSelectionAfterTransform = void 0;
|
|
7
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
|
-
/**
|
|
10
|
-
* Sets the appropriate selection after transforming a node to a target type
|
|
11
|
-
* @param newTr - The transaction containing the transformed node
|
|
12
|
-
* @param nodePos - The position of the transformed node
|
|
13
|
-
* @param targetType - The target type the node was transformed to
|
|
14
|
-
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
15
|
-
*/
|
|
16
|
-
var setSelectionAfterTransform = exports.setSelectionAfterTransform = function setSelectionAfterTransform(newTr, nodePos, targetType) {
|
|
17
|
-
// Find the actual node that was transformed to get its positioning
|
|
18
|
-
var transformedNodePos = newTr.doc.resolve(nodePos);
|
|
19
|
-
var transformedNode = transformedNodePos.nodeAfter;
|
|
20
|
-
if (!transformedNode) {
|
|
21
|
-
return newTr;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Check if target type is other than list, text, heading, blockquotes
|
|
25
|
-
var isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
26
|
-
var isBlockquote = targetType === 'blockquote';
|
|
27
|
-
var isContainer = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? ['panel', 'panel_c1', 'expand', 'codeBlock', 'layoutSection'].includes(targetType) : ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
28
|
-
if (isListNode || isBlockquote) {
|
|
29
|
-
// For taskList, select all content within the list
|
|
30
|
-
var textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
31
|
-
var textEnd = transformedNodePos.pos + transformedNode.nodeSize - 1; // End of taskList content
|
|
32
|
-
var textSelection = _state.TextSelection.between(newTr.doc.resolve(textStart), newTr.doc.resolve(textEnd));
|
|
33
|
-
return newTr.setSelection(textSelection);
|
|
34
|
-
} else if (isContainer) {
|
|
35
|
-
// Use NodeSelection for types other than list, text, heading, blockquotes
|
|
36
|
-
var nodeSelection = _state.NodeSelection.create(newTr.doc, transformedNodePos.pos);
|
|
37
|
-
return newTr.setSelection(nodeSelection);
|
|
38
|
-
}
|
|
39
|
-
return newTr;
|
|
40
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
/**
|
|
4
|
-
* Sets the appropriate selection after transforming a node to a target type
|
|
5
|
-
* @param newTr - The transaction containing the transformed node
|
|
6
|
-
* @param nodePos - The position of the transformed node
|
|
7
|
-
* @param targetType - The target type the node was transformed to
|
|
8
|
-
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
9
|
-
*/
|
|
10
|
-
export const setSelectionAfterTransform = (newTr, nodePos, targetType) => {
|
|
11
|
-
// Find the actual node that was transformed to get its positioning
|
|
12
|
-
const transformedNodePos = newTr.doc.resolve(nodePos);
|
|
13
|
-
const transformedNode = transformedNodePos.nodeAfter;
|
|
14
|
-
if (!transformedNode) {
|
|
15
|
-
return newTr;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Check if target type is other than list, text, heading, blockquotes
|
|
19
|
-
const isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
20
|
-
const isBlockquote = targetType === 'blockquote';
|
|
21
|
-
const isContainer = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? ['panel', 'panel_c1', 'expand', 'codeBlock', 'layoutSection'].includes(targetType) : ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
22
|
-
if (isListNode || isBlockquote) {
|
|
23
|
-
// For taskList, select all content within the list
|
|
24
|
-
const textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
25
|
-
const textEnd = transformedNodePos.pos + transformedNode.nodeSize - 1; // End of taskList content
|
|
26
|
-
const textSelection = TextSelection.between(newTr.doc.resolve(textStart), newTr.doc.resolve(textEnd));
|
|
27
|
-
return newTr.setSelection(textSelection);
|
|
28
|
-
} else if (isContainer) {
|
|
29
|
-
// Use NodeSelection for types other than list, text, heading, blockquotes
|
|
30
|
-
const nodeSelection = NodeSelection.create(newTr.doc, transformedNodePos.pos);
|
|
31
|
-
return newTr.setSelection(nodeSelection);
|
|
32
|
-
}
|
|
33
|
-
return newTr;
|
|
34
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
/**
|
|
4
|
-
* Sets the appropriate selection after transforming a node to a target type
|
|
5
|
-
* @param newTr - The transaction containing the transformed node
|
|
6
|
-
* @param nodePos - The position of the transformed node
|
|
7
|
-
* @param targetType - The target type the node was transformed to
|
|
8
|
-
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
9
|
-
*/
|
|
10
|
-
export var setSelectionAfterTransform = function setSelectionAfterTransform(newTr, nodePos, targetType) {
|
|
11
|
-
// Find the actual node that was transformed to get its positioning
|
|
12
|
-
var transformedNodePos = newTr.doc.resolve(nodePos);
|
|
13
|
-
var transformedNode = transformedNodePos.nodeAfter;
|
|
14
|
-
if (!transformedNode) {
|
|
15
|
-
return newTr;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Check if target type is other than list, text, heading, blockquotes
|
|
19
|
-
var isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
20
|
-
var isBlockquote = targetType === 'blockquote';
|
|
21
|
-
var isContainer = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? ['panel', 'panel_c1', 'expand', 'codeBlock', 'layoutSection'].includes(targetType) : ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
22
|
-
if (isListNode || isBlockquote) {
|
|
23
|
-
// For taskList, select all content within the list
|
|
24
|
-
var textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
25
|
-
var textEnd = transformedNodePos.pos + transformedNode.nodeSize - 1; // End of taskList content
|
|
26
|
-
var textSelection = TextSelection.between(newTr.doc.resolve(textStart), newTr.doc.resolve(textEnd));
|
|
27
|
-
return newTr.setSelection(textSelection);
|
|
28
|
-
} else if (isContainer) {
|
|
29
|
-
// Use NodeSelection for types other than list, text, heading, blockquotes
|
|
30
|
-
var nodeSelection = NodeSelection.create(newTr.doc, transformedNodePos.pos);
|
|
31
|
-
return newTr.setSelection(nodeSelection);
|
|
32
|
-
}
|
|
33
|
-
return newTr;
|
|
34
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { TransfromNodeTargetType } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Sets the appropriate selection after transforming a node to a target type
|
|
5
|
-
* @param newTr - The transaction containing the transformed node
|
|
6
|
-
* @param nodePos - The position of the transformed node
|
|
7
|
-
* @param targetType - The target type the node was transformed to
|
|
8
|
-
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
9
|
-
*/
|
|
10
|
-
export declare const setSelectionAfterTransform: (newTr: Transaction, nodePos: number, targetType: TransfromNodeTargetType) => Transaction;
|