@atlaskit/editor-plugin-block-menu 5.2.15 → 5.2.17
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 +21 -0
- package/dist/cjs/editor-commands/transform-node-utils/nodeChecks.js +33 -0
- package/dist/cjs/editor-commands/transform-node-utils/steps/flattenListStep.js +7 -12
- package/dist/cjs/editor-commands/transform-node-utils/steps/listToDecisionListStep.js +3 -3
- package/dist/cjs/editor-commands/transform-node-utils/steps/listToListStep.js +11 -11
- package/dist/cjs/editor-commands/transform-node-utils/steps/wrapTextToCodeblock.js +21 -0
- package/dist/cjs/editor-commands/transform-node-utils/transform.js +11 -11
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +20 -7
- package/dist/cjs/editor-commands/transform-node-utils/wrapIntoListStep.js +29 -7
- package/dist/cjs/editor-commands/transformNode.js +3 -2
- package/dist/cjs/ui/block-menu-components.js +1 -3
- package/dist/cjs/ui/block-menu.js +38 -33
- package/dist/cjs/ui/copy-link.js +2 -2
- package/dist/cjs/ui/delete-section.js +1 -8
- package/dist/es2019/editor-commands/transform-node-utils/nodeChecks.js +23 -0
- package/dist/es2019/editor-commands/transform-node-utils/steps/flattenListStep.js +7 -6
- package/dist/es2019/editor-commands/transform-node-utils/steps/listToDecisionListStep.js +3 -4
- package/dist/es2019/editor-commands/transform-node-utils/steps/listToListStep.js +11 -12
- package/dist/es2019/editor-commands/transform-node-utils/steps/wrapTextToCodeblock.js +18 -0
- package/dist/es2019/editor-commands/transform-node-utils/transform.js +11 -11
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +19 -4
- package/dist/es2019/editor-commands/transform-node-utils/wrapIntoListStep.js +29 -7
- package/dist/es2019/editor-commands/transformNode.js +3 -2
- package/dist/es2019/ui/block-menu-components.js +1 -3
- package/dist/es2019/ui/block-menu.js +38 -33
- package/dist/es2019/ui/copy-link.js +2 -2
- package/dist/es2019/ui/delete-section.js +0 -7
- package/dist/esm/editor-commands/transform-node-utils/nodeChecks.js +27 -0
- package/dist/esm/editor-commands/transform-node-utils/steps/flattenListStep.js +7 -12
- package/dist/esm/editor-commands/transform-node-utils/steps/listToDecisionListStep.js +3 -4
- package/dist/esm/editor-commands/transform-node-utils/steps/listToListStep.js +11 -12
- package/dist/esm/editor-commands/transform-node-utils/steps/wrapTextToCodeblock.js +16 -0
- package/dist/esm/editor-commands/transform-node-utils/transform.js +11 -11
- package/dist/esm/editor-commands/transform-node-utils/utils.js +19 -6
- package/dist/esm/editor-commands/transform-node-utils/wrapIntoListStep.js +29 -7
- package/dist/esm/editor-commands/transformNode.js +3 -2
- package/dist/esm/ui/block-menu-components.js +1 -3
- package/dist/esm/ui/block-menu.js +38 -33
- package/dist/esm/ui/copy-link.js +2 -2
- package/dist/esm/ui/delete-section.js +1 -8
- package/dist/types/editor-commands/transform-node-utils/nodeChecks.d.ts +17 -0
- package/dist/types/editor-commands/transform-node-utils/steps/wrapTextToCodeblock.d.ts +9 -0
- package/dist/types/editor-commands/transform-node-utils/utils.d.ts +8 -1
- package/dist/types/editor-commands/transform-node-utils/wrapIntoListStep.d.ts +7 -1
- package/dist/types/ui/delete-section.d.ts +1 -4
- package/dist/types-ts4.5/editor-commands/transform-node-utils/nodeChecks.d.ts +17 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/wrapTextToCodeblock.d.ts +9 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +8 -1
- package/dist/types-ts4.5/editor-commands/transform-node-utils/wrapIntoListStep.d.ts +7 -1
- package/dist/types-ts4.5/ui/delete-section.d.ts +1 -4
- package/package.json +4 -4
|
@@ -8,6 +8,7 @@ import { unwrapLayoutStep } from './steps/unwrapLayoutStep';
|
|
|
8
8
|
import { unwrapListStep } from './steps/unwrapListStep';
|
|
9
9
|
import { wrapBlockquoteToDecisionListStep } from './steps/wrapBlockquoteToDecisionListStep';
|
|
10
10
|
import { wrapMixedContentStep } from './steps/wrapMixedContentStep';
|
|
11
|
+
import { wrapTextToCodeblockStep } from './steps/wrapTextToCodeblock';
|
|
11
12
|
import { stubStep } from './stubStep';
|
|
12
13
|
import { NODE_CATEGORY_BY_TYPE, toNodeTypeValue } from './types';
|
|
13
14
|
import { unwrapExpandStep } from './unwrapExpandStep';
|
|
@@ -16,14 +17,6 @@ import { wrapIntoLayoutStep } from './wrapIntoLayoutStep';
|
|
|
16
17
|
import { wrapIntoListStep } from './wrapIntoListStep';
|
|
17
18
|
import { wrapStep } from './wrapStep';
|
|
18
19
|
|
|
19
|
-
// Exampled step for overrides:
|
|
20
|
-
// - open Block menu on a paragraph, click 'Panel' in the Turn into'
|
|
21
|
-
// - expected to put paragraph into a panel
|
|
22
|
-
var wrapIntoPanelStep = function wrapIntoPanelStep(nodes, context) {
|
|
23
|
-
var newNode = context.schema.nodes.panel.createAndFill({}, nodes);
|
|
24
|
-
return newNode ? [newNode] : [];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
20
|
// Transform steps for combinations of node categories (block/container/list/text)
|
|
28
21
|
var TRANSFORM_STEPS = {
|
|
29
22
|
atomic: {
|
|
@@ -46,8 +39,8 @@ var TRANSFORM_STEPS = {
|
|
|
46
39
|
},
|
|
47
40
|
text: {
|
|
48
41
|
atomic: undefined,
|
|
49
|
-
container: [
|
|
50
|
-
list: [
|
|
42
|
+
container: [wrapStep],
|
|
43
|
+
list: [wrapIntoListStep],
|
|
51
44
|
text: [stubStep]
|
|
52
45
|
}
|
|
53
46
|
};
|
|
@@ -56,7 +49,8 @@ var TRANSFORM_STEPS = {
|
|
|
56
49
|
// using generic rules/steps from TRANSFORM_STEPS.
|
|
57
50
|
var TRANSFORM_STEPS_OVERRIDE = {
|
|
58
51
|
paragraph: {
|
|
59
|
-
|
|
52
|
+
codeBlock: [wrapTextToCodeblockStep],
|
|
53
|
+
layoutSection: [wrapIntoLayoutStep]
|
|
60
54
|
},
|
|
61
55
|
panel: {
|
|
62
56
|
layoutSection: [unwrapStep, wrapIntoLayoutStep],
|
|
@@ -130,6 +124,12 @@ var TRANSFORM_STEPS_OVERRIDE = {
|
|
|
130
124
|
orderedList: [decisionListToListStep],
|
|
131
125
|
taskList: [decisionListToListStep],
|
|
132
126
|
layoutSection: [wrapIntoLayoutStep]
|
|
127
|
+
},
|
|
128
|
+
blockCard: {
|
|
129
|
+
layoutSection: [wrapIntoLayoutStep]
|
|
130
|
+
},
|
|
131
|
+
embedCard: {
|
|
132
|
+
layoutSection: [wrapIntoLayoutStep]
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
var getTransformStepsForNodeTypes = function getTransformStepsForNodeTypes(selectedNodeTypeName, targetNodeTypeName) {
|
|
@@ -49,12 +49,6 @@ export var getTargetNodeTypeNameInContext = function getTargetNodeTypeNameInCont
|
|
|
49
49
|
}
|
|
50
50
|
return nodeTypeName;
|
|
51
51
|
};
|
|
52
|
-
export var isListType = function isListType(node, schema) {
|
|
53
|
-
var lists = [schema.nodes.taskList, schema.nodes.bulletList, schema.nodes.orderedList];
|
|
54
|
-
return lists.some(function (list) {
|
|
55
|
-
return list === node.type;
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
52
|
|
|
59
53
|
/**
|
|
60
54
|
* Converts a nestedExpand to a regular expand node.
|
|
@@ -101,4 +95,23 @@ export var getBlockNodesInRange = function getBlockNodesInRange(range) {
|
|
|
101
95
|
}
|
|
102
96
|
}
|
|
103
97
|
return blockNodes;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Iterates over a nodes children and extracting text content, removing all other inline content and converting
|
|
102
|
+
* hardbreaks to newlines.
|
|
103
|
+
*
|
|
104
|
+
* @param node - The node to create text content from (should be paragraph)
|
|
105
|
+
* @returns The text content string.
|
|
106
|
+
*/
|
|
107
|
+
export var createTextContent = function createTextContent(node) {
|
|
108
|
+
var textContent = node.children.map(function (child) {
|
|
109
|
+
if (child.isText) {
|
|
110
|
+
return child.text;
|
|
111
|
+
} else if (child.type.name === 'hardBreak') {
|
|
112
|
+
return '\n';
|
|
113
|
+
}
|
|
114
|
+
return '';
|
|
115
|
+
});
|
|
116
|
+
return textContent.join('');
|
|
104
117
|
};
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
import { isListWithTextContentOnly } from './nodeChecks';
|
|
2
|
+
var wrapIntoTaskOrDecisionList = function wrapIntoTaskOrDecisionList(nodes, targetNodeTypeName, schema) {
|
|
3
|
+
var itemNodeType = targetNodeTypeName === 'taskList' ? schema.nodes.taskItem : schema.nodes.decisionItem;
|
|
4
|
+
var inlineContent = nodes.flatMap(function (node) {
|
|
5
|
+
if (node.isTextblock) {
|
|
6
|
+
return node.children;
|
|
7
|
+
} else if (node.isText) {
|
|
8
|
+
return [node];
|
|
9
|
+
}
|
|
10
|
+
return [];
|
|
11
|
+
});
|
|
12
|
+
var itemNode = itemNodeType.create({}, inlineContent);
|
|
13
|
+
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, itemNode);
|
|
14
|
+
return outputNode ? [outputNode] : nodes;
|
|
15
|
+
};
|
|
16
|
+
var wrapIntoBulletOrOrderedList = function wrapIntoBulletOrOrderedList(nodes, targetNodeTypeName, schema) {
|
|
17
|
+
var listItemNode = schema.nodes.listItem.createAndFill({}, nodes);
|
|
18
|
+
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, listItemNode);
|
|
19
|
+
return outputNode ? [outputNode] : nodes;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Wraps nodes into bullet list, numbered list, task list, or decision list.
|
|
24
|
+
*
|
|
25
|
+
* @param nodes - The nodes to wrap.
|
|
26
|
+
* @param context - The transformation context containing schema and target node type.
|
|
27
|
+
* @returns The wrapped nodes.
|
|
28
|
+
*/
|
|
2
29
|
export var wrapIntoListStep = function wrapIntoListStep(nodes, context) {
|
|
3
30
|
var schema = context.schema,
|
|
4
31
|
targetNodeTypeName = context.targetNodeTypeName;
|
|
5
|
-
|
|
6
|
-
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, listItemNode);
|
|
7
|
-
if (outputNode) {
|
|
8
|
-
return [outputNode];
|
|
9
|
-
}
|
|
10
|
-
return nodes;
|
|
32
|
+
return isListWithTextContentOnly(targetNodeTypeName, schema) ? wrapIntoTaskOrDecisionList(nodes, targetNodeTypeName, schema) : wrapIntoBulletOrOrderedList(nodes, targetNodeTypeName, schema);
|
|
11
33
|
};
|
|
@@ -20,8 +20,9 @@ export var transformNode = function transformNode(api) {
|
|
|
20
20
|
var _expandSelectionToBlo = expandSelectionToBlockRange(preservedSelection),
|
|
21
21
|
$from = _expandSelectionToBlo.$from,
|
|
22
22
|
$to = _expandSelectionToBlo.$to;
|
|
23
|
-
var isNested = isNestedNode(preservedSelection, '');
|
|
24
23
|
var selectedParent = $from.parent;
|
|
24
|
+
var isParentLayout = selectedParent.type === nodes.layoutColumn;
|
|
25
|
+
var isNestedExceptLayout = isNestedNode(preservedSelection, '') && !isParentLayout;
|
|
25
26
|
var fragment = Fragment.empty;
|
|
26
27
|
var isList = isListNode(selectedParent);
|
|
27
28
|
var slice = tr.doc.slice(isList ? $from.pos - 1 : $from.pos, isList ? $to.pos + 1 : $to.pos);
|
|
@@ -30,7 +31,7 @@ export var transformNode = function transformNode(api) {
|
|
|
30
31
|
sourceNode: node,
|
|
31
32
|
targetNodeType: targetType,
|
|
32
33
|
schema: tr.doc.type.schema,
|
|
33
|
-
isNested:
|
|
34
|
+
isNested: isNestedExceptLayout
|
|
34
35
|
});
|
|
35
36
|
if (outputNode) {
|
|
36
37
|
fragment = fragment.append(Fragment.fromArray(outputNode));
|
|
@@ -196,9 +196,7 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref7) {
|
|
|
196
196
|
rank: MAIN_BLOCK_MENU_SECTION_RANK[DELETE_MENU_SECTION.key],
|
|
197
197
|
component: function component(_ref0) {
|
|
198
198
|
var children = _ref0.children;
|
|
199
|
-
return /*#__PURE__*/React.createElement(DeleteSection,
|
|
200
|
-
api: api
|
|
201
|
-
}, children);
|
|
199
|
+
return /*#__PURE__*/React.createElement(DeleteSection, null, children);
|
|
202
200
|
}
|
|
203
201
|
}, {
|
|
204
202
|
type: 'block-menu-item',
|
|
@@ -118,7 +118,7 @@ var BlockMenuContent = function BlockMenuContent(_ref3) {
|
|
|
118
118
|
})));
|
|
119
119
|
};
|
|
120
120
|
var BlockMenu = function BlockMenu(_ref4) {
|
|
121
|
-
var _editorView$dom, _ref5;
|
|
121
|
+
var _editorView$dom, _ref5, _api$analytics3;
|
|
122
122
|
var editorView = _ref4.editorView,
|
|
123
123
|
api = _ref4.api,
|
|
124
124
|
mountTo = _ref4.mountTo,
|
|
@@ -193,6 +193,13 @@ var BlockMenu = function BlockMenu(_ref4) {
|
|
|
193
193
|
return tr;
|
|
194
194
|
});
|
|
195
195
|
};
|
|
196
|
+
var handleClickOutside = function handleClickOutside(e) {
|
|
197
|
+
// check if the clicked element was another drag handle, if so don't close the menu
|
|
198
|
+
if (e.target instanceof HTMLElement && e.target.closest(DRAG_HANDLE_SELECTOR)) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
closeMenu();
|
|
202
|
+
};
|
|
196
203
|
var closeMenu = function closeMenu() {
|
|
197
204
|
api === null || api === void 0 || api.core.actions.execute(function (_ref7) {
|
|
198
205
|
var _api$blockControls3, _api$userIntent3;
|
|
@@ -218,39 +225,37 @@ var BlockMenu = function BlockMenu(_ref4) {
|
|
|
218
225
|
popupRef.current = el;
|
|
219
226
|
}
|
|
220
227
|
};
|
|
221
|
-
if (targetHandleRef instanceof HTMLElement) {
|
|
222
|
-
var _api$analytics3;
|
|
223
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
224
|
-
component: ACTION_SUBJECT.BLOCK_MENU,
|
|
225
|
-
dispatchAnalyticsEvent: api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent,
|
|
226
|
-
fallbackComponent: null
|
|
227
|
-
}, /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
228
|
-
alignX: 'right',
|
|
229
|
-
alignY: 'start',
|
|
230
|
-
handleClickOutside: closeMenu,
|
|
231
|
-
handleEscapeKeydown: closeMenu,
|
|
232
|
-
handleBackspaceDeleteKeydown: handleBackspaceDeleteKeydown,
|
|
233
|
-
mountTo: mountTo,
|
|
234
|
-
boundariesElement: boundariesElement,
|
|
235
|
-
scrollableElement: scrollableElement,
|
|
236
|
-
target: targetHandleRef,
|
|
237
|
-
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
238
|
-
fitWidth: DEFAULT_MENU_WIDTH,
|
|
239
|
-
fitHeight: menuHeight,
|
|
240
|
-
preventOverflow: true,
|
|
241
|
-
stick: true,
|
|
242
|
-
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, targetHandleHeightOffset],
|
|
243
|
-
focusTrap: openedViaKeyboard ?
|
|
244
|
-
// Only enable focus trap when opened via keyboard to make sure the focus is on the first focusable menu item
|
|
245
|
-
{
|
|
246
|
-
initialFocus: undefined
|
|
247
|
-
} : undefined
|
|
248
|
-
}, /*#__PURE__*/React.createElement(BlockMenuContent, {
|
|
249
|
-
api: api,
|
|
250
|
-
setRef: setRef
|
|
251
|
-
})));
|
|
252
|
-
} else {
|
|
228
|
+
if (!(targetHandleRef instanceof HTMLElement)) {
|
|
253
229
|
return null;
|
|
254
230
|
}
|
|
231
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
232
|
+
component: ACTION_SUBJECT.BLOCK_MENU,
|
|
233
|
+
dispatchAnalyticsEvent: api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent,
|
|
234
|
+
fallbackComponent: null
|
|
235
|
+
}, /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
236
|
+
alignX: 'right',
|
|
237
|
+
alignY: 'start',
|
|
238
|
+
handleClickOutside: handleClickOutside,
|
|
239
|
+
handleEscapeKeydown: closeMenu,
|
|
240
|
+
handleBackspaceDeleteKeydown: handleBackspaceDeleteKeydown,
|
|
241
|
+
mountTo: mountTo,
|
|
242
|
+
boundariesElement: boundariesElement,
|
|
243
|
+
scrollableElement: scrollableElement,
|
|
244
|
+
target: targetHandleRef,
|
|
245
|
+
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
246
|
+
fitWidth: DEFAULT_MENU_WIDTH,
|
|
247
|
+
fitHeight: menuHeight,
|
|
248
|
+
preventOverflow: true,
|
|
249
|
+
stick: true,
|
|
250
|
+
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, targetHandleHeightOffset],
|
|
251
|
+
focusTrap: openedViaKeyboard ?
|
|
252
|
+
// Only enable focus trap when opened via keyboard to make sure the focus is on the first focusable menu item
|
|
253
|
+
{
|
|
254
|
+
initialFocus: undefined
|
|
255
|
+
} : undefined
|
|
256
|
+
}, /*#__PURE__*/React.createElement(BlockMenuContent, {
|
|
257
|
+
api: api,
|
|
258
|
+
setRef: setRef
|
|
259
|
+
})));
|
|
255
260
|
};
|
|
256
261
|
export default injectIntl(BlockMenu);
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -76,8 +76,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
76
76
|
});
|
|
77
77
|
}, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
|
|
78
78
|
|
|
79
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
|
|
80
|
-
if (!fg('platform_editor_adf_with_localid') || !!menuTriggerBy && isNestedNode(selection, menuTriggerBy)
|
|
79
|
+
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
|
|
80
|
+
if (!fg('platform_editor_adf_with_localid') || !!menuTriggerBy && isNestedNode(selection, menuTriggerBy)) {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
83
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
3
|
export var DeleteSection = function DeleteSection(_ref) {
|
|
4
|
-
var
|
|
5
|
-
var api = _ref.api,
|
|
6
|
-
children = _ref.children;
|
|
7
|
-
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
8
|
-
var isEmptyLineSelected = !!(selection !== null && selection !== void 0 && selection.empty);
|
|
9
|
-
if (isEmptyLineSelected) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
4
|
+
var children = _ref.children;
|
|
12
5
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
13
6
|
hasSeparator: true
|
|
14
7
|
}, children);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a node is a list type that supports indentation (bulletList, orderedList, taskList).
|
|
4
|
+
*
|
|
5
|
+
* @param node - The node to check.
|
|
6
|
+
* @param schema - ProseMirror schema for check
|
|
7
|
+
* @returns True if the node is a list type, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isListWithIndentation: (nodeTypeName: string, schema: Schema) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a node is a list where its list items only support text content (taskList or decisionList).
|
|
12
|
+
*
|
|
13
|
+
* @param nodeTypeName - The node type name to check.
|
|
14
|
+
* @param schema - ProseMirror schema for check
|
|
15
|
+
* @returns True if the node is a list text type, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isListWithTextContentOnly: (nodeTypeName: string, schema: Schema) => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TransformStep } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms a paragraph (or heading) into a codeBlock by extracting its text content.
|
|
4
|
+
* This step handles the conversion of inline content (including marks) to plain text,
|
|
5
|
+
* which is required because codeBlocks can only contain plain text nodes.
|
|
6
|
+
*
|
|
7
|
+
* Example: paragraph with bold/italic/status → codeBlock with plain text
|
|
8
|
+
*/
|
|
9
|
+
export declare const wrapTextToCodeblockStep: TransformStep;
|
|
@@ -4,7 +4,6 @@ import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
4
4
|
import type { NodeTypeName } from './types';
|
|
5
5
|
export declare const getSelectedNode: (selection: Selection) => ContentNodeWithPos | undefined;
|
|
6
6
|
export declare const getTargetNodeTypeNameInContext: (nodeTypeName: NodeTypeName | null, isNested?: boolean) => NodeTypeName | null;
|
|
7
|
-
export declare const isListType: (node: PMNode, schema: Schema) => boolean;
|
|
8
7
|
/**
|
|
9
8
|
* Converts a nestedExpand to a regular expand node.
|
|
10
9
|
* NestedExpands can only exist inside expands, so when breaking out or placing
|
|
@@ -18,3 +17,11 @@ export declare const convertNestedExpandToExpand: (node: PMNode, schema: Schema)
|
|
|
18
17
|
*/
|
|
19
18
|
export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema) => PMNode | null;
|
|
20
19
|
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
20
|
+
/**
|
|
21
|
+
* Iterates over a nodes children and extracting text content, removing all other inline content and converting
|
|
22
|
+
* hardbreaks to newlines.
|
|
23
|
+
*
|
|
24
|
+
* @param node - The node to create text content from (should be paragraph)
|
|
25
|
+
* @returns The text content string.
|
|
26
|
+
*/
|
|
27
|
+
export declare const createTextContent: (node: PMNode) => string;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { TransformStep } from './types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Wraps nodes into bullet list, numbered list, task list, or decision list.
|
|
4
|
+
*
|
|
5
|
+
* @param nodes - The nodes to wrap.
|
|
6
|
+
* @param context - The transformation context containing schema and target node type.
|
|
7
|
+
* @returns The wrapped nodes.
|
|
8
|
+
*/
|
|
3
9
|
export declare const wrapIntoListStep: TransformStep;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
|
-
export declare const DeleteSection: ({ api, children, }: {
|
|
5
|
-
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
2
|
+
export declare const DeleteSection: ({ children, }: {
|
|
6
3
|
children: React.ReactNode;
|
|
7
4
|
}) => React.JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a node is a list type that supports indentation (bulletList, orderedList, taskList).
|
|
4
|
+
*
|
|
5
|
+
* @param node - The node to check.
|
|
6
|
+
* @param schema - ProseMirror schema for check
|
|
7
|
+
* @returns True if the node is a list type, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isListWithIndentation: (nodeTypeName: string, schema: Schema) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a node is a list where its list items only support text content (taskList or decisionList).
|
|
12
|
+
*
|
|
13
|
+
* @param nodeTypeName - The node type name to check.
|
|
14
|
+
* @param schema - ProseMirror schema for check
|
|
15
|
+
* @returns True if the node is a list text type, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isListWithTextContentOnly: (nodeTypeName: string, schema: Schema) => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TransformStep } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms a paragraph (or heading) into a codeBlock by extracting its text content.
|
|
4
|
+
* This step handles the conversion of inline content (including marks) to plain text,
|
|
5
|
+
* which is required because codeBlocks can only contain plain text nodes.
|
|
6
|
+
*
|
|
7
|
+
* Example: paragraph with bold/italic/status → codeBlock with plain text
|
|
8
|
+
*/
|
|
9
|
+
export declare const wrapTextToCodeblockStep: TransformStep;
|
|
@@ -4,7 +4,6 @@ import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
4
4
|
import type { NodeTypeName } from './types';
|
|
5
5
|
export declare const getSelectedNode: (selection: Selection) => ContentNodeWithPos | undefined;
|
|
6
6
|
export declare const getTargetNodeTypeNameInContext: (nodeTypeName: NodeTypeName | null, isNested?: boolean) => NodeTypeName | null;
|
|
7
|
-
export declare const isListType: (node: PMNode, schema: Schema) => boolean;
|
|
8
7
|
/**
|
|
9
8
|
* Converts a nestedExpand to a regular expand node.
|
|
10
9
|
* NestedExpands can only exist inside expands, so when breaking out or placing
|
|
@@ -18,3 +17,11 @@ export declare const convertNestedExpandToExpand: (node: PMNode, schema: Schema)
|
|
|
18
17
|
*/
|
|
19
18
|
export declare const convertExpandToNestedExpand: (node: PMNode, schema: Schema) => PMNode | null;
|
|
20
19
|
export declare const getBlockNodesInRange: (range: NodeRange) => PMNode[];
|
|
20
|
+
/**
|
|
21
|
+
* Iterates over a nodes children and extracting text content, removing all other inline content and converting
|
|
22
|
+
* hardbreaks to newlines.
|
|
23
|
+
*
|
|
24
|
+
* @param node - The node to create text content from (should be paragraph)
|
|
25
|
+
* @returns The text content string.
|
|
26
|
+
*/
|
|
27
|
+
export declare const createTextContent: (node: PMNode) => string;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { TransformStep } from './types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Wraps nodes into bullet list, numbered list, task list, or decision list.
|
|
4
|
+
*
|
|
5
|
+
* @param nodes - The nodes to wrap.
|
|
6
|
+
* @param context - The transformation context containing schema and target node type.
|
|
7
|
+
* @returns The wrapped nodes.
|
|
8
|
+
*/
|
|
3
9
|
export declare const wrapIntoListStep: TransformStep;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
|
-
export declare const DeleteSection: ({ api, children, }: {
|
|
5
|
-
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
2
|
+
export declare const DeleteSection: ({ children, }: {
|
|
6
3
|
children: React.ReactNode;
|
|
7
4
|
}) => React.JSX.Element | null;
|
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.17",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
41
41
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
42
42
|
"@atlaskit/flag": "^17.7.0",
|
|
43
|
-
"@atlaskit/icon": "^29.
|
|
43
|
+
"@atlaskit/icon": "^29.3.0",
|
|
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.16.0",
|
|
48
48
|
"@atlaskit/tokens": "^8.6.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^110.
|
|
52
|
+
"@atlaskit/editor-common": "^110.46.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|