@atlaskit/editor-plugin-block-menu 0.0.0 → 0.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 +19 -0
- package/afm-cc/tsconfig.json +27 -0
- package/afm-dev-agents/tsconfig.json +51 -0
- package/afm-jira/tsconfig.json +51 -0
- package/afm-post-office/tsconfig.json +51 -0
- package/afm-rovo-extension/tsconfig.json +51 -0
- package/afm-townsquare/tsconfig.json +51 -0
- package/dist/cjs/blockMenuPlugin.js +18 -1
- package/dist/cjs/ui/block-menu.compiled.css +3 -0
- package/dist/cjs/ui/block-menu.js +152 -0
- package/dist/es2019/blockMenuPlugin.js +19 -1
- package/dist/es2019/ui/block-menu.compiled.css +3 -0
- package/dist/es2019/ui/block-menu.js +144 -0
- package/dist/esm/blockMenuPlugin.js +17 -1
- package/dist/esm/ui/block-menu.compiled.css +3 -0
- package/dist/esm/ui/block-menu.js +143 -0
- package/dist/types/blockMenuPluginType.d.ts +6 -2
- package/dist/types/ui/block-menu.d.ts +16 -0
- package/dist/types-ts4.5/blockMenuPluginType.d.ts +9 -2
- package/dist/types-ts4.5/ui/block-menu.d.ts +16 -0
- package/package.json +13 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @atlaskit/editor-plugin-block-menu
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#199487](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/199487)
|
|
8
|
+
[`53b66ca466092`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/53b66ca466092) -
|
|
9
|
+
ED-28963 Update block menu to be aligned with drag handle
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 0.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#196697](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/196697)
|
|
17
|
+
[`18b5fbc52627b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/18b5fbc52627b) -
|
|
18
|
+
[ux] Adds block menu plugin for full-page preset and shows the menu when drag handle is clicked.
|
|
19
|
+
- Updated dependencies
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -17,6 +17,33 @@
|
|
|
17
17
|
"../src/**/examples.*"
|
|
18
18
|
],
|
|
19
19
|
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/css/afm-cc/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/dropdown-menu/afm-cc/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-plugin-block-controls/afm-cc/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-user-intent/afm-cc/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-shared-styles/afm-cc/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../design-system/icon/afm-cc/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon-lab/afm-cc/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/primitives/afm-cc/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/tokens/afm-cc/tsconfig.json"
|
|
46
|
+
},
|
|
20
47
|
{
|
|
21
48
|
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
22
49
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.dev-agents.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../dev-agents/tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/css/afm-dev-agents/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/dropdown-menu/afm-dev-agents/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-plugin-block-controls/afm-dev-agents/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-user-intent/afm-dev-agents/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-shared-styles/afm-dev-agents/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../design-system/icon/afm-dev-agents/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon-lab/afm-dev-agents/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/primitives/afm-dev-agents/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/tokens/afm-dev-agents/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-common/afm-dev-agents/tsconfig.json"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/css/afm-jira/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/dropdown-menu/afm-jira/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-plugin-block-controls/afm-jira/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-user-intent/afm-jira/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-shared-styles/afm-jira/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon-lab/afm-jira/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/primitives/afm-jira/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/tokens/afm-jira/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-common/afm-jira/tsconfig.json"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.post-office.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/css/afm-post-office/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/dropdown-menu/afm-post-office/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-plugin-block-controls/afm-post-office/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-user-intent/afm-post-office/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-shared-styles/afm-post-office/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../design-system/icon/afm-post-office/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon-lab/afm-post-office/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/primitives/afm-post-office/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/tokens/afm-post-office/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.rovo-extension.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../rovo-extension/tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/css/afm-rovo-extension/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/dropdown-menu/afm-rovo-extension/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-plugin-block-controls/afm-rovo-extension/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-user-intent/afm-rovo-extension/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-shared-styles/afm-rovo-extension/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../design-system/icon/afm-rovo-extension/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon-lab/afm-rovo-extension/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/primitives/afm-rovo-extension/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/tokens/afm-rovo-extension/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-common/afm-rovo-extension/tsconfig.json"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.townsquare.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../townsquare/tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/css/afm-townsquare/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../design-system/dropdown-menu/afm-townsquare/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-plugin-block-controls/afm-townsquare/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-user-intent/afm-townsquare/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-shared-styles/afm-townsquare/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../../design-system/icon/afm-townsquare/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon-lab/afm-townsquare/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/primitives/afm-townsquare/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-common/afm-townsquare/tsconfig.json"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.blockMenuPlugin = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
9
|
var _main = require("./pm-plugins/main");
|
|
8
|
-
var
|
|
10
|
+
var _blockMenu = _interopRequireDefault(require("./ui/block-menu"));
|
|
11
|
+
var blockMenuPlugin = exports.blockMenuPlugin = function blockMenuPlugin(_ref) {
|
|
12
|
+
var api = _ref.api;
|
|
9
13
|
return {
|
|
10
14
|
name: 'blockMenu',
|
|
11
15
|
pmPlugins: function pmPlugins() {
|
|
@@ -13,6 +17,19 @@ var blockMenuPlugin = exports.blockMenuPlugin = function blockMenuPlugin() {
|
|
|
13
17
|
name: 'blockMenuPlugin',
|
|
14
18
|
plugin: _main.createPlugin
|
|
15
19
|
}];
|
|
20
|
+
},
|
|
21
|
+
contentComponent: function contentComponent(_ref2) {
|
|
22
|
+
var editorView = _ref2.editorView,
|
|
23
|
+
popupsMountPoint = _ref2.popupsMountPoint,
|
|
24
|
+
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
25
|
+
popupsScrollableElement = _ref2.popupsScrollableElement;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_blockMenu.default, {
|
|
27
|
+
editorView: editorView,
|
|
28
|
+
api: api,
|
|
29
|
+
mountTo: popupsMountPoint,
|
|
30
|
+
boundariesElement: popupsBoundariesElement,
|
|
31
|
+
scrollableElement: popupsScrollableElement
|
|
32
|
+
});
|
|
16
33
|
}
|
|
17
34
|
};
|
|
18
35
|
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* block-menu.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
require("./block-menu.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _reactIntlNext = require("react-intl-next");
|
|
14
|
+
var _css = require("@atlaskit/css");
|
|
15
|
+
var _dropdownMenu = _interopRequireWildcard(require("@atlaskit/dropdown-menu"));
|
|
16
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
|
+
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
19
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
|
+
var _jira = _interopRequireDefault(require("@atlaskit/icon-lab/core/jira"));
|
|
21
|
+
var _arrowDown = _interopRequireDefault(require("@atlaskit/icon/core/arrow-down"));
|
|
22
|
+
var _arrowUp = _interopRequireDefault(require("@atlaskit/icon/core/arrow-up"));
|
|
23
|
+
var _changes = _interopRequireDefault(require("@atlaskit/icon/core/changes"));
|
|
24
|
+
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
|
|
25
|
+
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
26
|
+
var _listBulleted = _interopRequireDefault(require("@atlaskit/icon/core/list-bulleted"));
|
|
27
|
+
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
28
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
29
|
+
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); }
|
|
30
|
+
var styles = {
|
|
31
|
+
base: "_2rkoglpi _bfhk1bhr _16qs1cd0"
|
|
32
|
+
};
|
|
33
|
+
var DRAG_HANDLE_SELECTOR = '[data-editor-block-ctrl-drag-handle=true]';
|
|
34
|
+
var DRAG_HANDLE_WIDTH = 12;
|
|
35
|
+
var DRAG_HANDLE_PADDING = 5;
|
|
36
|
+
var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
|
|
37
|
+
var FormatDropdown = function FormatDropdown() {
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.default, {
|
|
39
|
+
placement: "right-start",
|
|
40
|
+
shouldFitContainer: true,
|
|
41
|
+
trigger: function trigger(_ref) {
|
|
42
|
+
var triggerRef = _ref.triggerRef,
|
|
43
|
+
ariaControls = _ref['aria-controls'],
|
|
44
|
+
ariaHasPopup = _ref['aria-haspopup'],
|
|
45
|
+
ariaExpanded = _ref['aria-expanded'];
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
47
|
+
"aria-controls": ariaControls,
|
|
48
|
+
"aria-haspopup": ariaHasPopup,
|
|
49
|
+
"aria-expanded": ariaExpanded,
|
|
50
|
+
ref: triggerRef,
|
|
51
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_changes.default, {
|
|
52
|
+
label: ""
|
|
53
|
+
}),
|
|
54
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_chevronRight.default, {
|
|
55
|
+
label: ""
|
|
56
|
+
})
|
|
57
|
+
}, "Format");
|
|
58
|
+
}
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
60
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_task.default, {
|
|
61
|
+
label: ""
|
|
62
|
+
})
|
|
63
|
+
}, "Action item"), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
64
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_listBulleted.default, {
|
|
65
|
+
label: ""
|
|
66
|
+
})
|
|
67
|
+
}, "Bullet list")));
|
|
68
|
+
};
|
|
69
|
+
var BlockMenuContent = function BlockMenuContent() {
|
|
70
|
+
var setOutsideClickTargetRef = (0, _react.useContext)(_uiReact.OutsideClickTargetRefContext);
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
72
|
+
testId: "editor-block-menu",
|
|
73
|
+
ref: setOutsideClickTargetRef,
|
|
74
|
+
xcss: (0, _css.cx)(styles.base)
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, /*#__PURE__*/_react.default.createElement(FormatDropdown, null), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
76
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_jira.default, {
|
|
77
|
+
label: ""
|
|
78
|
+
})
|
|
79
|
+
}, "Create Jira work item")), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, {
|
|
80
|
+
hasSeparator: true
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
82
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_arrowUp.default, {
|
|
83
|
+
label: ""
|
|
84
|
+
})
|
|
85
|
+
}, "Move up"), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
86
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_arrowDown.default, {
|
|
87
|
+
label: ""
|
|
88
|
+
})
|
|
89
|
+
}, "Move down")), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, {
|
|
90
|
+
hasSeparator: true
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
92
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
93
|
+
label: ""
|
|
94
|
+
})
|
|
95
|
+
}, "Delete")));
|
|
96
|
+
};
|
|
97
|
+
var BlockMenu = function BlockMenu(_ref2) {
|
|
98
|
+
var _editorView$hasFocus, _editorView$dom;
|
|
99
|
+
var editorView = _ref2.editorView,
|
|
100
|
+
api = _ref2.api,
|
|
101
|
+
mountTo = _ref2.mountTo,
|
|
102
|
+
boundariesElement = _ref2.boundariesElement,
|
|
103
|
+
scrollableElement = _ref2.scrollableElement;
|
|
104
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockControls', 'userIntent'], function (states) {
|
|
105
|
+
var _states$blockControls, _states$blockControls2, _states$blockControls3, _states$userIntentSta;
|
|
106
|
+
return {
|
|
107
|
+
menuTriggerBy: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.menuTriggerBy,
|
|
108
|
+
isSelectedViaDragHandle: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.isSelectedViaDragHandle,
|
|
109
|
+
isMenuOpen: (_states$blockControls3 = states.blockControlsState) === null || _states$blockControls3 === void 0 ? void 0 : _states$blockControls3.isMenuOpen,
|
|
110
|
+
currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
|
|
111
|
+
};
|
|
112
|
+
}),
|
|
113
|
+
menuTriggerBy = _useSharedPluginState.menuTriggerBy,
|
|
114
|
+
isSelectedViaDragHandle = _useSharedPluginState.isSelectedViaDragHandle,
|
|
115
|
+
isMenuOpen = _useSharedPluginState.isMenuOpen,
|
|
116
|
+
currentUserIntent = _useSharedPluginState.currentUserIntent;
|
|
117
|
+
var hasFocus = (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
|
|
118
|
+
var hasSelection = !!editorView && !editorView.state.selection.empty;
|
|
119
|
+
if (!isMenuOpen) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
var closeMenu = function closeMenu() {
|
|
123
|
+
var _api$blockControls;
|
|
124
|
+
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({
|
|
125
|
+
closeMenu: true
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
if (!menuTriggerBy || !isSelectedViaDragHandle || !hasFocus || !hasSelection || currentUserIntent === 'dragging') {
|
|
129
|
+
closeMenu();
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
var targetHandleRef = (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
133
|
+
if (targetHandleRef instanceof HTMLElement) {
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
|
|
135
|
+
alignX: 'left',
|
|
136
|
+
alignY: 'start',
|
|
137
|
+
handleClickOutside: closeMenu,
|
|
138
|
+
handleEscapeKeydown: closeMenu,
|
|
139
|
+
mountTo: mountTo,
|
|
140
|
+
boundariesElement: boundariesElement,
|
|
141
|
+
scrollableElement: scrollableElement,
|
|
142
|
+
target: targetHandleRef,
|
|
143
|
+
zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
|
|
144
|
+
forcePlacement: true,
|
|
145
|
+
stick: true,
|
|
146
|
+
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_PADDING, 0]
|
|
147
|
+
}, /*#__PURE__*/_react.default.createElement(BlockMenuContent, null));
|
|
148
|
+
} else {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(BlockMenu);
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { createPlugin } from './pm-plugins/main';
|
|
2
|
-
|
|
3
|
+
import BlockMenu from './ui/block-menu';
|
|
4
|
+
export const blockMenuPlugin = ({
|
|
5
|
+
api
|
|
6
|
+
}) => ({
|
|
3
7
|
name: 'blockMenu',
|
|
4
8
|
pmPlugins() {
|
|
5
9
|
return [{
|
|
6
10
|
name: 'blockMenuPlugin',
|
|
7
11
|
plugin: createPlugin
|
|
8
12
|
}];
|
|
13
|
+
},
|
|
14
|
+
contentComponent({
|
|
15
|
+
editorView,
|
|
16
|
+
popupsMountPoint,
|
|
17
|
+
popupsBoundariesElement,
|
|
18
|
+
popupsScrollableElement
|
|
19
|
+
}) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(BlockMenu, {
|
|
21
|
+
editorView: editorView,
|
|
22
|
+
api: api,
|
|
23
|
+
mountTo: popupsMountPoint,
|
|
24
|
+
boundariesElement: popupsBoundariesElement,
|
|
25
|
+
scrollableElement: popupsScrollableElement
|
|
26
|
+
});
|
|
9
27
|
}
|
|
10
28
|
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/* block-menu.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./block-menu.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
|
+
import { injectIntl } from 'react-intl-next';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
7
|
+
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
8
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
11
|
+
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
|
+
import JiraIcon from '@atlaskit/icon-lab/core/jira';
|
|
13
|
+
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
14
|
+
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
15
|
+
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
16
|
+
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
17
|
+
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
18
|
+
import ListBulletedIcon from '@atlaskit/icon/core/list-bulleted';
|
|
19
|
+
import TaskIcon from '@atlaskit/icon/core/task';
|
|
20
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
21
|
+
const styles = {
|
|
22
|
+
base: "_2rkoglpi _bfhk1bhr _16qs1cd0"
|
|
23
|
+
};
|
|
24
|
+
const DRAG_HANDLE_SELECTOR = '[data-editor-block-ctrl-drag-handle=true]';
|
|
25
|
+
const DRAG_HANDLE_WIDTH = 12;
|
|
26
|
+
const DRAG_HANDLE_PADDING = 5;
|
|
27
|
+
const PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
28
|
+
const FormatDropdown = () => {
|
|
29
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
30
|
+
placement: "right-start",
|
|
31
|
+
shouldFitContainer: true,
|
|
32
|
+
trigger: ({
|
|
33
|
+
triggerRef,
|
|
34
|
+
'aria-controls': ariaControls,
|
|
35
|
+
'aria-haspopup': ariaHasPopup,
|
|
36
|
+
'aria-expanded': ariaExpanded
|
|
37
|
+
}) => /*#__PURE__*/React.createElement(DropdownItem, {
|
|
38
|
+
"aria-controls": ariaControls,
|
|
39
|
+
"aria-haspopup": ariaHasPopup,
|
|
40
|
+
"aria-expanded": ariaExpanded,
|
|
41
|
+
ref: triggerRef,
|
|
42
|
+
elemBefore: /*#__PURE__*/React.createElement(ChangesIcon, {
|
|
43
|
+
label: ""
|
|
44
|
+
}),
|
|
45
|
+
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
46
|
+
label: ""
|
|
47
|
+
})
|
|
48
|
+
}, "Format")
|
|
49
|
+
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
50
|
+
elemBefore: /*#__PURE__*/React.createElement(TaskIcon, {
|
|
51
|
+
label: ""
|
|
52
|
+
})
|
|
53
|
+
}, "Action item"), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
54
|
+
elemBefore: /*#__PURE__*/React.createElement(ListBulletedIcon, {
|
|
55
|
+
label: ""
|
|
56
|
+
})
|
|
57
|
+
}, "Bullet list")));
|
|
58
|
+
};
|
|
59
|
+
const BlockMenuContent = () => {
|
|
60
|
+
const setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
61
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
62
|
+
testId: "editor-block-menu",
|
|
63
|
+
ref: setOutsideClickTargetRef,
|
|
64
|
+
xcss: cx(styles.base)
|
|
65
|
+
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(FormatDropdown, null), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
66
|
+
elemBefore: /*#__PURE__*/React.createElement(JiraIcon, {
|
|
67
|
+
label: ""
|
|
68
|
+
})
|
|
69
|
+
}, "Create Jira work item")), /*#__PURE__*/React.createElement(DropdownItemGroup, {
|
|
70
|
+
hasSeparator: true
|
|
71
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
72
|
+
elemBefore: /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
73
|
+
label: ""
|
|
74
|
+
})
|
|
75
|
+
}, "Move up"), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
76
|
+
elemBefore: /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
77
|
+
label: ""
|
|
78
|
+
})
|
|
79
|
+
}, "Move down")), /*#__PURE__*/React.createElement(DropdownItemGroup, {
|
|
80
|
+
hasSeparator: true
|
|
81
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
82
|
+
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
83
|
+
label: ""
|
|
84
|
+
})
|
|
85
|
+
}, "Delete")));
|
|
86
|
+
};
|
|
87
|
+
const BlockMenu = ({
|
|
88
|
+
editorView,
|
|
89
|
+
api,
|
|
90
|
+
mountTo,
|
|
91
|
+
boundariesElement,
|
|
92
|
+
scrollableElement
|
|
93
|
+
}) => {
|
|
94
|
+
var _editorView$hasFocus, _editorView$dom;
|
|
95
|
+
const {
|
|
96
|
+
menuTriggerBy,
|
|
97
|
+
isSelectedViaDragHandle,
|
|
98
|
+
isMenuOpen,
|
|
99
|
+
currentUserIntent
|
|
100
|
+
} = useSharedPluginStateWithSelector(api, ['blockControls', 'userIntent'], states => {
|
|
101
|
+
var _states$blockControls, _states$blockControls2, _states$blockControls3, _states$userIntentSta;
|
|
102
|
+
return {
|
|
103
|
+
menuTriggerBy: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.menuTriggerBy,
|
|
104
|
+
isSelectedViaDragHandle: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.isSelectedViaDragHandle,
|
|
105
|
+
isMenuOpen: (_states$blockControls3 = states.blockControlsState) === null || _states$blockControls3 === void 0 ? void 0 : _states$blockControls3.isMenuOpen,
|
|
106
|
+
currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
const hasFocus = (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
|
|
110
|
+
const hasSelection = !!editorView && !editorView.state.selection.empty;
|
|
111
|
+
if (!isMenuOpen) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const closeMenu = () => {
|
|
115
|
+
var _api$blockControls;
|
|
116
|
+
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({
|
|
117
|
+
closeMenu: true
|
|
118
|
+
}));
|
|
119
|
+
};
|
|
120
|
+
if (!menuTriggerBy || !isSelectedViaDragHandle || !hasFocus || !hasSelection || currentUserIntent === 'dragging') {
|
|
121
|
+
closeMenu();
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const targetHandleRef = (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
125
|
+
if (targetHandleRef instanceof HTMLElement) {
|
|
126
|
+
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
127
|
+
alignX: 'left',
|
|
128
|
+
alignY: 'start',
|
|
129
|
+
handleClickOutside: closeMenu,
|
|
130
|
+
handleEscapeKeydown: closeMenu,
|
|
131
|
+
mountTo: mountTo,
|
|
132
|
+
boundariesElement: boundariesElement,
|
|
133
|
+
scrollableElement: scrollableElement,
|
|
134
|
+
target: targetHandleRef,
|
|
135
|
+
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
136
|
+
forcePlacement: true,
|
|
137
|
+
stick: true,
|
|
138
|
+
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_PADDING, 0]
|
|
139
|
+
}, /*#__PURE__*/React.createElement(BlockMenuContent, null));
|
|
140
|
+
} else {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
export default injectIntl(BlockMenu);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { createPlugin } from './pm-plugins/main';
|
|
2
|
-
|
|
3
|
+
import BlockMenu from './ui/block-menu';
|
|
4
|
+
export var blockMenuPlugin = function blockMenuPlugin(_ref) {
|
|
5
|
+
var api = _ref.api;
|
|
3
6
|
return {
|
|
4
7
|
name: 'blockMenu',
|
|
5
8
|
pmPlugins: function pmPlugins() {
|
|
@@ -7,6 +10,19 @@ export var blockMenuPlugin = function blockMenuPlugin() {
|
|
|
7
10
|
name: 'blockMenuPlugin',
|
|
8
11
|
plugin: createPlugin
|
|
9
12
|
}];
|
|
13
|
+
},
|
|
14
|
+
contentComponent: function contentComponent(_ref2) {
|
|
15
|
+
var editorView = _ref2.editorView,
|
|
16
|
+
popupsMountPoint = _ref2.popupsMountPoint,
|
|
17
|
+
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
18
|
+
popupsScrollableElement = _ref2.popupsScrollableElement;
|
|
19
|
+
return /*#__PURE__*/React.createElement(BlockMenu, {
|
|
20
|
+
editorView: editorView,
|
|
21
|
+
api: api,
|
|
22
|
+
mountTo: popupsMountPoint,
|
|
23
|
+
boundariesElement: popupsBoundariesElement,
|
|
24
|
+
scrollableElement: popupsScrollableElement
|
|
25
|
+
});
|
|
10
26
|
}
|
|
11
27
|
};
|
|
12
28
|
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/* block-menu.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./block-menu.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
|
+
import { injectIntl } from 'react-intl-next';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
7
|
+
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
8
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
11
|
+
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
|
+
import JiraIcon from '@atlaskit/icon-lab/core/jira';
|
|
13
|
+
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
14
|
+
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
15
|
+
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
16
|
+
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
17
|
+
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
18
|
+
import ListBulletedIcon from '@atlaskit/icon/core/list-bulleted';
|
|
19
|
+
import TaskIcon from '@atlaskit/icon/core/task';
|
|
20
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
21
|
+
var styles = {
|
|
22
|
+
base: "_2rkoglpi _bfhk1bhr _16qs1cd0"
|
|
23
|
+
};
|
|
24
|
+
var DRAG_HANDLE_SELECTOR = '[data-editor-block-ctrl-drag-handle=true]';
|
|
25
|
+
var DRAG_HANDLE_WIDTH = 12;
|
|
26
|
+
var DRAG_HANDLE_PADDING = 5;
|
|
27
|
+
var PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
28
|
+
var FormatDropdown = function FormatDropdown() {
|
|
29
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
30
|
+
placement: "right-start",
|
|
31
|
+
shouldFitContainer: true,
|
|
32
|
+
trigger: function trigger(_ref) {
|
|
33
|
+
var triggerRef = _ref.triggerRef,
|
|
34
|
+
ariaControls = _ref['aria-controls'],
|
|
35
|
+
ariaHasPopup = _ref['aria-haspopup'],
|
|
36
|
+
ariaExpanded = _ref['aria-expanded'];
|
|
37
|
+
return /*#__PURE__*/React.createElement(DropdownItem, {
|
|
38
|
+
"aria-controls": ariaControls,
|
|
39
|
+
"aria-haspopup": ariaHasPopup,
|
|
40
|
+
"aria-expanded": ariaExpanded,
|
|
41
|
+
ref: triggerRef,
|
|
42
|
+
elemBefore: /*#__PURE__*/React.createElement(ChangesIcon, {
|
|
43
|
+
label: ""
|
|
44
|
+
}),
|
|
45
|
+
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
46
|
+
label: ""
|
|
47
|
+
})
|
|
48
|
+
}, "Format");
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
51
|
+
elemBefore: /*#__PURE__*/React.createElement(TaskIcon, {
|
|
52
|
+
label: ""
|
|
53
|
+
})
|
|
54
|
+
}, "Action item"), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
55
|
+
elemBefore: /*#__PURE__*/React.createElement(ListBulletedIcon, {
|
|
56
|
+
label: ""
|
|
57
|
+
})
|
|
58
|
+
}, "Bullet list")));
|
|
59
|
+
};
|
|
60
|
+
var BlockMenuContent = function BlockMenuContent() {
|
|
61
|
+
var setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
62
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
63
|
+
testId: "editor-block-menu",
|
|
64
|
+
ref: setOutsideClickTargetRef,
|
|
65
|
+
xcss: cx(styles.base)
|
|
66
|
+
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(FormatDropdown, null), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
67
|
+
elemBefore: /*#__PURE__*/React.createElement(JiraIcon, {
|
|
68
|
+
label: ""
|
|
69
|
+
})
|
|
70
|
+
}, "Create Jira work item")), /*#__PURE__*/React.createElement(DropdownItemGroup, {
|
|
71
|
+
hasSeparator: true
|
|
72
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
73
|
+
elemBefore: /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
74
|
+
label: ""
|
|
75
|
+
})
|
|
76
|
+
}, "Move up"), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
77
|
+
elemBefore: /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
78
|
+
label: ""
|
|
79
|
+
})
|
|
80
|
+
}, "Move down")), /*#__PURE__*/React.createElement(DropdownItemGroup, {
|
|
81
|
+
hasSeparator: true
|
|
82
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
83
|
+
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
84
|
+
label: ""
|
|
85
|
+
})
|
|
86
|
+
}, "Delete")));
|
|
87
|
+
};
|
|
88
|
+
var BlockMenu = function BlockMenu(_ref2) {
|
|
89
|
+
var _editorView$hasFocus, _editorView$dom;
|
|
90
|
+
var editorView = _ref2.editorView,
|
|
91
|
+
api = _ref2.api,
|
|
92
|
+
mountTo = _ref2.mountTo,
|
|
93
|
+
boundariesElement = _ref2.boundariesElement,
|
|
94
|
+
scrollableElement = _ref2.scrollableElement;
|
|
95
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockControls', 'userIntent'], function (states) {
|
|
96
|
+
var _states$blockControls, _states$blockControls2, _states$blockControls3, _states$userIntentSta;
|
|
97
|
+
return {
|
|
98
|
+
menuTriggerBy: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.menuTriggerBy,
|
|
99
|
+
isSelectedViaDragHandle: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.isSelectedViaDragHandle,
|
|
100
|
+
isMenuOpen: (_states$blockControls3 = states.blockControlsState) === null || _states$blockControls3 === void 0 ? void 0 : _states$blockControls3.isMenuOpen,
|
|
101
|
+
currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
|
|
102
|
+
};
|
|
103
|
+
}),
|
|
104
|
+
menuTriggerBy = _useSharedPluginState.menuTriggerBy,
|
|
105
|
+
isSelectedViaDragHandle = _useSharedPluginState.isSelectedViaDragHandle,
|
|
106
|
+
isMenuOpen = _useSharedPluginState.isMenuOpen,
|
|
107
|
+
currentUserIntent = _useSharedPluginState.currentUserIntent;
|
|
108
|
+
var hasFocus = (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
|
|
109
|
+
var hasSelection = !!editorView && !editorView.state.selection.empty;
|
|
110
|
+
if (!isMenuOpen) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
var closeMenu = function closeMenu() {
|
|
114
|
+
var _api$blockControls;
|
|
115
|
+
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({
|
|
116
|
+
closeMenu: true
|
|
117
|
+
}));
|
|
118
|
+
};
|
|
119
|
+
if (!menuTriggerBy || !isSelectedViaDragHandle || !hasFocus || !hasSelection || currentUserIntent === 'dragging') {
|
|
120
|
+
closeMenu();
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
var targetHandleRef = (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
|
|
124
|
+
if (targetHandleRef instanceof HTMLElement) {
|
|
125
|
+
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
126
|
+
alignX: 'left',
|
|
127
|
+
alignY: 'start',
|
|
128
|
+
handleClickOutside: closeMenu,
|
|
129
|
+
handleEscapeKeydown: closeMenu,
|
|
130
|
+
mountTo: mountTo,
|
|
131
|
+
boundariesElement: boundariesElement,
|
|
132
|
+
scrollableElement: scrollableElement,
|
|
133
|
+
target: targetHandleRef,
|
|
134
|
+
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
135
|
+
forcePlacement: true,
|
|
136
|
+
stick: true,
|
|
137
|
+
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_PADDING, 0]
|
|
138
|
+
}, /*#__PURE__*/React.createElement(BlockMenuContent, null));
|
|
139
|
+
} else {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
export default injectIntl(BlockMenu);
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
4
|
+
export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
5
|
+
dependencies: [OptionalPlugin<BlockControlsPlugin>, OptionalPlugin<UserIntentPlugin>];
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
6
|
+
type BlockMenuProps = {
|
|
7
|
+
editorView: EditorView | undefined;
|
|
8
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
9
|
+
mountTo?: HTMLElement;
|
|
10
|
+
boundariesElement?: HTMLElement;
|
|
11
|
+
scrollableElement?: HTMLElement;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<BlockMenuProps & WrappedComponentProps>> & {
|
|
14
|
+
WrappedComponent: React.ComponentType<BlockMenuProps & WrappedComponentProps>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
4
|
+
export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
5
|
+
dependencies: [
|
|
6
|
+
OptionalPlugin<BlockControlsPlugin>,
|
|
7
|
+
OptionalPlugin<UserIntentPlugin>
|
|
8
|
+
];
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
6
|
+
type BlockMenuProps = {
|
|
7
|
+
editorView: EditorView | undefined;
|
|
8
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
9
|
+
mountTo?: HTMLElement;
|
|
10
|
+
boundariesElement?: HTMLElement;
|
|
11
|
+
scrollableElement?: HTMLElement;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<BlockMenuProps & WrappedComponentProps>> & {
|
|
14
|
+
WrappedComponent: React.ComponentType<BlockMenuProps & WrappedComponentProps>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
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.2",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,15 +31,22 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@atlaskit/css": "^0.12.0",
|
|
35
|
+
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
36
|
+
"@atlaskit/editor-plugin-block-controls": "^4.1.0",
|
|
37
|
+
"@atlaskit/editor-plugin-user-intent": "^1.1.0",
|
|
34
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
|
+
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
40
|
+
"@atlaskit/icon": "^27.11.0",
|
|
41
|
+
"@atlaskit/icon-lab": "^5.4.0",
|
|
42
|
+
"@atlaskit/primitives": "^14.11.0",
|
|
43
|
+
"@atlaskit/tokens": "^6.0.0",
|
|
35
44
|
"@babel/runtime": "^7.0.0"
|
|
36
45
|
},
|
|
37
46
|
"peerDependencies": {
|
|
38
|
-
"@atlaskit/editor-common": "^107.
|
|
39
|
-
"react": "^18.2.0"
|
|
40
|
-
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"typescript": "~5.4.2"
|
|
47
|
+
"@atlaskit/editor-common": "^107.20.0",
|
|
48
|
+
"react": "^18.2.0",
|
|
49
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
43
50
|
},
|
|
44
51
|
"techstack": {
|
|
45
52
|
"@atlassian/frontend": {
|