@atlaskit/editor-plugin-block-menu 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/afm-cc/tsconfig.json +8 -2
- package/afm-dev-agents/tsconfig.json +6 -0
- package/afm-jira/tsconfig.json +6 -0
- package/afm-passionfruit/tsconfig.json +6 -0
- package/afm-post-office/tsconfig.json +6 -0
- package/afm-rovo-extension/tsconfig.json +6 -0
- package/afm-townsquare/tsconfig.json +6 -0
- package/dist/cjs/ui/block-menu-components.js +5 -11
- package/dist/cjs/ui/copy-block.js +7 -0
- package/dist/cjs/ui/copy-link.js +11 -0
- package/dist/cjs/ui/delete-button.js +83 -0
- package/dist/es2019/ui/block-menu-components.js +5 -13
- package/dist/es2019/ui/copy-block.js +7 -0
- package/dist/es2019/ui/copy-link.js +12 -0
- package/dist/es2019/ui/delete-button.js +78 -0
- package/dist/esm/ui/block-menu-components.js +5 -11
- package/dist/esm/ui/copy-block.js +7 -0
- package/dist/esm/ui/copy-link.js +11 -0
- package/dist/esm/ui/delete-button.js +74 -0
- package/dist/types/blockMenuPluginType.d.ts +3 -1
- package/dist/types/ui/delete-button.d.ts +11 -0
- package/dist/types/ui/move-down.d.ts +1 -1
- package/dist/types/ui/move-up.d.ts +1 -1
- package/dist/types-ts4.5/blockMenuPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/delete-button.d.ts +11 -0
- package/dist/types-ts4.5/ui/move-down.d.ts +1 -1
- package/dist/types-ts4.5/ui/move-up.d.ts +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 0.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2d45ff8531e21`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2d45ff8531e21) -
|
|
8
|
+
Update move up and down registration and move blockMenuPlugin up in the fullPagePreset.
|
|
9
|
+
|
|
10
|
+
## 0.0.11
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`f0b0ea63f59bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f0b0ea63f59bc) -
|
|
15
|
+
[ux] ED-28803 Register Delete Button in block menu and add delete functionality and hover styles
|
|
16
|
+
- [`580ef908f3abf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/580ef908f3abf) -
|
|
17
|
+
ED-28592: Close menu after copy click
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 0.0.10
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"extends": "../../../../tsconfig.entry-points.confluence.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
|
-
"composite": true,
|
|
6
5
|
"outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-block-menu",
|
|
7
|
-
"rootDir": "../"
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
8
|
},
|
|
9
9
|
"include": [
|
|
10
10
|
"../src/**/*.ts",
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-cc/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-cc/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-cc/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-cc/tsconfig.json"
|
|
31
37
|
},
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-dev-agents/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-dev-agents/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-dev-agents/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-dev-agents/tsconfig.json"
|
|
31
37
|
},
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-jira/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-jira/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-jira/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-jira/tsconfig.json"
|
|
31
37
|
},
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-passionfruit/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-passionfruit/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-passionfruit/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-passionfruit/tsconfig.json"
|
|
31
37
|
},
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-post-office/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-post-office/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-post-office/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-post-office/tsconfig.json"
|
|
31
37
|
},
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-rovo-extension/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-rovo-extension/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-rovo-extension/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-rovo-extension/tsconfig.json"
|
|
31
37
|
},
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
{
|
|
27
27
|
"path": "../../editor-plugin-block-controls/afm-townsquare/tsconfig.json"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-decorations/afm-townsquare/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-selection/afm-townsquare/tsconfig.json"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../../editor-plugin-user-intent/afm-townsquare/tsconfig.json"
|
|
31
37
|
},
|
|
@@ -10,18 +10,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
11
|
var _changes = _interopRequireDefault(require("@atlaskit/icon/core/changes"));
|
|
12
12
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
|
|
13
|
-
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
14
13
|
var _listBulleted = _interopRequireDefault(require("@atlaskit/icon/core/list-bulleted"));
|
|
15
14
|
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
16
15
|
var _copyBlock = _interopRequireDefault(require("./copy-block"));
|
|
17
16
|
var _copyLink = require("./copy-link");
|
|
17
|
+
var _deleteButton = require("./delete-button");
|
|
18
18
|
var _moveDown = require("./move-down");
|
|
19
19
|
var _moveUp = require("./move-up");
|
|
20
20
|
var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(api) {
|
|
21
|
-
var _api$blockControls;
|
|
22
|
-
if (!(api !== null && api !== void 0 && (_api$blockControls = api.blockControls) !== null && _api$blockControls !== void 0 && _api$blockControls.commands.moveNode)) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
21
|
return [{
|
|
26
22
|
type: 'block-menu-item',
|
|
27
23
|
key: 'block-menu-item-move-up',
|
|
@@ -151,14 +147,12 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
|
|
|
151
147
|
parent: {
|
|
152
148
|
type: 'block-menu-section',
|
|
153
149
|
key: 'block-menu-section-delete',
|
|
154
|
-
rank:
|
|
150
|
+
rank: 50
|
|
155
151
|
},
|
|
156
152
|
component: function component() {
|
|
157
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
})
|
|
161
|
-
}, "Delete");
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement(_deleteButton.DeleteDropdownItem, {
|
|
154
|
+
api: api
|
|
155
|
+
});
|
|
162
156
|
}
|
|
163
157
|
}]);
|
|
164
158
|
};
|
|
@@ -29,6 +29,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
29
29
|
// get the current selection
|
|
30
30
|
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;
|
|
31
31
|
if (selection) {
|
|
32
|
+
var _api$blockControls;
|
|
32
33
|
var schema = selection.$from.doc.type.schema;
|
|
33
34
|
// for texts and inline nodes
|
|
34
35
|
if (selection instanceof _state.TextSelection) {
|
|
@@ -68,6 +69,12 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
68
69
|
var _domNode2 = (0, _copyButton.toDOM)(selection.node, schema);
|
|
69
70
|
(0, _copyButton.copyDomNode)(_domNode2, _nodeType, selection);
|
|
70
71
|
}
|
|
72
|
+
|
|
73
|
+
// close the block menu after copying
|
|
74
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
75
|
+
closeMenu: true
|
|
76
|
+
}));
|
|
77
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
71
78
|
}
|
|
72
79
|
};
|
|
73
80
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -19,6 +19,17 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
19
19
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
20
20
|
formatMessage = _useIntl.formatMessage;
|
|
21
21
|
var handleClick = (0, _react.useCallback)(function () {
|
|
22
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
23
|
+
var _api$blockControls;
|
|
24
|
+
var tr = _ref2.tr;
|
|
25
|
+
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.commands) === null || _api$blockControls === void 0 || _api$blockControls.toggleBlockMenu({
|
|
26
|
+
closeMenu: true
|
|
27
|
+
})({
|
|
28
|
+
tr: tr
|
|
29
|
+
});
|
|
30
|
+
return tr;
|
|
31
|
+
});
|
|
32
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
22
33
|
return (0, _copyLink.copyLink)(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api);
|
|
23
34
|
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api]);
|
|
24
35
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DeleteDropdownItem = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
12
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
+
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
16
|
+
var _box = require("@atlaskit/primitives/box");
|
|
17
|
+
var _text = _interopRequireDefault(require("@atlaskit/primitives/text"));
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
20
|
+
var _api$core$sharedState;
|
|
21
|
+
var api = _ref.api;
|
|
22
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
23
|
+
formatMessage = _useIntl.formatMessage;
|
|
24
|
+
var nodeTypes = Object.values((api === null || api === void 0 || (_api$core$sharedState = api.core.sharedState.currentState()) === null || _api$core$sharedState === void 0 || (_api$core$sharedState = _api$core$sharedState.schema) === null || _api$core$sharedState === void 0 ? void 0 : _api$core$sharedState.nodes) || {});
|
|
25
|
+
var onClick = function onClick() {
|
|
26
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
27
|
+
var _api$blockControls;
|
|
28
|
+
var tr = _ref2.tr;
|
|
29
|
+
var selection = tr.selection;
|
|
30
|
+
var from = selection.$from.pos;
|
|
31
|
+
var to = selection.$to.pos;
|
|
32
|
+
if (selection instanceof _state.TextSelection) {
|
|
33
|
+
from = from - 1;
|
|
34
|
+
to = to + 1;
|
|
35
|
+
} else if ((0, _utils.isTableSelected)(selection)) {
|
|
36
|
+
var table = (0, _utils.findTable)(selection);
|
|
37
|
+
if (table) {
|
|
38
|
+
from = table.start - 1;
|
|
39
|
+
to = table.start + table.node.nodeSize;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
tr.deleteRange(from, to);
|
|
43
|
+
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.commands) === null || _api$blockControls === void 0 || _api$blockControls.toggleBlockMenu({
|
|
44
|
+
closeMenu: true
|
|
45
|
+
})({
|
|
46
|
+
tr: tr
|
|
47
|
+
});
|
|
48
|
+
return tr;
|
|
49
|
+
});
|
|
50
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
51
|
+
};
|
|
52
|
+
var onMouseEnter = (0, _react.useCallback)(function () {
|
|
53
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
54
|
+
var _api$decorations, _api$decorations$hove;
|
|
55
|
+
var tr = _ref3.tr;
|
|
56
|
+
api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 || (_api$decorations = _api$decorations.commands) === null || _api$decorations === void 0 || (_api$decorations$hove = _api$decorations.hoverDecoration) === null || _api$decorations$hove === void 0 || _api$decorations$hove.call(_api$decorations, {
|
|
57
|
+
nodeType: nodeTypes,
|
|
58
|
+
add: true
|
|
59
|
+
})({
|
|
60
|
+
tr: tr
|
|
61
|
+
});
|
|
62
|
+
return tr;
|
|
63
|
+
});
|
|
64
|
+
}, [api, nodeTypes]);
|
|
65
|
+
var onMouseLeave = function onMouseLeave() {
|
|
66
|
+
var _api$decorations2, _api$decorations2$rem;
|
|
67
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$decorations2 = api.decorations) === null || _api$decorations2 === void 0 || (_api$decorations2 = _api$decorations2.commands) === null || _api$decorations2 === void 0 || (_api$decorations2$rem = _api$decorations2.removeDecoration) === null || _api$decorations2$rem === void 0 ? void 0 : _api$decorations2$rem.call(_api$decorations2));
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
70
|
+
onMouseEnter: onMouseEnter,
|
|
71
|
+
onMouseLeave: onMouseLeave
|
|
72
|
+
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
73
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
74
|
+
color: "var(--ds-icon-danger, #C9372C)",
|
|
75
|
+
label: ""
|
|
76
|
+
}),
|
|
77
|
+
onClick: onClick
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
79
|
+
as: "span",
|
|
80
|
+
color: "color.text.danger"
|
|
81
|
+
}, formatMessage(_blockMenu.messages.deleteBlock))));
|
|
82
|
+
};
|
|
83
|
+
var DeleteDropdownItem = exports.DeleteDropdownItem = (0, _reactIntlNext.injectIntl)(DeleteDropdownItemContent);
|
|
@@ -2,18 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
3
3
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
4
4
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
5
|
-
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
6
5
|
import ListBulletedIcon from '@atlaskit/icon/core/list-bulleted';
|
|
7
6
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
8
7
|
import CopyBlockMenuItem from './copy-block';
|
|
9
8
|
import { CopyLinkDropdownItem } from './copy-link';
|
|
9
|
+
import { DeleteDropdownItem } from './delete-button';
|
|
10
10
|
import { MoveDownDropdownItem } from './move-down';
|
|
11
11
|
import { MoveUpDropdownItem } from './move-up';
|
|
12
12
|
const getMoveUpMoveDownMenuComponents = api => {
|
|
13
|
-
var _api$blockControls;
|
|
14
|
-
if (!(api !== null && api !== void 0 && (_api$blockControls = api.blockControls) !== null && _api$blockControls !== void 0 && _api$blockControls.commands.moveNode)) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
13
|
return [{
|
|
18
14
|
type: 'block-menu-item',
|
|
19
15
|
key: 'block-menu-item-move-up',
|
|
@@ -142,14 +138,10 @@ export const getBlockMenuComponents = ({
|
|
|
142
138
|
parent: {
|
|
143
139
|
type: 'block-menu-section',
|
|
144
140
|
key: 'block-menu-section-delete',
|
|
145
|
-
rank:
|
|
141
|
+
rank: 50
|
|
146
142
|
},
|
|
147
|
-
component: () => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
label: ""
|
|
151
|
-
})
|
|
152
|
-
}, "Delete");
|
|
153
|
-
}
|
|
143
|
+
component: () => /*#__PURE__*/React.createElement(DeleteDropdownItem, {
|
|
144
|
+
api: api
|
|
145
|
+
})
|
|
154
146
|
}];
|
|
155
147
|
};
|
|
@@ -24,6 +24,7 @@ const CopyBlockMenuItem = ({
|
|
|
24
24
|
// get the current selection
|
|
25
25
|
const selection = api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : (_api$selection$shared = _api$selection.sharedState) === null || _api$selection$shared === void 0 ? void 0 : (_api$selection$shared2 = _api$selection$shared.currentState()) === null || _api$selection$shared2 === void 0 ? void 0 : _api$selection$shared2.selection;
|
|
26
26
|
if (selection) {
|
|
27
|
+
var _api$blockControls;
|
|
27
28
|
const schema = selection.$from.doc.type.schema;
|
|
28
29
|
// for texts and inline nodes
|
|
29
30
|
if (selection instanceof TextSelection) {
|
|
@@ -63,6 +64,12 @@ const CopyBlockMenuItem = ({
|
|
|
63
64
|
const domNode = toDOM(selection.node, schema);
|
|
64
65
|
copyDomNode(domNode, nodeType, selection);
|
|
65
66
|
}
|
|
67
|
+
|
|
68
|
+
// close the block menu after copying
|
|
69
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
70
|
+
closeMenu: true
|
|
71
|
+
}));
|
|
72
|
+
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
66
73
|
}
|
|
67
74
|
};
|
|
68
75
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -12,6 +12,18 @@ const CopyLinkDropdownItemContent = ({
|
|
|
12
12
|
formatMessage
|
|
13
13
|
} = useIntl();
|
|
14
14
|
const handleClick = useCallback(() => {
|
|
15
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
16
|
+
tr
|
|
17
|
+
}) => {
|
|
18
|
+
var _api$blockControls, _api$blockControls$co;
|
|
19
|
+
api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$co = _api$blockControls.commands) === null || _api$blockControls$co === void 0 ? void 0 : _api$blockControls$co.toggleBlockMenu({
|
|
20
|
+
closeMenu: true
|
|
21
|
+
})({
|
|
22
|
+
tr
|
|
23
|
+
});
|
|
24
|
+
return tr;
|
|
25
|
+
});
|
|
26
|
+
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
15
27
|
return copyLink(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api);
|
|
16
28
|
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api]);
|
|
17
29
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl, injectIntl } from 'react-intl-next';
|
|
3
|
+
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
4
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
8
|
+
import { Box } from '@atlaskit/primitives/box';
|
|
9
|
+
import Text from '@atlaskit/primitives/text';
|
|
10
|
+
const DeleteDropdownItemContent = ({
|
|
11
|
+
api
|
|
12
|
+
}) => {
|
|
13
|
+
var _api$core$sharedState, _api$core$sharedState2;
|
|
14
|
+
const {
|
|
15
|
+
formatMessage
|
|
16
|
+
} = useIntl();
|
|
17
|
+
const nodeTypes = Object.values((api === null || api === void 0 ? void 0 : (_api$core$sharedState = api.core.sharedState.currentState()) === null || _api$core$sharedState === void 0 ? void 0 : (_api$core$sharedState2 = _api$core$sharedState.schema) === null || _api$core$sharedState2 === void 0 ? void 0 : _api$core$sharedState2.nodes) || {});
|
|
18
|
+
const onClick = () => {
|
|
19
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
20
|
+
tr
|
|
21
|
+
}) => {
|
|
22
|
+
var _api$blockControls, _api$blockControls$co;
|
|
23
|
+
const selection = tr.selection;
|
|
24
|
+
let from = selection.$from.pos;
|
|
25
|
+
let to = selection.$to.pos;
|
|
26
|
+
if (selection instanceof TextSelection) {
|
|
27
|
+
from = from - 1;
|
|
28
|
+
to = to + 1;
|
|
29
|
+
} else if (isTableSelected(selection)) {
|
|
30
|
+
const table = findTable(selection);
|
|
31
|
+
if (table) {
|
|
32
|
+
from = table.start - 1;
|
|
33
|
+
to = table.start + table.node.nodeSize;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
tr.deleteRange(from, to);
|
|
37
|
+
api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$co = _api$blockControls.commands) === null || _api$blockControls$co === void 0 ? void 0 : _api$blockControls$co.toggleBlockMenu({
|
|
38
|
+
closeMenu: true
|
|
39
|
+
})({
|
|
40
|
+
tr
|
|
41
|
+
});
|
|
42
|
+
return tr;
|
|
43
|
+
});
|
|
44
|
+
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
45
|
+
};
|
|
46
|
+
const onMouseEnter = useCallback(() => {
|
|
47
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
48
|
+
tr
|
|
49
|
+
}) => {
|
|
50
|
+
var _api$decorations, _api$decorations$comm, _api$decorations$comm2;
|
|
51
|
+
api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : (_api$decorations$comm = _api$decorations.commands) === null || _api$decorations$comm === void 0 ? void 0 : (_api$decorations$comm2 = _api$decorations$comm.hoverDecoration) === null || _api$decorations$comm2 === void 0 ? void 0 : _api$decorations$comm2.call(_api$decorations$comm, {
|
|
52
|
+
nodeType: nodeTypes,
|
|
53
|
+
add: true
|
|
54
|
+
})({
|
|
55
|
+
tr
|
|
56
|
+
});
|
|
57
|
+
return tr;
|
|
58
|
+
});
|
|
59
|
+
}, [api, nodeTypes]);
|
|
60
|
+
const onMouseLeave = () => {
|
|
61
|
+
var _api$decorations2, _api$decorations2$com, _api$decorations2$com2;
|
|
62
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$decorations2 = api.decorations) === null || _api$decorations2 === void 0 ? void 0 : (_api$decorations2$com = _api$decorations2.commands) === null || _api$decorations2$com === void 0 ? void 0 : (_api$decorations2$com2 = _api$decorations2$com.removeDecoration) === null || _api$decorations2$com2 === void 0 ? void 0 : _api$decorations2$com2.call(_api$decorations2$com));
|
|
63
|
+
};
|
|
64
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
65
|
+
onMouseEnter: onMouseEnter,
|
|
66
|
+
onMouseLeave: onMouseLeave
|
|
67
|
+
}, /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
68
|
+
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
69
|
+
color: "var(--ds-icon-danger, #C9372C)",
|
|
70
|
+
label: ""
|
|
71
|
+
}),
|
|
72
|
+
onClick: onClick
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
74
|
+
as: "span",
|
|
75
|
+
color: "color.text.danger"
|
|
76
|
+
}, formatMessage(messages.deleteBlock))));
|
|
77
|
+
};
|
|
78
|
+
export const DeleteDropdownItem = injectIntl(DeleteDropdownItemContent);
|
|
@@ -3,18 +3,14 @@ import React from 'react';
|
|
|
3
3
|
import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
4
4
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
5
5
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
6
|
-
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
7
6
|
import ListBulletedIcon from '@atlaskit/icon/core/list-bulleted';
|
|
8
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
9
8
|
import CopyBlockMenuItem from './copy-block';
|
|
10
9
|
import { CopyLinkDropdownItem } from './copy-link';
|
|
10
|
+
import { DeleteDropdownItem } from './delete-button';
|
|
11
11
|
import { MoveDownDropdownItem } from './move-down';
|
|
12
12
|
import { MoveUpDropdownItem } from './move-up';
|
|
13
13
|
var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(api) {
|
|
14
|
-
var _api$blockControls;
|
|
15
|
-
if (!(api !== null && api !== void 0 && (_api$blockControls = api.blockControls) !== null && _api$blockControls !== void 0 && _api$blockControls.commands.moveNode)) {
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
14
|
return [{
|
|
19
15
|
type: 'block-menu-item',
|
|
20
16
|
key: 'block-menu-item-move-up',
|
|
@@ -144,14 +140,12 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref) {
|
|
|
144
140
|
parent: {
|
|
145
141
|
type: 'block-menu-section',
|
|
146
142
|
key: 'block-menu-section-delete',
|
|
147
|
-
rank:
|
|
143
|
+
rank: 50
|
|
148
144
|
},
|
|
149
145
|
component: function component() {
|
|
150
|
-
return /*#__PURE__*/React.createElement(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
})
|
|
154
|
-
}, "Delete");
|
|
146
|
+
return /*#__PURE__*/React.createElement(DeleteDropdownItem, {
|
|
147
|
+
api: api
|
|
148
|
+
});
|
|
155
149
|
}
|
|
156
150
|
}]);
|
|
157
151
|
};
|
|
@@ -22,6 +22,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
22
22
|
// get the current selection
|
|
23
23
|
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;
|
|
24
24
|
if (selection) {
|
|
25
|
+
var _api$blockControls;
|
|
25
26
|
var schema = selection.$from.doc.type.schema;
|
|
26
27
|
// for texts and inline nodes
|
|
27
28
|
if (selection instanceof TextSelection) {
|
|
@@ -61,6 +62,12 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
61
62
|
var _domNode2 = toDOM(selection.node, schema);
|
|
62
63
|
copyDomNode(_domNode2, _nodeType, selection);
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
// close the block menu after copying
|
|
67
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
68
|
+
closeMenu: true
|
|
69
|
+
}));
|
|
70
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
64
71
|
}
|
|
65
72
|
};
|
|
66
73
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -10,6 +10,17 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
10
10
|
var _useIntl = useIntl(),
|
|
11
11
|
formatMessage = _useIntl.formatMessage;
|
|
12
12
|
var handleClick = useCallback(function () {
|
|
13
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
14
|
+
var _api$blockControls;
|
|
15
|
+
var tr = _ref2.tr;
|
|
16
|
+
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.commands) === null || _api$blockControls === void 0 || _api$blockControls.toggleBlockMenu({
|
|
17
|
+
closeMenu: true
|
|
18
|
+
})({
|
|
19
|
+
tr: tr
|
|
20
|
+
});
|
|
21
|
+
return tr;
|
|
22
|
+
});
|
|
23
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
13
24
|
return copyLink(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api);
|
|
14
25
|
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api]);
|
|
15
26
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl, injectIntl } from 'react-intl-next';
|
|
3
|
+
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
4
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
8
|
+
import { Box } from '@atlaskit/primitives/box';
|
|
9
|
+
import Text from '@atlaskit/primitives/text';
|
|
10
|
+
var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
11
|
+
var _api$core$sharedState;
|
|
12
|
+
var api = _ref.api;
|
|
13
|
+
var _useIntl = useIntl(),
|
|
14
|
+
formatMessage = _useIntl.formatMessage;
|
|
15
|
+
var nodeTypes = Object.values((api === null || api === void 0 || (_api$core$sharedState = api.core.sharedState.currentState()) === null || _api$core$sharedState === void 0 || (_api$core$sharedState = _api$core$sharedState.schema) === null || _api$core$sharedState === void 0 ? void 0 : _api$core$sharedState.nodes) || {});
|
|
16
|
+
var onClick = function onClick() {
|
|
17
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
18
|
+
var _api$blockControls;
|
|
19
|
+
var tr = _ref2.tr;
|
|
20
|
+
var selection = tr.selection;
|
|
21
|
+
var from = selection.$from.pos;
|
|
22
|
+
var to = selection.$to.pos;
|
|
23
|
+
if (selection instanceof TextSelection) {
|
|
24
|
+
from = from - 1;
|
|
25
|
+
to = to + 1;
|
|
26
|
+
} else if (isTableSelected(selection)) {
|
|
27
|
+
var table = findTable(selection);
|
|
28
|
+
if (table) {
|
|
29
|
+
from = table.start - 1;
|
|
30
|
+
to = table.start + table.node.nodeSize;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
tr.deleteRange(from, to);
|
|
34
|
+
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.commands) === null || _api$blockControls === void 0 || _api$blockControls.toggleBlockMenu({
|
|
35
|
+
closeMenu: true
|
|
36
|
+
})({
|
|
37
|
+
tr: tr
|
|
38
|
+
});
|
|
39
|
+
return tr;
|
|
40
|
+
});
|
|
41
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
42
|
+
};
|
|
43
|
+
var onMouseEnter = useCallback(function () {
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
45
|
+
var _api$decorations, _api$decorations$hove;
|
|
46
|
+
var tr = _ref3.tr;
|
|
47
|
+
api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 || (_api$decorations = _api$decorations.commands) === null || _api$decorations === void 0 || (_api$decorations$hove = _api$decorations.hoverDecoration) === null || _api$decorations$hove === void 0 || _api$decorations$hove.call(_api$decorations, {
|
|
48
|
+
nodeType: nodeTypes,
|
|
49
|
+
add: true
|
|
50
|
+
})({
|
|
51
|
+
tr: tr
|
|
52
|
+
});
|
|
53
|
+
return tr;
|
|
54
|
+
});
|
|
55
|
+
}, [api, nodeTypes]);
|
|
56
|
+
var onMouseLeave = function onMouseLeave() {
|
|
57
|
+
var _api$decorations2, _api$decorations2$rem;
|
|
58
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$decorations2 = api.decorations) === null || _api$decorations2 === void 0 || (_api$decorations2 = _api$decorations2.commands) === null || _api$decorations2 === void 0 || (_api$decorations2$rem = _api$decorations2.removeDecoration) === null || _api$decorations2$rem === void 0 ? void 0 : _api$decorations2$rem.call(_api$decorations2));
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
61
|
+
onMouseEnter: onMouseEnter,
|
|
62
|
+
onMouseLeave: onMouseLeave
|
|
63
|
+
}, /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
64
|
+
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
65
|
+
color: "var(--ds-icon-danger, #C9372C)",
|
|
66
|
+
label: ""
|
|
67
|
+
}),
|
|
68
|
+
onClick: onClick
|
|
69
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
70
|
+
as: "span",
|
|
71
|
+
color: "color.text.danger"
|
|
72
|
+
}, formatMessage(messages.deleteBlock))));
|
|
73
|
+
};
|
|
74
|
+
export var DeleteDropdownItem = injectIntl(DeleteDropdownItemContent);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
3
4
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
4
5
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
5
6
|
export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
@@ -10,7 +11,8 @@ export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
|
10
11
|
dependencies: [
|
|
11
12
|
OptionalPlugin<BlockControlsPlugin>,
|
|
12
13
|
OptionalPlugin<UserIntentPlugin>,
|
|
13
|
-
OptionalPlugin<SelectionPlugin
|
|
14
|
+
OptionalPlugin<SelectionPlugin>,
|
|
15
|
+
OptionalPlugin<DecorationsPlugin>
|
|
14
16
|
];
|
|
15
17
|
pluginConfiguration?: BlockMenuPluginOptions;
|
|
16
18
|
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
|
+
type Props = {
|
|
6
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
|
+
} & WrappedComponentProps;
|
|
8
|
+
export declare const DeleteDropdownItem: React.FC<import("react-intl-next").WithIntlProps<Props>> & {
|
|
9
|
+
WrappedComponent: React.ComponentType<Props>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { 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
|
-
api: ExtractInjectionAPI<BlockMenuPlugin
|
|
6
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
8
|
export declare const MoveDownDropdownItem: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
@@ -3,7 +3,7 @@ import type { 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
|
-
api: ExtractInjectionAPI<BlockMenuPlugin
|
|
6
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
8
|
export declare const MoveUpDropdownItem: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
3
4
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
4
5
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
5
6
|
export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
@@ -10,7 +11,8 @@ export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
|
10
11
|
dependencies: [
|
|
11
12
|
OptionalPlugin<BlockControlsPlugin>,
|
|
12
13
|
OptionalPlugin<UserIntentPlugin>,
|
|
13
|
-
OptionalPlugin<SelectionPlugin
|
|
14
|
+
OptionalPlugin<SelectionPlugin>,
|
|
15
|
+
OptionalPlugin<DecorationsPlugin>
|
|
14
16
|
];
|
|
15
17
|
pluginConfiguration?: BlockMenuPluginOptions;
|
|
16
18
|
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
5
|
+
type Props = {
|
|
6
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
|
+
} & WrappedComponentProps;
|
|
8
|
+
export declare const DeleteDropdownItem: React.FC<import("react-intl-next").WithIntlProps<Props>> & {
|
|
9
|
+
WrappedComponent: React.ComponentType<Props>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { 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
|
-
api: ExtractInjectionAPI<BlockMenuPlugin
|
|
6
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
8
|
export declare const MoveDownDropdownItem: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
@@ -3,7 +3,7 @@ import type { 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
|
-
api: ExtractInjectionAPI<BlockMenuPlugin
|
|
6
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
7
7
|
};
|
|
8
8
|
export declare const MoveUpDropdownItem: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"@atlaskit/css": "^0.12.0",
|
|
35
35
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
36
36
|
"@atlaskit/editor-plugin-block-controls": "^4.2.0",
|
|
37
|
+
"@atlaskit/editor-plugin-decorations": "^3.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-selection": "^3.2.0",
|
|
37
39
|
"@atlaskit/editor-plugin-user-intent": "^1.1.0",
|
|
38
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
41
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
"@babel/runtime": "^7.0.0"
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^107.
|
|
51
|
+
"@atlaskit/editor-common": "^107.31.0",
|
|
50
52
|
"react": "^18.2.0",
|
|
51
53
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
52
54
|
},
|