@atlaskit/editor-plugin-block-menu 7.0.0 → 7.0.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 +14 -0
- package/dist/cjs/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +2 -10
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +6 -24
- package/dist/cjs/editor-commands/transform-node-utils/wrapStep.js +1 -8
- package/dist/cjs/editor-commands/transformNode.js +7 -18
- package/dist/cjs/ui/block-menu.js +11 -2
- package/dist/cjs/ui/copy-link.js +2 -0
- package/dist/cjs/ui/delete-button.js +2 -0
- package/dist/cjs/ui/move-down.js +2 -0
- package/dist/cjs/ui/move-up.js +2 -0
- package/dist/es2019/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +2 -10
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +2 -18
- package/dist/es2019/editor-commands/transform-node-utils/wrapStep.js +1 -8
- package/dist/es2019/editor-commands/transformNode.js +9 -20
- package/dist/es2019/ui/block-menu.js +11 -2
- package/dist/es2019/ui/copy-link.js +2 -0
- package/dist/es2019/ui/delete-button.js +2 -0
- package/dist/es2019/ui/move-down.js +2 -0
- package/dist/es2019/ui/move-up.js +2 -0
- package/dist/esm/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +2 -10
- package/dist/esm/editor-commands/transform-node-utils/utils.js +6 -23
- package/dist/esm/editor-commands/transform-node-utils/wrapStep.js +1 -8
- package/dist/esm/editor-commands/transformNode.js +7 -18
- package/dist/esm/ui/block-menu.js +11 -2
- package/dist/esm/ui/copy-link.js +2 -0
- package/dist/esm/ui/delete-button.js +2 -0
- package/dist/esm/ui/move-down.js +2 -0
- package/dist/esm/ui/move-up.js +2 -0
- package/dist/types/editor-commands/transforms/container-transforms.d.ts +5 -4
- package/dist/types/editor-commands/transforms/layout-transforms.d.ts +3 -2
- package/dist/types/pm-plugins/experiences/block-menu-experiences.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/ui/block-menu.d.ts +3 -3
- package/dist/types/ui/copy-link.d.ts +2 -2
- package/dist/types/ui/delete-button.d.ts +2 -2
- package/dist/types/ui/move-down.d.ts +2 -2
- package/dist/types/ui/move-up.d.ts +2 -2
- package/dist/types-ts4.5/editor-commands/transforms/container-transforms.d.ts +5 -4
- package/dist/types-ts4.5/editor-commands/transforms/layout-transforms.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/experiences/block-menu-experiences.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/block-menu.d.ts +3 -3
- package/dist/types-ts4.5/ui/copy-link.d.ts +2 -2
- package/dist/types-ts4.5/ui/delete-button.d.ts +2 -2
- package/dist/types-ts4.5/ui/move-down.d.ts +2 -2
- package/dist/types-ts4.5/ui/move-up.d.ts +2 -2
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1b1c6f7936019`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1b1c6f7936019) -
|
|
8
|
+
Cleanup fg: platform_editor_block_menu_expand_localid_fix
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 7.0.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -8,7 +8,6 @@ exports.wrapMixedContentStep = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _marks = require("../marks");
|
|
13
12
|
var _types = require("../types");
|
|
14
13
|
var _utils2 = require("../utils");
|
|
@@ -38,12 +37,8 @@ var createTextContentContainer = function createTextContentContainer(textContent
|
|
|
38
37
|
* Creates a regular container with node content.
|
|
39
38
|
*/
|
|
40
39
|
var createNodeContentContainer = function createNodeContentContainer(nodeContent, targetNodeType) {
|
|
41
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
42
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
43
|
-
// object, preserving the expandedState WeakMap entry set in transformNode.ts.
|
|
44
|
-
// To clean up: remove the if-else, always use the flag-on branch.
|
|
45
40
|
var isExpandType = targetNodeType.name === 'expand' || targetNodeType.name === 'nestedExpand';
|
|
46
|
-
var nodeAttrs = isExpandType
|
|
41
|
+
var nodeAttrs = isExpandType ? {
|
|
47
42
|
localId: crypto.randomUUID()
|
|
48
43
|
} : {};
|
|
49
44
|
return targetNodeType.createAndFill(nodeAttrs, nodeContent);
|
|
@@ -81,11 +76,8 @@ var handleEmptyContainerEdgeCase = function handleEmptyContainerEdgeCase(result,
|
|
|
81
76
|
return emptyCodeBlock ? [emptyCodeBlock].concat((0, _toConsumableArray2.default)(result)) : result;
|
|
82
77
|
}
|
|
83
78
|
var emptyParagraph = schema.nodes.paragraph.create();
|
|
84
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
85
|
-
// Same localId pre-assignment rationale as createNodeContentContainer above.
|
|
86
|
-
// To clean up: remove the if-else, always use the flag-on branch.
|
|
87
79
|
var isExpandType = targetNodeTypeName === 'expand' || targetNodeTypeName === 'nestedExpand';
|
|
88
|
-
var emptyContainerAttrs = isExpandType
|
|
80
|
+
var emptyContainerAttrs = isExpandType ? {
|
|
89
81
|
localId: crypto.randomUUID()
|
|
90
82
|
} : {};
|
|
91
83
|
var emptyContainer = targetNodeType.create(emptyContainerAttrs, emptyParagraph);
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.isTextNode = exports.getTargetNodeTypeNameInContext = exports.getSelectedNode = exports.getBlockNodesInRange = exports.createTextContent = exports.convertTextNodeToParagraph = exports.convertNestedExpandToExpand = exports.convertExpandToNestedExpand = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
8
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
9
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
10
|
var _types = require("./types");
|
|
14
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
11
|
/**
|
|
17
12
|
* Determines if a node is a text node (heading or paragraph).
|
|
18
13
|
* Text nodes can have their content converted to paragraphs when they can't be wrapped directly.
|
|
@@ -84,17 +79,10 @@ var convertNestedExpandToExpand = exports.convertNestedExpandToExpand = function
|
|
|
84
79
|
if (!expandType) {
|
|
85
80
|
return null;
|
|
86
81
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
90
|
-
// object, preserving the expandedState WeakMap entry set in transformNode.ts.
|
|
91
|
-
// To clean up: remove the if-else, always include localId in attrs.
|
|
92
|
-
var localIdAttr = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_expand_localid_fix') ? {
|
|
82
|
+
return expandType.createAndFill({
|
|
83
|
+
title: ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.title) || '',
|
|
93
84
|
localId: crypto.randomUUID()
|
|
94
|
-
}
|
|
95
|
-
return expandType.createAndFill(_objectSpread({
|
|
96
|
-
title: ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.title) || ''
|
|
97
|
-
}, localIdAttr), node.content);
|
|
85
|
+
}, node.content);
|
|
98
86
|
};
|
|
99
87
|
|
|
100
88
|
/**
|
|
@@ -108,16 +96,10 @@ var convertExpandToNestedExpand = exports.convertExpandToNestedExpand = function
|
|
|
108
96
|
if (!nestedExpandType) {
|
|
109
97
|
return null;
|
|
110
98
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// Same localId pre-assignment rationale as convertNestedExpandToExpand above.
|
|
114
|
-
// To clean up: remove the if-else, always include localId in attrs.
|
|
115
|
-
var localIdAttr = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_expand_localid_fix') ? {
|
|
99
|
+
return nestedExpandType.createAndFill({
|
|
100
|
+
title: ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || '',
|
|
116
101
|
localId: crypto.randomUUID()
|
|
117
|
-
}
|
|
118
|
-
return nestedExpandType.createAndFill(_objectSpread({
|
|
119
|
-
title: ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || ''
|
|
120
|
-
}, localIdAttr), node.content);
|
|
102
|
+
}, node.content);
|
|
121
103
|
};
|
|
122
104
|
|
|
123
105
|
/**
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.wrapStep = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
8
|
var _marks = require("./marks");
|
|
10
9
|
var _utils2 = require("./utils");
|
|
11
10
|
/**
|
|
@@ -34,14 +33,8 @@ var wrapStep = exports.wrapStep = function wrapStep(nodes, context) {
|
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
35
|
var targetNodeType = schema.nodes[targetNodeTypeName];
|
|
37
|
-
|
|
38
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
39
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
40
|
-
// object (via setNodeAttribute), which would invalidate the expandedState WeakMap entry set
|
|
41
|
-
// in transformNode.ts and cause the expand to render as collapsed.
|
|
42
|
-
// To clean up: remove the if-else, always use the flag-on branch (isExpandType with uuid).
|
|
43
36
|
var isExpandType = targetNodeTypeName === 'expand' || targetNodeTypeName === 'nestedExpand';
|
|
44
|
-
var nodeAttrs = isExpandType
|
|
37
|
+
var nodeAttrs = isExpandType ? {
|
|
45
38
|
localId: crypto.randomUUID()
|
|
46
39
|
} : {};
|
|
47
40
|
var sourceSupportsBreakout = _utils.breakoutResizableNodes.includes(fromNode.type.name);
|
|
@@ -12,7 +12,6 @@ var _selection = require("@atlaskit/editor-common/selection");
|
|
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
13
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
14
14
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _isNestedNode = require("../ui/utils/isNestedNode");
|
|
17
16
|
var _transform2 = require("./transform-node-utils/transform");
|
|
18
17
|
var _utils = require("./transforms/utils");
|
|
@@ -55,23 +54,13 @@ var transformNode = exports.transformNode = function transformNode(api) {
|
|
|
55
54
|
});
|
|
56
55
|
var content = resultNodes.length > 0 ? resultNodes : sourceNodes;
|
|
57
56
|
var sliceStart = isList ? $from.pos - 1 : $from.pos;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// To clean up: remove the if-else block and keep only the flag-on body.
|
|
66
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_block_menu_expand_localid_fix')) {
|
|
67
|
-
var expand = nodes.expand,
|
|
68
|
-
nestedExpand = nodes.nestedExpand;
|
|
69
|
-
content.forEach(function (node) {
|
|
70
|
-
if (node.type === expand || node.type === nestedExpand) {
|
|
71
|
-
_expand.expandedState.set(node, true);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
57
|
+
var expand = nodes.expand,
|
|
58
|
+
nestedExpand = nodes.nestedExpand;
|
|
59
|
+
content.forEach(function (node) {
|
|
60
|
+
if (node.type === expand || node.type === nestedExpand) {
|
|
61
|
+
_expand.expandedState.set(node, true);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
75
64
|
if (preservedSelection instanceof _state.NodeSelection && preservedSelection.node.type === nodes.mediaSingle) {
|
|
76
65
|
var _api$blockControls2;
|
|
77
66
|
// when node is media single, use tr.replaceWith freeze editor, if modify position, tr.replaceWith creates duplicats
|
|
@@ -154,7 +154,13 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
154
154
|
}
|
|
155
155
|
setMenuHeight(((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.clientHeight) || FALLBACK_MENU_HEIGHT);
|
|
156
156
|
}, [isMenuOpen]);
|
|
157
|
-
var hasFocus = (_ref4 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) ||
|
|
157
|
+
var hasFocus = (_ref4 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) ||
|
|
158
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
159
|
+
document.activeElement === targetHandleRef || popupRef.current && (
|
|
160
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
161
|
+
popupRef.current.contains(document.activeElement) ||
|
|
162
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
163
|
+
popupRef.current === document.activeElement)) !== null && _ref4 !== void 0 ? _ref4 : false;
|
|
158
164
|
var selectedByShortcutOrDragHandle = !!isSelectedViaDragHandle || !!openedViaKeyboard;
|
|
159
165
|
|
|
160
166
|
// Use conditional hook based on feature flag
|
|
@@ -261,4 +267,7 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
261
267
|
setRef: setRef
|
|
262
268
|
})));
|
|
263
269
|
};
|
|
264
|
-
|
|
270
|
+
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
272
|
+
var _default_1 = (0, _reactIntlNext.injectIntl)(BlockMenu);
|
|
273
|
+
var _default = exports.default = _default_1;
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -112,4 +112,6 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
112
112
|
testId: _blockMenu.BLOCK_MENU_ACTION_TEST_ID.COPY_LINK
|
|
113
113
|
}, formatMessage(message));
|
|
114
114
|
};
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
115
117
|
var CopyLinkDropdownItem = exports.CopyLinkDropdownItem = (0, _reactIntlNext.injectIntl)(CopyLinkDropdownItemContent);
|
|
@@ -120,4 +120,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
120
120
|
color: "color.text.danger"
|
|
121
121
|
}, formatMessage(_messages.blockMenuMessages.deleteBlock))));
|
|
122
122
|
};
|
|
123
|
+
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
123
125
|
var DeleteDropdownItem = exports.DeleteDropdownItem = (0, _reactIntlNext.injectIntl)(DeleteDropdownItemContent);
|
package/dist/cjs/ui/move-down.js
CHANGED
|
@@ -84,4 +84,6 @@ var MoveDownDropdownItemContent = function MoveDownDropdownItemContent(_ref) {
|
|
|
84
84
|
testId: _blockMenu.BLOCK_MENU_ACTION_TEST_ID.MOVE_DOWN
|
|
85
85
|
}, formatMessage(_messages.blockMenuMessages.moveDownBlock));
|
|
86
86
|
};
|
|
87
|
+
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
87
89
|
var MoveDownDropdownItem = exports.MoveDownDropdownItem = (0, _reactIntlNext.injectIntl)(MoveDownDropdownItemContent);
|
package/dist/cjs/ui/move-up.js
CHANGED
|
@@ -82,4 +82,6 @@ var MoveUpDropdownItemContent = function MoveUpDropdownItemContent(_ref) {
|
|
|
82
82
|
testId: _blockMenu.BLOCK_MENU_ACTION_TEST_ID.MOVE_UP
|
|
83
83
|
}, formatMessage(_messages.blockMenuMessages.moveUpBlock));
|
|
84
84
|
};
|
|
85
|
+
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
85
87
|
var MoveUpDropdownItem = exports.MoveUpDropdownItem = (0, _reactIntlNext.injectIntl)(MoveUpDropdownItemContent);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { breakoutResizableNodes } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { removeDisallowedMarks } from '../marks';
|
|
5
4
|
import { NODE_CATEGORY_BY_TYPE } from '../types';
|
|
6
5
|
import { convertTextNodeToParagraph, createTextContent, isTextNode } from '../utils';
|
|
@@ -31,12 +30,8 @@ const createTextContentContainer = (textContentArray, targetNodeType, schema) =>
|
|
|
31
30
|
* Creates a regular container with node content.
|
|
32
31
|
*/
|
|
33
32
|
const createNodeContentContainer = (nodeContent, targetNodeType) => {
|
|
34
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
35
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
36
|
-
// object, preserving the expandedState WeakMap entry set in transformNode.ts.
|
|
37
|
-
// To clean up: remove the if-else, always use the flag-on branch.
|
|
38
33
|
const isExpandType = targetNodeType.name === 'expand' || targetNodeType.name === 'nestedExpand';
|
|
39
|
-
const nodeAttrs = isExpandType
|
|
34
|
+
const nodeAttrs = isExpandType ? {
|
|
40
35
|
localId: crypto.randomUUID()
|
|
41
36
|
} : {};
|
|
42
37
|
return targetNodeType.createAndFill(nodeAttrs, nodeContent);
|
|
@@ -74,11 +69,8 @@ const handleEmptyContainerEdgeCase = (result, hasCreatedContainer, fromNode, tar
|
|
|
74
69
|
return emptyCodeBlock ? [emptyCodeBlock, ...result] : result;
|
|
75
70
|
}
|
|
76
71
|
const emptyParagraph = schema.nodes.paragraph.create();
|
|
77
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
78
|
-
// Same localId pre-assignment rationale as createNodeContentContainer above.
|
|
79
|
-
// To clean up: remove the if-else, always use the flag-on branch.
|
|
80
72
|
const isExpandType = targetNodeTypeName === 'expand' || targetNodeTypeName === 'nestedExpand';
|
|
81
|
-
const emptyContainerAttrs = isExpandType
|
|
73
|
+
const emptyContainerAttrs = isExpandType ? {
|
|
82
74
|
localId: crypto.randomUUID()
|
|
83
75
|
} : {};
|
|
84
76
|
const emptyContainer = targetNodeType.create(emptyContainerAttrs, emptyParagraph);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { NODE_CATEGORY_BY_TYPE } from './types';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -76,17 +75,9 @@ export const convertNestedExpandToExpand = (node, schema) => {
|
|
|
76
75
|
if (!expandType) {
|
|
77
76
|
return null;
|
|
78
77
|
}
|
|
79
|
-
|
|
80
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
81
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
82
|
-
// object, preserving the expandedState WeakMap entry set in transformNode.ts.
|
|
83
|
-
// To clean up: remove the if-else, always include localId in attrs.
|
|
84
|
-
const localIdAttr = fg('platform_editor_block_menu_expand_localid_fix') ? {
|
|
85
|
-
localId: crypto.randomUUID()
|
|
86
|
-
} : {};
|
|
87
78
|
return expandType.createAndFill({
|
|
88
79
|
title: ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.title) || '',
|
|
89
|
-
|
|
80
|
+
localId: crypto.randomUUID()
|
|
90
81
|
}, node.content);
|
|
91
82
|
};
|
|
92
83
|
|
|
@@ -101,16 +92,9 @@ export const convertExpandToNestedExpand = (node, schema) => {
|
|
|
101
92
|
if (!nestedExpandType) {
|
|
102
93
|
return null;
|
|
103
94
|
}
|
|
104
|
-
|
|
105
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
106
|
-
// Same localId pre-assignment rationale as convertNestedExpandToExpand above.
|
|
107
|
-
// To clean up: remove the if-else, always include localId in attrs.
|
|
108
|
-
const localIdAttr = fg('platform_editor_block_menu_expand_localid_fix') ? {
|
|
109
|
-
localId: crypto.randomUUID()
|
|
110
|
-
} : {};
|
|
111
95
|
return nestedExpandType.createAndFill({
|
|
112
96
|
title: ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || '',
|
|
113
|
-
|
|
97
|
+
localId: crypto.randomUUID()
|
|
114
98
|
}, node.content);
|
|
115
99
|
};
|
|
116
100
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { breakoutResizableNodes } from '@atlaskit/editor-common/utils';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { removeDisallowedMarks } from './marks';
|
|
4
3
|
import { convertExpandToNestedExpand } from './utils';
|
|
5
4
|
|
|
@@ -31,14 +30,8 @@ export const wrapStep = (nodes, context) => {
|
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
const targetNodeType = schema.nodes[targetNodeTypeName];
|
|
34
|
-
|
|
35
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
36
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
37
|
-
// object (via setNodeAttribute), which would invalidate the expandedState WeakMap entry set
|
|
38
|
-
// in transformNode.ts and cause the expand to render as collapsed.
|
|
39
|
-
// To clean up: remove the if-else, always use the flag-on branch (isExpandType with uuid).
|
|
40
33
|
const isExpandType = targetNodeTypeName === 'expand' || targetNodeTypeName === 'nestedExpand';
|
|
41
|
-
const nodeAttrs = isExpandType
|
|
34
|
+
const nodeAttrs = isExpandType ? {
|
|
42
35
|
localId: crypto.randomUUID()
|
|
43
36
|
} : {};
|
|
44
37
|
const sourceSupportsBreakout = breakoutResizableNodes.includes(fromNode.type.name);
|
|
@@ -6,7 +6,6 @@ import { expandSelectionToBlockRange, getSourceNodesFromSelectionRange } from '@
|
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { isNestedNode } from '../ui/utils/isNestedNode';
|
|
11
10
|
import { convertNodesToTargetType } from './transform-node-utils/transform';
|
|
12
11
|
import { isListNode } from './transforms/utils';
|
|
@@ -51,25 +50,15 @@ export const transformNode = api => (targetType, metadata) => ({
|
|
|
51
50
|
});
|
|
52
51
|
const content = resultNodes.length > 0 ? resultNodes : sourceNodes;
|
|
53
52
|
const sliceStart = isList ? $from.pos - 1 : $from.pos;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
expand,
|
|
65
|
-
nestedExpand
|
|
66
|
-
} = nodes;
|
|
67
|
-
content.forEach(node => {
|
|
68
|
-
if (node.type === expand || node.type === nestedExpand) {
|
|
69
|
-
expandedState.set(node, true);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
53
|
+
const {
|
|
54
|
+
expand,
|
|
55
|
+
nestedExpand
|
|
56
|
+
} = nodes;
|
|
57
|
+
content.forEach(node => {
|
|
58
|
+
if (node.type === expand || node.type === nestedExpand) {
|
|
59
|
+
expandedState.set(node, true);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
73
62
|
if (preservedSelection instanceof NodeSelection && preservedSelection.node.type === nodes.mediaSingle) {
|
|
74
63
|
var _api$blockControls2;
|
|
75
64
|
// when node is media single, use tr.replaceWith freeze editor, if modify position, tr.replaceWith creates duplicats
|
|
@@ -145,7 +145,13 @@ const BlockMenu = ({
|
|
|
145
145
|
}
|
|
146
146
|
setMenuHeight(((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.clientHeight) || FALLBACK_MENU_HEIGHT);
|
|
147
147
|
}, [isMenuOpen]);
|
|
148
|
-
const hasFocus = (_ref = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) ||
|
|
148
|
+
const hasFocus = (_ref = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) ||
|
|
149
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
150
|
+
document.activeElement === targetHandleRef || popupRef.current && (
|
|
151
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
152
|
+
popupRef.current.contains(document.activeElement) ||
|
|
153
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
154
|
+
popupRef.current === document.activeElement)) !== null && _ref !== void 0 ? _ref : false;
|
|
149
155
|
const selectedByShortcutOrDragHandle = !!isSelectedViaDragHandle || !!openedViaKeyboard;
|
|
150
156
|
|
|
151
157
|
// Use conditional hook based on feature flag
|
|
@@ -253,4 +259,7 @@ const BlockMenu = ({
|
|
|
253
259
|
setRef: setRef
|
|
254
260
|
})));
|
|
255
261
|
};
|
|
256
|
-
|
|
262
|
+
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
264
|
+
const _default_1 = injectIntl(BlockMenu);
|
|
265
|
+
export default _default_1;
|
|
@@ -111,4 +111,6 @@ const CopyLinkDropdownItemContent = ({
|
|
|
111
111
|
testId: BLOCK_MENU_ACTION_TEST_ID.COPY_LINK
|
|
112
112
|
}, formatMessage(message));
|
|
113
113
|
};
|
|
114
|
+
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
114
116
|
export const CopyLinkDropdownItem = injectIntl(CopyLinkDropdownItemContent);
|
|
@@ -116,4 +116,6 @@ const DeleteDropdownItemContent = ({
|
|
|
116
116
|
color: "color.text.danger"
|
|
117
117
|
}, formatMessage(blockMenuMessages.deleteBlock))));
|
|
118
118
|
};
|
|
119
|
+
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
119
121
|
export const DeleteDropdownItem = injectIntl(DeleteDropdownItemContent);
|
|
@@ -81,4 +81,6 @@ const MoveDownDropdownItemContent = ({
|
|
|
81
81
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_DOWN
|
|
82
82
|
}, formatMessage(messages.moveDownBlock));
|
|
83
83
|
};
|
|
84
|
+
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
84
86
|
export const MoveDownDropdownItem = injectIntl(MoveDownDropdownItemContent);
|
|
@@ -79,4 +79,6 @@ const MoveUpDropdownItemContent = ({
|
|
|
79
79
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_UP
|
|
80
80
|
}, formatMessage(messages.moveUpBlock));
|
|
81
81
|
};
|
|
82
|
+
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
82
84
|
export const MoveUpDropdownItem = injectIntl(MoveUpDropdownItemContent);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { breakoutResizableNodes } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { removeDisallowedMarks } from '../marks';
|
|
6
5
|
import { NODE_CATEGORY_BY_TYPE } from '../types';
|
|
7
6
|
import { convertTextNodeToParagraph, createTextContent, isTextNode } from '../utils';
|
|
@@ -32,12 +31,8 @@ var createTextContentContainer = function createTextContentContainer(textContent
|
|
|
32
31
|
* Creates a regular container with node content.
|
|
33
32
|
*/
|
|
34
33
|
var createNodeContentContainer = function createNodeContentContainer(nodeContent, targetNodeType) {
|
|
35
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
36
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
37
|
-
// object, preserving the expandedState WeakMap entry set in transformNode.ts.
|
|
38
|
-
// To clean up: remove the if-else, always use the flag-on branch.
|
|
39
34
|
var isExpandType = targetNodeType.name === 'expand' || targetNodeType.name === 'nestedExpand';
|
|
40
|
-
var nodeAttrs = isExpandType
|
|
35
|
+
var nodeAttrs = isExpandType ? {
|
|
41
36
|
localId: crypto.randomUUID()
|
|
42
37
|
} : {};
|
|
43
38
|
return targetNodeType.createAndFill(nodeAttrs, nodeContent);
|
|
@@ -75,11 +70,8 @@ var handleEmptyContainerEdgeCase = function handleEmptyContainerEdgeCase(result,
|
|
|
75
70
|
return emptyCodeBlock ? [emptyCodeBlock].concat(_toConsumableArray(result)) : result;
|
|
76
71
|
}
|
|
77
72
|
var emptyParagraph = schema.nodes.paragraph.create();
|
|
78
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
79
|
-
// Same localId pre-assignment rationale as createNodeContentContainer above.
|
|
80
|
-
// To clean up: remove the if-else, always use the flag-on branch.
|
|
81
73
|
var isExpandType = targetNodeTypeName === 'expand' || targetNodeTypeName === 'nestedExpand';
|
|
82
|
-
var emptyContainerAttrs = isExpandType
|
|
74
|
+
var emptyContainerAttrs = isExpandType ? {
|
|
83
75
|
localId: crypto.randomUUID()
|
|
84
76
|
} : {};
|
|
85
77
|
var emptyContainer = targetNodeType.create(emptyContainerAttrs, emptyParagraph);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
2
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
3
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
4
|
import { NODE_CATEGORY_BY_TYPE } from './types';
|
|
9
5
|
|
|
10
6
|
/**
|
|
@@ -78,17 +74,10 @@ export var convertNestedExpandToExpand = function convertNestedExpandToExpand(no
|
|
|
78
74
|
if (!expandType) {
|
|
79
75
|
return null;
|
|
80
76
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
84
|
-
// object, preserving the expandedState WeakMap entry set in transformNode.ts.
|
|
85
|
-
// To clean up: remove the if-else, always include localId in attrs.
|
|
86
|
-
var localIdAttr = fg('platform_editor_block_menu_expand_localid_fix') ? {
|
|
77
|
+
return expandType.createAndFill({
|
|
78
|
+
title: ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.title) || '',
|
|
87
79
|
localId: crypto.randomUUID()
|
|
88
|
-
}
|
|
89
|
-
return expandType.createAndFill(_objectSpread({
|
|
90
|
-
title: ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.title) || ''
|
|
91
|
-
}, localIdAttr), node.content);
|
|
80
|
+
}, node.content);
|
|
92
81
|
};
|
|
93
82
|
|
|
94
83
|
/**
|
|
@@ -102,16 +91,10 @@ export var convertExpandToNestedExpand = function convertExpandToNestedExpand(no
|
|
|
102
91
|
if (!nestedExpandType) {
|
|
103
92
|
return null;
|
|
104
93
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// Same localId pre-assignment rationale as convertNestedExpandToExpand above.
|
|
108
|
-
// To clean up: remove the if-else, always include localId in attrs.
|
|
109
|
-
var localIdAttr = fg('platform_editor_block_menu_expand_localid_fix') ? {
|
|
94
|
+
return nestedExpandType.createAndFill({
|
|
95
|
+
title: ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || '',
|
|
110
96
|
localId: crypto.randomUUID()
|
|
111
|
-
}
|
|
112
|
-
return nestedExpandType.createAndFill(_objectSpread({
|
|
113
|
-
title: ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || ''
|
|
114
|
-
}, localIdAttr), node.content);
|
|
97
|
+
}, node.content);
|
|
115
98
|
};
|
|
116
99
|
|
|
117
100
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { breakoutResizableNodes } from '@atlaskit/editor-common/utils';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { removeDisallowedMarks } from './marks';
|
|
4
3
|
import { convertExpandToNestedExpand } from './utils';
|
|
5
4
|
|
|
@@ -29,14 +28,8 @@ export var wrapStep = function wrapStep(nodes, context) {
|
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
var targetNodeType = schema.nodes[targetNodeTypeName];
|
|
32
|
-
|
|
33
|
-
// [FEATURE FLAG: platform_editor_block_menu_expand_localid_fix]
|
|
34
|
-
// Pre-assigns a localId so the localId plugin's appendTransaction does not replace the node
|
|
35
|
-
// object (via setNodeAttribute), which would invalidate the expandedState WeakMap entry set
|
|
36
|
-
// in transformNode.ts and cause the expand to render as collapsed.
|
|
37
|
-
// To clean up: remove the if-else, always use the flag-on branch (isExpandType with uuid).
|
|
38
31
|
var isExpandType = targetNodeTypeName === 'expand' || targetNodeTypeName === 'nestedExpand';
|
|
39
|
-
var nodeAttrs = isExpandType
|
|
32
|
+
var nodeAttrs = isExpandType ? {
|
|
40
33
|
localId: crypto.randomUUID()
|
|
41
34
|
} : {};
|
|
42
35
|
var sourceSupportsBreakout = breakoutResizableNodes.includes(fromNode.type.name);
|
|
@@ -6,7 +6,6 @@ import { expandSelectionToBlockRange, getSourceNodesFromSelectionRange } from '@
|
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { isNestedNode } from '../ui/utils/isNestedNode';
|
|
11
10
|
import { convertNodesToTargetType } from './transform-node-utils/transform';
|
|
12
11
|
import { isListNode } from './transforms/utils';
|
|
@@ -49,23 +48,13 @@ export var transformNode = function transformNode(api) {
|
|
|
49
48
|
});
|
|
50
49
|
var content = resultNodes.length > 0 ? resultNodes : sourceNodes;
|
|
51
50
|
var sliceStart = isList ? $from.pos - 1 : $from.pos;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// To clean up: remove the if-else block and keep only the flag-on body.
|
|
60
|
-
if (fg('platform_editor_block_menu_expand_localid_fix')) {
|
|
61
|
-
var expand = nodes.expand,
|
|
62
|
-
nestedExpand = nodes.nestedExpand;
|
|
63
|
-
content.forEach(function (node) {
|
|
64
|
-
if (node.type === expand || node.type === nestedExpand) {
|
|
65
|
-
expandedState.set(node, true);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
51
|
+
var expand = nodes.expand,
|
|
52
|
+
nestedExpand = nodes.nestedExpand;
|
|
53
|
+
content.forEach(function (node) {
|
|
54
|
+
if (node.type === expand || node.type === nestedExpand) {
|
|
55
|
+
expandedState.set(node, true);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
69
58
|
if (preservedSelection instanceof NodeSelection && preservedSelection.node.type === nodes.mediaSingle) {
|
|
70
59
|
var _api$blockControls2;
|
|
71
60
|
// when node is media single, use tr.replaceWith freeze editor, if modify position, tr.replaceWith creates duplicats
|
|
@@ -145,7 +145,13 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
145
145
|
}
|
|
146
146
|
setMenuHeight(((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.clientHeight) || FALLBACK_MENU_HEIGHT);
|
|
147
147
|
}, [isMenuOpen]);
|
|
148
|
-
var hasFocus = (_ref4 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) ||
|
|
148
|
+
var hasFocus = (_ref4 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) ||
|
|
149
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
150
|
+
document.activeElement === targetHandleRef || popupRef.current && (
|
|
151
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
152
|
+
popupRef.current.contains(document.activeElement) ||
|
|
153
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
154
|
+
popupRef.current === document.activeElement)) !== null && _ref4 !== void 0 ? _ref4 : false;
|
|
149
155
|
var selectedByShortcutOrDragHandle = !!isSelectedViaDragHandle || !!openedViaKeyboard;
|
|
150
156
|
|
|
151
157
|
// Use conditional hook based on feature flag
|
|
@@ -252,4 +258,7 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
252
258
|
setRef: setRef
|
|
253
259
|
})));
|
|
254
260
|
};
|
|
255
|
-
|
|
261
|
+
|
|
262
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
263
|
+
var _default_1 = injectIntl(BlockMenu);
|
|
264
|
+
export default _default_1;
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -103,4 +103,6 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
103
103
|
testId: BLOCK_MENU_ACTION_TEST_ID.COPY_LINK
|
|
104
104
|
}, formatMessage(message));
|
|
105
105
|
};
|
|
106
|
+
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
106
108
|
export var CopyLinkDropdownItem = injectIntl(CopyLinkDropdownItemContent);
|
|
@@ -111,4 +111,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
111
111
|
color: "color.text.danger"
|
|
112
112
|
}, formatMessage(blockMenuMessages.deleteBlock))));
|
|
113
113
|
};
|
|
114
|
+
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
114
116
|
export var DeleteDropdownItem = injectIntl(DeleteDropdownItemContent);
|
package/dist/esm/ui/move-down.js
CHANGED
|
@@ -75,4 +75,6 @@ var MoveDownDropdownItemContent = function MoveDownDropdownItemContent(_ref) {
|
|
|
75
75
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_DOWN
|
|
76
76
|
}, formatMessage(messages.moveDownBlock));
|
|
77
77
|
};
|
|
78
|
+
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
78
80
|
export var MoveDownDropdownItem = injectIntl(MoveDownDropdownItemContent);
|
package/dist/esm/ui/move-up.js
CHANGED
|
@@ -73,4 +73,6 @@ var MoveUpDropdownItemContent = function MoveUpDropdownItemContent(_ref) {
|
|
|
73
73
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_UP
|
|
74
74
|
}, formatMessage(messages.moveUpBlock));
|
|
75
75
|
};
|
|
76
|
+
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
76
78
|
export var MoveUpDropdownItem = injectIntl(MoveUpDropdownItemContent);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { TransformFunction } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Transform selection to container type
|
|
5
6
|
*/
|
|
6
|
-
export declare const transformToContainer: ({ tr, sourceNode, targetNodeType, targetAttrs, }: TransformContext) =>
|
|
7
|
+
export declare const transformToContainer: ({ tr, sourceNode, targetNodeType, targetAttrs, }: TransformContext) => Transaction | null;
|
|
7
8
|
/**
|
|
8
9
|
* Transform container nodes (panel, expand, blockquote)
|
|
9
10
|
*/
|
|
@@ -11,9 +12,9 @@ export declare const transformContainerNode: TransformFunction;
|
|
|
11
12
|
/**
|
|
12
13
|
* Unwrap container node and convert content to block type
|
|
13
14
|
*/
|
|
14
|
-
export declare const unwrapAndConvertToBlockType: (context: TransformContext) =>
|
|
15
|
+
export declare const unwrapAndConvertToBlockType: (context: TransformContext) => Transaction;
|
|
15
16
|
/**
|
|
16
17
|
* Unwrap container node and convert content to list
|
|
17
18
|
*/
|
|
18
|
-
export declare const unwrapAndConvertToList: ({ tr, sourceNode, sourcePos, targetNodeType, targetAttrs, }: TransformContext) =>
|
|
19
|
-
export declare const transformBetweenContainerTypes: (context: TransformContext) =>
|
|
19
|
+
export declare const unwrapAndConvertToList: ({ tr, sourceNode, sourcePos, targetNodeType, targetAttrs, }: TransformContext) => Transaction | null;
|
|
20
|
+
export declare const transformBetweenContainerTypes: (context: TransformContext) => Transaction;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
2
2
|
import type { Mark, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
export declare const createDefaultLayoutSection: (schema: Schema, content: PMNode, marks?: readonly Mark[]) => PMNode;
|
|
5
|
-
export declare const convertToLayout: (context: TransformContext) =>
|
|
6
|
-
export declare const transformLayoutNode: (context: TransformContext) =>
|
|
6
|
+
export declare const convertToLayout: (context: TransformContext) => Transaction;
|
|
7
|
+
export declare const transformLayoutNode: (context: TransformContext) => Transaction;
|
|
@@ -6,5 +6,5 @@ type ExperienceOptions = {
|
|
|
6
6
|
popupsMountPoint?: HTMLElement;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export declare const getBlockMenuExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin
|
|
9
|
+
export declare const getBlockMenuExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin;
|
|
10
10
|
export {};
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { BlockMenuPlugin, FLAG_ID } from '../blockMenuPluginType';
|
|
5
|
-
export declare const blockMenuPluginKey: PluginKey
|
|
5
|
+
export declare const blockMenuPluginKey: PluginKey;
|
|
6
6
|
type BlockMenuPluginState = {
|
|
7
7
|
showFlag: FLAG_ID | false;
|
|
8
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
@@ -10,7 +10,7 @@ export type BlockMenuProps = {
|
|
|
10
10
|
mountTo?: HTMLElement;
|
|
11
11
|
scrollableElement?: HTMLElement;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
13
|
+
declare const _default_1: React.FC<WithIntlProps<BlockMenuProps & WrappedComponentProps>> & {
|
|
14
14
|
WrappedComponent: React.ComponentType<BlockMenuProps & WrappedComponentProps>;
|
|
15
15
|
};
|
|
16
|
-
export default
|
|
16
|
+
export default _default_1;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin, BlockMenuPluginOptions } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
config: BlockMenuPluginOptions | undefined;
|
|
8
8
|
};
|
|
9
|
-
export declare const CopyLinkDropdownItem: React.FC<
|
|
9
|
+
export declare const CopyLinkDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
10
10
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
} & WrappedComponentProps;
|
|
8
|
-
export declare const DeleteDropdownItem: React.FC<
|
|
8
|
+
export declare const DeleteDropdownItem: React.FC<WithIntlProps<Props>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare const MoveDownDropdownItem: React.FC<
|
|
8
|
+
export declare const MoveDownDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare const MoveUpDropdownItem: React.FC<
|
|
8
|
+
export declare const MoveUpDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { TransformFunction } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Transform selection to container type
|
|
5
6
|
*/
|
|
6
|
-
export declare const transformToContainer: ({ tr, sourceNode, targetNodeType, targetAttrs, }: TransformContext) =>
|
|
7
|
+
export declare const transformToContainer: ({ tr, sourceNode, targetNodeType, targetAttrs, }: TransformContext) => Transaction | null;
|
|
7
8
|
/**
|
|
8
9
|
* Transform container nodes (panel, expand, blockquote)
|
|
9
10
|
*/
|
|
@@ -11,9 +12,9 @@ export declare const transformContainerNode: TransformFunction;
|
|
|
11
12
|
/**
|
|
12
13
|
* Unwrap container node and convert content to block type
|
|
13
14
|
*/
|
|
14
|
-
export declare const unwrapAndConvertToBlockType: (context: TransformContext) =>
|
|
15
|
+
export declare const unwrapAndConvertToBlockType: (context: TransformContext) => Transaction;
|
|
15
16
|
/**
|
|
16
17
|
* Unwrap container node and convert content to list
|
|
17
18
|
*/
|
|
18
|
-
export declare const unwrapAndConvertToList: ({ tr, sourceNode, sourcePos, targetNodeType, targetAttrs, }: TransformContext) =>
|
|
19
|
-
export declare const transformBetweenContainerTypes: (context: TransformContext) =>
|
|
19
|
+
export declare const unwrapAndConvertToList: ({ tr, sourceNode, sourcePos, targetNodeType, targetAttrs, }: TransformContext) => Transaction | null;
|
|
20
|
+
export declare const transformBetweenContainerTypes: (context: TransformContext) => Transaction;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
2
2
|
import type { Mark, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
export declare const createDefaultLayoutSection: (schema: Schema, content: PMNode, marks?: readonly Mark[]) => PMNode;
|
|
5
|
-
export declare const convertToLayout: (context: TransformContext) =>
|
|
6
|
-
export declare const transformLayoutNode: (context: TransformContext) =>
|
|
6
|
+
export declare const convertToLayout: (context: TransformContext) => Transaction;
|
|
7
|
+
export declare const transformLayoutNode: (context: TransformContext) => Transaction;
|
|
@@ -6,5 +6,5 @@ type ExperienceOptions = {
|
|
|
6
6
|
popupsMountPoint?: HTMLElement;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export declare const getBlockMenuExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin
|
|
9
|
+
export declare const getBlockMenuExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin;
|
|
10
10
|
export {};
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { BlockMenuPlugin, FLAG_ID } from '../blockMenuPluginType';
|
|
5
|
-
export declare const blockMenuPluginKey: PluginKey
|
|
5
|
+
export declare const blockMenuPluginKey: PluginKey;
|
|
6
6
|
type BlockMenuPluginState = {
|
|
7
7
|
showFlag: FLAG_ID | false;
|
|
8
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
@@ -10,7 +10,7 @@ export type BlockMenuProps = {
|
|
|
10
10
|
mountTo?: HTMLElement;
|
|
11
11
|
scrollableElement?: HTMLElement;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
13
|
+
declare const _default_1: React.FC<WithIntlProps<BlockMenuProps & WrappedComponentProps>> & {
|
|
14
14
|
WrappedComponent: React.ComponentType<BlockMenuProps & WrappedComponentProps>;
|
|
15
15
|
};
|
|
16
|
-
export default
|
|
16
|
+
export default _default_1;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin, BlockMenuPluginOptions } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
config: BlockMenuPluginOptions | undefined;
|
|
8
8
|
};
|
|
9
|
-
export declare const CopyLinkDropdownItem: React.FC<
|
|
9
|
+
export declare const CopyLinkDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
10
10
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
} & WrappedComponentProps;
|
|
8
|
-
export declare const DeleteDropdownItem: React.FC<
|
|
8
|
+
export declare const DeleteDropdownItem: React.FC<WithIntlProps<Props>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare const MoveDownDropdownItem: React.FC<
|
|
8
|
+
export declare const MoveDownDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
2
|
+
import type { WithIntlProps, WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare const MoveUpDropdownItem: React.FC<
|
|
8
|
+
export declare const MoveUpDropdownItem: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/primitives": "^18.0.0",
|
|
46
46
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^36.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^11.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"bind-event-listener": "^3.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^112.
|
|
53
|
+
"@atlaskit/editor-common": "^112.1.0",
|
|
54
54
|
"react": "^18.2.0",
|
|
55
55
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
56
56
|
},
|
|
@@ -97,9 +97,6 @@
|
|
|
97
97
|
"platform_editor_block_menu_copy_section": {
|
|
98
98
|
"type": "boolean"
|
|
99
99
|
},
|
|
100
|
-
"platform_editor_block_menu_expand_localid_fix": {
|
|
101
|
-
"type": "boolean"
|
|
102
|
-
},
|
|
103
100
|
"platform_editor_block_menu_v2_patch_2": {
|
|
104
101
|
"type": "boolean"
|
|
105
102
|
},
|