@atlaskit/editor-plugin-block-menu 3.2.2 → 3.2.4
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 +16 -0
- package/dist/cjs/editor-commands/formatNode.js +7 -1
- package/dist/cjs/editor-commands/selection.js +39 -0
- package/dist/cjs/ui/block-menu.js +6 -7
- package/dist/es2019/editor-commands/formatNode.js +7 -1
- package/dist/es2019/editor-commands/selection.js +33 -0
- package/dist/es2019/ui/block-menu.js +4 -5
- package/dist/esm/editor-commands/formatNode.js +7 -1
- package/dist/esm/editor-commands/selection.js +33 -0
- package/dist/esm/ui/block-menu.js +6 -7
- package/dist/types/editor-commands/selection.d.ts +10 -0
- package/dist/types-ts4.5/editor-commands/selection.d.ts +10 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 3.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ef686b3cfdbff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef686b3cfdbff) -
|
|
8
|
+
ED-29222: Make empty line experiment dependent on block menu
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 3.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`d5e5b25fe885a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d5e5b25fe885a) -
|
|
16
|
+
[ux] ED-29226 Open block menu when drag handle is focussed and space or enter key is pressed
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 3.2.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.formatNode = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
10
|
+
var _selection = require("./selection");
|
|
9
11
|
var _layoutTransforms = require("./transforms/layout-transforms");
|
|
10
12
|
var _transformNodeToTargetType = require("./transforms/transformNodeToTargetType");
|
|
11
13
|
/**
|
|
@@ -98,7 +100,11 @@ var formatNode = exports.formatNode = function formatNode(targetType) {
|
|
|
98
100
|
nodePos = selection.$from.pos;
|
|
99
101
|
}
|
|
100
102
|
try {
|
|
101
|
-
|
|
103
|
+
var newTr = (0, _transformNodeToTargetType.transformNodeToTargetType)(tr, nodeToFormat, nodePos, targetType);
|
|
104
|
+
if (newTr && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_selection_fix')) {
|
|
105
|
+
return (0, _selection.setSelectionAfterTransform)(newTr, nodePos, targetType);
|
|
106
|
+
}
|
|
107
|
+
return newTr;
|
|
102
108
|
} catch (_unused) {
|
|
103
109
|
return null;
|
|
104
110
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Sets the appropriate selection after transforming a node to a target type
|
|
10
|
+
* @param newTr - The transaction containing the transformed node
|
|
11
|
+
* @param nodePos - The position of the transformed node
|
|
12
|
+
* @param targetType - The target type the node was transformed to
|
|
13
|
+
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
14
|
+
*/
|
|
15
|
+
var setSelectionAfterTransform = exports.setSelectionAfterTransform = function setSelectionAfterTransform(newTr, nodePos, targetType) {
|
|
16
|
+
// Find the actual node that was transformed to get its positioning
|
|
17
|
+
var transformedNodePos = newTr.doc.resolve(nodePos);
|
|
18
|
+
var transformedNode = transformedNodePos.nodeAfter;
|
|
19
|
+
if (!transformedNode) {
|
|
20
|
+
return newTr;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Check if target type is other than list, text, heading, blockquotes
|
|
24
|
+
var isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
25
|
+
var isBlockquote = targetType === 'blockquote';
|
|
26
|
+
var isContainer = ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
27
|
+
if (isListNode || isBlockquote) {
|
|
28
|
+
// For taskList, select all content within the list
|
|
29
|
+
var textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
30
|
+
var textEnd = transformedNodePos.pos + transformedNode.nodeSize - 1; // End of taskList content
|
|
31
|
+
var textSelection = _state.TextSelection.between(newTr.doc.resolve(textStart), newTr.doc.resolve(textEnd));
|
|
32
|
+
return newTr.setSelection(textSelection);
|
|
33
|
+
} else if (isContainer) {
|
|
34
|
+
// Use NodeSelection for types other than list, text, heading, blockquotes
|
|
35
|
+
var nodeSelection = _state.NodeSelection.create(newTr.doc, transformedNodePos.pos);
|
|
36
|
+
return newTr.setSelection(nodeSelection);
|
|
37
|
+
}
|
|
38
|
+
return newTr;
|
|
39
|
+
};
|
|
@@ -56,7 +56,7 @@ var BlockMenuContent = function BlockMenuContent(_ref) {
|
|
|
56
56
|
}));
|
|
57
57
|
};
|
|
58
58
|
var BlockMenu = function BlockMenu(_ref2) {
|
|
59
|
-
var _editorView$
|
|
59
|
+
var _editorView$dom, _ref3, _editorView$hasFocus;
|
|
60
60
|
var editorView = _ref2.editorView,
|
|
61
61
|
api = _ref2.api,
|
|
62
62
|
mountTo = _ref2.mountTo,
|
|
@@ -77,13 +77,13 @@ var BlockMenu = function BlockMenu(_ref2) {
|
|
|
77
77
|
currentUserIntent = _useSharedPluginState.currentUserIntent;
|
|
78
78
|
var _useBlockMenu = (0, _blockMenuProvider.useBlockMenu)(),
|
|
79
79
|
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
80
|
-
var
|
|
80
|
+
var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(_styles.DRAG_HANDLE_SELECTOR);
|
|
81
|
+
var hasFocus = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_ref3 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) || document.activeElement === targetHandleRef) !== null && _ref3 !== void 0 ? _ref3 : false : (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
|
|
81
82
|
var hasSelection = !!editorView && !editorView.state.selection.empty;
|
|
82
|
-
var emptyLineEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
83
83
|
|
|
84
84
|
// hasSelection true, always show block menu
|
|
85
85
|
// hasSelection false, only show block menu when empty line experiment is enabled
|
|
86
|
-
var shouldShowBlockMenuForEmptyLine = hasSelection ||
|
|
86
|
+
var shouldShowBlockMenuForEmptyLine = hasSelection || !hasSelection && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
87
87
|
(0, _react.useEffect)(function () {
|
|
88
88
|
var _api$userIntent;
|
|
89
89
|
if (!isMenuOpen || !menuTriggerBy || !isSelectedViaDragHandle || !hasFocus || !shouldShowBlockMenuForEmptyLine || ['resizing', 'dragging'].includes(currentUserIntent || '')) {
|
|
@@ -95,9 +95,9 @@ var BlockMenu = function BlockMenu(_ref2) {
|
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
97
97
|
var closeMenu = function closeMenu() {
|
|
98
|
-
api === null || api === void 0 || api.core.actions.execute(function (
|
|
98
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref4) {
|
|
99
99
|
var _api$blockControls, _api$userIntent2;
|
|
100
|
-
var tr =
|
|
100
|
+
var tr = _ref4.tr;
|
|
101
101
|
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
|
|
102
102
|
closeMenu: true
|
|
103
103
|
})({
|
|
@@ -114,7 +114,6 @@ var BlockMenu = function BlockMenu(_ref2) {
|
|
|
114
114
|
closeMenu();
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(_styles.DRAG_HANDLE_SELECTOR);
|
|
118
117
|
if (targetHandleRef instanceof HTMLElement) {
|
|
119
118
|
return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
|
|
120
119
|
alignX: 'right',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { findParentNodeOfType, findSelectedNodeOfType, safeInsert as pmSafeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
|
+
import { setSelectionAfterTransform } from './selection';
|
|
3
5
|
import { createDefaultLayoutSection } from './transforms/layout-transforms';
|
|
4
6
|
import { transformNodeToTargetType } from './transforms/transformNodeToTargetType';
|
|
5
7
|
/**
|
|
@@ -101,7 +103,11 @@ export const formatNode = targetType => {
|
|
|
101
103
|
nodePos = selection.$from.pos;
|
|
102
104
|
}
|
|
103
105
|
try {
|
|
104
|
-
|
|
106
|
+
const newTr = transformNodeToTargetType(tr, nodeToFormat, nodePos, targetType);
|
|
107
|
+
if (newTr && fg('platform_editor_block_menu_selection_fix')) {
|
|
108
|
+
return setSelectionAfterTransform(newTr, nodePos, targetType);
|
|
109
|
+
}
|
|
110
|
+
return newTr;
|
|
105
111
|
} catch {
|
|
106
112
|
return null;
|
|
107
113
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the appropriate selection after transforming a node to a target type
|
|
4
|
+
* @param newTr - The transaction containing the transformed node
|
|
5
|
+
* @param nodePos - The position of the transformed node
|
|
6
|
+
* @param targetType - The target type the node was transformed to
|
|
7
|
+
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
8
|
+
*/
|
|
9
|
+
export const setSelectionAfterTransform = (newTr, nodePos, targetType) => {
|
|
10
|
+
// Find the actual node that was transformed to get its positioning
|
|
11
|
+
const transformedNodePos = newTr.doc.resolve(nodePos);
|
|
12
|
+
const transformedNode = transformedNodePos.nodeAfter;
|
|
13
|
+
if (!transformedNode) {
|
|
14
|
+
return newTr;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Check if target type is other than list, text, heading, blockquotes
|
|
18
|
+
const isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
19
|
+
const isBlockquote = targetType === 'blockquote';
|
|
20
|
+
const isContainer = ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
21
|
+
if (isListNode || isBlockquote) {
|
|
22
|
+
// For taskList, select all content within the list
|
|
23
|
+
const textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
24
|
+
const textEnd = transformedNodePos.pos + transformedNode.nodeSize - 1; // End of taskList content
|
|
25
|
+
const textSelection = TextSelection.between(newTr.doc.resolve(textStart), newTr.doc.resolve(textEnd));
|
|
26
|
+
return newTr.setSelection(textSelection);
|
|
27
|
+
} else if (isContainer) {
|
|
28
|
+
// Use NodeSelection for types other than list, text, heading, blockquotes
|
|
29
|
+
const nodeSelection = NodeSelection.create(newTr.doc, transformedNodePos.pos);
|
|
30
|
+
return newTr.setSelection(nodeSelection);
|
|
31
|
+
}
|
|
32
|
+
return newTr;
|
|
33
|
+
};
|
|
@@ -49,7 +49,7 @@ const BlockMenu = ({
|
|
|
49
49
|
boundariesElement,
|
|
50
50
|
scrollableElement
|
|
51
51
|
}) => {
|
|
52
|
-
var _editorView$
|
|
52
|
+
var _editorView$dom, _ref, _editorView$hasFocus;
|
|
53
53
|
const {
|
|
54
54
|
menuTriggerBy,
|
|
55
55
|
isSelectedViaDragHandle,
|
|
@@ -67,13 +67,13 @@ const BlockMenu = ({
|
|
|
67
67
|
const {
|
|
68
68
|
onDropdownOpenChanged
|
|
69
69
|
} = useBlockMenu();
|
|
70
|
-
const
|
|
70
|
+
const targetHandleRef = editorView === null || editorView === void 0 ? void 0 : (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
71
|
+
const hasFocus = expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_ref = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) || document.activeElement === targetHandleRef) !== null && _ref !== void 0 ? _ref : false : (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
|
|
71
72
|
const hasSelection = !!editorView && !editorView.state.selection.empty;
|
|
72
|
-
const emptyLineEnabled = expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
73
73
|
|
|
74
74
|
// hasSelection true, always show block menu
|
|
75
75
|
// hasSelection false, only show block menu when empty line experiment is enabled
|
|
76
|
-
const shouldShowBlockMenuForEmptyLine = hasSelection ||
|
|
76
|
+
const shouldShowBlockMenuForEmptyLine = hasSelection || !hasSelection && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
77
77
|
useEffect(() => {
|
|
78
78
|
var _api$userIntent;
|
|
79
79
|
if (!isMenuOpen || !menuTriggerBy || !isSelectedViaDragHandle || !hasFocus || !shouldShowBlockMenuForEmptyLine || ['resizing', 'dragging'].includes(currentUserIntent || '')) {
|
|
@@ -105,7 +105,6 @@ const BlockMenu = ({
|
|
|
105
105
|
closeMenu();
|
|
106
106
|
return null;
|
|
107
107
|
}
|
|
108
|
-
const targetHandleRef = editorView === null || editorView === void 0 ? void 0 : (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
109
108
|
if (targetHandleRef instanceof HTMLElement) {
|
|
110
109
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
111
110
|
alignX: 'right',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { findParentNodeOfType, findSelectedNodeOfType, safeInsert as pmSafeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
|
+
import { setSelectionAfterTransform } from './selection';
|
|
3
5
|
import { createDefaultLayoutSection } from './transforms/layout-transforms';
|
|
4
6
|
import { transformNodeToTargetType } from './transforms/transformNodeToTargetType';
|
|
5
7
|
/**
|
|
@@ -92,7 +94,11 @@ export var formatNode = function formatNode(targetType) {
|
|
|
92
94
|
nodePos = selection.$from.pos;
|
|
93
95
|
}
|
|
94
96
|
try {
|
|
95
|
-
|
|
97
|
+
var newTr = transformNodeToTargetType(tr, nodeToFormat, nodePos, targetType);
|
|
98
|
+
if (newTr && fg('platform_editor_block_menu_selection_fix')) {
|
|
99
|
+
return setSelectionAfterTransform(newTr, nodePos, targetType);
|
|
100
|
+
}
|
|
101
|
+
return newTr;
|
|
96
102
|
} catch (_unused) {
|
|
97
103
|
return null;
|
|
98
104
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the appropriate selection after transforming a node to a target type
|
|
4
|
+
* @param newTr - The transaction containing the transformed node
|
|
5
|
+
* @param nodePos - The position of the transformed node
|
|
6
|
+
* @param targetType - The target type the node was transformed to
|
|
7
|
+
* @returns The transaction with the updated selection, or the original transaction if no selection change needed
|
|
8
|
+
*/
|
|
9
|
+
export var setSelectionAfterTransform = function setSelectionAfterTransform(newTr, nodePos, targetType) {
|
|
10
|
+
// Find the actual node that was transformed to get its positioning
|
|
11
|
+
var transformedNodePos = newTr.doc.resolve(nodePos);
|
|
12
|
+
var transformedNode = transformedNodePos.nodeAfter;
|
|
13
|
+
if (!transformedNode) {
|
|
14
|
+
return newTr;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Check if target type is other than list, text, heading, blockquotes
|
|
18
|
+
var isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
19
|
+
var isBlockquote = targetType === 'blockquote';
|
|
20
|
+
var isContainer = ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
21
|
+
if (isListNode || isBlockquote) {
|
|
22
|
+
// For taskList, select all content within the list
|
|
23
|
+
var textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
24
|
+
var textEnd = transformedNodePos.pos + transformedNode.nodeSize - 1; // End of taskList content
|
|
25
|
+
var textSelection = TextSelection.between(newTr.doc.resolve(textStart), newTr.doc.resolve(textEnd));
|
|
26
|
+
return newTr.setSelection(textSelection);
|
|
27
|
+
} else if (isContainer) {
|
|
28
|
+
// Use NodeSelection for types other than list, text, heading, blockquotes
|
|
29
|
+
var nodeSelection = NodeSelection.create(newTr.doc, transformedNodePos.pos);
|
|
30
|
+
return newTr.setSelection(nodeSelection);
|
|
31
|
+
}
|
|
32
|
+
return newTr;
|
|
33
|
+
};
|
|
@@ -48,7 +48,7 @@ var BlockMenuContent = function BlockMenuContent(_ref) {
|
|
|
48
48
|
}));
|
|
49
49
|
};
|
|
50
50
|
var BlockMenu = function BlockMenu(_ref2) {
|
|
51
|
-
var _editorView$
|
|
51
|
+
var _editorView$dom, _ref3, _editorView$hasFocus;
|
|
52
52
|
var editorView = _ref2.editorView,
|
|
53
53
|
api = _ref2.api,
|
|
54
54
|
mountTo = _ref2.mountTo,
|
|
@@ -69,13 +69,13 @@ var BlockMenu = function BlockMenu(_ref2) {
|
|
|
69
69
|
currentUserIntent = _useSharedPluginState.currentUserIntent;
|
|
70
70
|
var _useBlockMenu = useBlockMenu(),
|
|
71
71
|
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
72
|
-
var
|
|
72
|
+
var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
73
|
+
var hasFocus = expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_ref3 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) || document.activeElement === targetHandleRef) !== null && _ref3 !== void 0 ? _ref3 : false : (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
|
|
73
74
|
var hasSelection = !!editorView && !editorView.state.selection.empty;
|
|
74
|
-
var emptyLineEnabled = expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
75
75
|
|
|
76
76
|
// hasSelection true, always show block menu
|
|
77
77
|
// hasSelection false, only show block menu when empty line experiment is enabled
|
|
78
|
-
var shouldShowBlockMenuForEmptyLine = hasSelection ||
|
|
78
|
+
var shouldShowBlockMenuForEmptyLine = hasSelection || !hasSelection && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
79
79
|
useEffect(function () {
|
|
80
80
|
var _api$userIntent;
|
|
81
81
|
if (!isMenuOpen || !menuTriggerBy || !isSelectedViaDragHandle || !hasFocus || !shouldShowBlockMenuForEmptyLine || ['resizing', 'dragging'].includes(currentUserIntent || '')) {
|
|
@@ -87,9 +87,9 @@ var BlockMenu = function BlockMenu(_ref2) {
|
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
89
|
var closeMenu = function closeMenu() {
|
|
90
|
-
api === null || api === void 0 || api.core.actions.execute(function (
|
|
90
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref4) {
|
|
91
91
|
var _api$blockControls, _api$userIntent2;
|
|
92
|
-
var tr =
|
|
92
|
+
var tr = _ref4.tr;
|
|
93
93
|
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
|
|
94
94
|
closeMenu: true
|
|
95
95
|
})({
|
|
@@ -106,7 +106,6 @@ var BlockMenu = function BlockMenu(_ref2) {
|
|
|
106
106
|
closeMenu();
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
|
-
var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
110
109
|
if (targetHandleRef instanceof HTMLElement) {
|
|
111
110
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
112
111
|
alignX: 'right',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { FormatNodeTargetType } from './transforms/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: FormatNodeTargetType) => Transaction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { FormatNodeTargetType } from './transforms/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: FormatNodeTargetType) => Transaction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/primitives": "^14.15.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^12.28.0",
|
|
46
46
|
"@atlaskit/tokens": "^6.3.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0"
|
|
48
48
|
},
|
|
@@ -90,6 +90,9 @@
|
|
|
90
90
|
"platform-feature-flags": {
|
|
91
91
|
"platform_editor_adf_with_localid": {
|
|
92
92
|
"type": "boolean"
|
|
93
|
+
},
|
|
94
|
+
"platform_editor_block_menu_selection_fix": {
|
|
95
|
+
"type": "boolean"
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
}
|