@atlaskit/editor-plugin-block-controls 2.27.1 → 2.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/blockControlsPlugin.js +35 -6
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/cjs/ui/block-menu-items.js +103 -0
- package/dist/cjs/ui/block-menu.js +77 -0
- package/dist/cjs/ui/consts.js +101 -2
- package/dist/cjs/ui/drag-handle.js +146 -40
- package/dist/cjs/ui/drag-preview.js +83 -34
- package/dist/es2019/blockControlsPlugin.js +34 -3
- package/dist/es2019/pm-plugins/main.js +2 -1
- package/dist/es2019/ui/block-menu-items.js +92 -0
- package/dist/es2019/ui/block-menu.js +75 -0
- package/dist/es2019/ui/consts.js +100 -1
- package/dist/es2019/ui/drag-handle.js +150 -38
- package/dist/es2019/ui/drag-preview.js +83 -34
- package/dist/esm/blockControlsPlugin.js +35 -6
- package/dist/esm/pm-plugins/main.js +2 -1
- package/dist/esm/ui/block-menu-items.js +92 -0
- package/dist/esm/ui/block-menu.js +70 -0
- package/dist/esm/ui/consts.js +100 -1
- package/dist/esm/ui/drag-handle.js +147 -41
- package/dist/esm/ui/drag-preview.js +82 -34
- package/dist/types/blockControlsPluginType.d.ts +3 -0
- package/dist/types/pm-plugins/utils/getSelection.d.ts +2 -2
- package/dist/types/ui/block-menu-items.d.ts +17 -0
- package/dist/types/ui/block-menu.d.ts +16 -0
- package/dist/types/ui/consts.d.ts +7 -0
- package/dist/types/ui/drag-preview.d.ts +9 -1
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/utils/getSelection.d.ts +2 -2
- package/dist/types-ts4.5/ui/block-menu-items.d.ts +17 -0
- package/dist/types-ts4.5/ui/block-menu.d.ts +16 -0
- package/dist/types-ts4.5/ui/consts.d.ts +7 -0
- package/dist/types-ts4.5/ui/drag-preview.d.ts +9 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.27.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#115469](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115469)
|
|
8
|
+
[`ab16802b3f404`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ab16802b3f404) -
|
|
9
|
+
Implement move functionality in block menu
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.27.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 2.27.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#114482](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114482)
|
|
23
|
+
[`4f000d73e6b03`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4f000d73e6b03) -
|
|
24
|
+
Patch to fix page crash in drag handle tooltip logic
|
|
25
|
+
- [#110314](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110314)
|
|
26
|
+
[`63ac551fb3345`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/63ac551fb3345) -
|
|
27
|
+
[ux] ED-26271: Content preview for multi-select
|
|
28
|
+
- [#114618](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114618)
|
|
29
|
+
[`9976feceb2007`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9976feceb2007) -
|
|
30
|
+
[ux] Implement initial UI for Block menu
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 2.27.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -9,9 +9,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
13
|
var _moveNode = require("./editor-commands/move-node");
|
|
13
14
|
var _moveToLayout = require("./editor-commands/move-to-layout");
|
|
14
15
|
var _main = require("./pm-plugins/main");
|
|
16
|
+
var _blockMenu = _interopRequireDefault(require("./ui/block-menu"));
|
|
15
17
|
var _dragHandleMenu = require("./ui/drag-handle-menu");
|
|
16
18
|
var _globalStyles = require("./ui/global-styles");
|
|
17
19
|
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; }
|
|
@@ -43,14 +45,31 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
43
45
|
anchorName: anchorName,
|
|
44
46
|
nodeType: nodeType,
|
|
45
47
|
handleOptions: handleOptions
|
|
46
|
-
}
|
|
48
|
+
},
|
|
49
|
+
closeMenu: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? true : undefined
|
|
47
50
|
}));
|
|
48
51
|
return tr;
|
|
49
52
|
};
|
|
50
53
|
},
|
|
51
|
-
|
|
54
|
+
toggleBlockMenu: function toggleBlockMenu(options) {
|
|
52
55
|
return function (_ref4) {
|
|
53
56
|
var tr = _ref4.tr;
|
|
57
|
+
var currMeta = tr.getMeta(_main.key);
|
|
58
|
+
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
59
|
+
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
60
|
+
closeMenu: true
|
|
61
|
+
}));
|
|
62
|
+
return tr;
|
|
63
|
+
}
|
|
64
|
+
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
65
|
+
toggleMenu: true
|
|
66
|
+
}));
|
|
67
|
+
return tr;
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
71
|
+
return function (_ref5) {
|
|
72
|
+
var tr = _ref5.tr;
|
|
54
73
|
var pos = getPos();
|
|
55
74
|
if (pos === undefined) {
|
|
56
75
|
return tr;
|
|
@@ -68,9 +87,9 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
68
87
|
};
|
|
69
88
|
},
|
|
70
89
|
setMultiSelectPositions: function setMultiSelectPositions(anchor, head) {
|
|
71
|
-
return function (
|
|
90
|
+
return function (_ref6) {
|
|
72
91
|
var _api$selection;
|
|
73
|
-
var tr =
|
|
92
|
+
var tr = _ref6.tr;
|
|
74
93
|
var _tr$selection = tr.selection,
|
|
75
94
|
userAnchor = _tr$selection.anchor,
|
|
76
95
|
userHead = _tr$selection.head;
|
|
@@ -118,8 +137,18 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
118
137
|
multiSelectDnD: (_key$getState$multiSe = (_key$getState5 = _main.key.getState(editorState)) === null || _key$getState5 === void 0 ? void 0 : _key$getState5.multiSelectDnD) !== null && _key$getState$multiSe !== void 0 ? _key$getState$multiSe : undefined
|
|
119
138
|
};
|
|
120
139
|
},
|
|
121
|
-
contentComponent: function contentComponent() {
|
|
122
|
-
|
|
140
|
+
contentComponent: function contentComponent(_ref7) {
|
|
141
|
+
var editorView = _ref7.editorView,
|
|
142
|
+
popupsMountPoint = _ref7.popupsMountPoint,
|
|
143
|
+
popupsBoundariesElement = _ref7.popupsBoundariesElement,
|
|
144
|
+
popupsScrollableElement = _ref7.popupsScrollableElement;
|
|
145
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? /*#__PURE__*/_react.default.createElement(_blockMenu.default, {
|
|
146
|
+
editorView: editorView,
|
|
147
|
+
mountPoint: popupsMountPoint,
|
|
148
|
+
boundariesElement: popupsBoundariesElement,
|
|
149
|
+
scrollableElement: popupsScrollableElement,
|
|
150
|
+
api: api
|
|
151
|
+
}) : /*#__PURE__*/_react.default.createElement(_dragHandleMenu.DragHandleMenu, {
|
|
123
152
|
api: api
|
|
124
153
|
}), /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null));
|
|
125
154
|
}
|
|
@@ -282,11 +282,12 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
var newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && (0, _decorationsDragHandle.findHandleDec)(decorations, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos).length === 0 ? null : latestActiveNode;
|
|
285
|
+
var isMenuOpenNew = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? meta !== null && meta !== void 0 && meta.closeMenu ? false : meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen : meta !== null && meta !== void 0 && meta.toggleMenu ? !isMenuOpen : isMenuOpen;
|
|
285
286
|
return {
|
|
286
287
|
decorations: decorations,
|
|
287
288
|
activeNode: newActiveNode,
|
|
288
289
|
isDragging: (_meta$isDragging2 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging2 !== void 0 ? _meta$isDragging2 : isDragging,
|
|
289
|
-
isMenuOpen:
|
|
290
|
+
isMenuOpen: isMenuOpenNew,
|
|
290
291
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
291
292
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
292
293
|
editorWidthRight: (_meta$editorWidthRigh = meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== null && _meta$editorWidthRigh !== void 0 ? _meta$editorWidthRigh : editorWidthRight,
|
|
@@ -0,0 +1,103 @@
|
|
|
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.menuItemsCallback = exports.getBlockMenuItems = void 0;
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
11
|
+
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
12
|
+
var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
13
|
+
var _arrowDown = _interopRequireDefault(require("@atlaskit/icon/core/arrow-down"));
|
|
14
|
+
var _arrowUp = _interopRequireDefault(require("@atlaskit/icon/core/arrow-up"));
|
|
15
|
+
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
16
|
+
var _delete2 = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
17
|
+
var _moveNode = require("../editor-commands/move-node");
|
|
18
|
+
var _consts = require("../pm-plugins/utils/consts");
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
22
|
+
/**
|
|
23
|
+
* @jsxRuntime classic
|
|
24
|
+
* @jsx jsx
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
28
|
+
|
|
29
|
+
var getBlockMenuItems = exports.getBlockMenuItems = function getBlockMenuItems(formatMessage) {
|
|
30
|
+
return [{
|
|
31
|
+
items: [{
|
|
32
|
+
content: formatMessage(_messages.blockControlsMessages.moveUp),
|
|
33
|
+
elemBefore: (0, _react.jsx)(_arrowUp.default, {
|
|
34
|
+
label: ""
|
|
35
|
+
}),
|
|
36
|
+
value: {
|
|
37
|
+
name: 'moveUp'
|
|
38
|
+
},
|
|
39
|
+
key: 'move_up',
|
|
40
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
41
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
42
|
+
css: _shortcut.shortcutStyle
|
|
43
|
+
}, (0, _keymaps.tooltip)(_keymaps.dragToMoveUp))
|
|
44
|
+
}, {
|
|
45
|
+
content: formatMessage(_messages.blockControlsMessages.moveDown),
|
|
46
|
+
elemBefore: (0, _react.jsx)(_arrowDown.default, {
|
|
47
|
+
label: ""
|
|
48
|
+
}),
|
|
49
|
+
value: {
|
|
50
|
+
name: 'moveDown'
|
|
51
|
+
},
|
|
52
|
+
key: 'move_down',
|
|
53
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
54
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
55
|
+
css: _shortcut.shortcutStyle
|
|
56
|
+
}, (0, _keymaps.tooltip)(_keymaps.dragToMoveDown))
|
|
57
|
+
}]
|
|
58
|
+
}, {
|
|
59
|
+
items: [{
|
|
60
|
+
content: formatMessage(_messages.default.copyToClipboard),
|
|
61
|
+
value: {
|
|
62
|
+
name: 'copy'
|
|
63
|
+
},
|
|
64
|
+
elemBefore: (0, _react.jsx)(_copy.default, {
|
|
65
|
+
label: ""
|
|
66
|
+
}),
|
|
67
|
+
key: 'copy',
|
|
68
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
69
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
70
|
+
css: _shortcut.shortcutStyle
|
|
71
|
+
}, (0, _keymaps.tooltip)(_keymaps.copy))
|
|
72
|
+
}, {
|
|
73
|
+
content: formatMessage(_messages.blockControlsMessages.delete),
|
|
74
|
+
value: {
|
|
75
|
+
name: 'delete'
|
|
76
|
+
},
|
|
77
|
+
elemBefore: (0, _react.jsx)(_delete2.default, {
|
|
78
|
+
label: ""
|
|
79
|
+
}),
|
|
80
|
+
key: 'delete',
|
|
81
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
82
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
83
|
+
css: _shortcut.shortcutStyle
|
|
84
|
+
}, (0, _keymaps.tooltip)(_keymaps.deleteKey))
|
|
85
|
+
}]
|
|
86
|
+
}];
|
|
87
|
+
};
|
|
88
|
+
var menuItemsCallback = exports.menuItemsCallback = {
|
|
89
|
+
moveUp: function moveUp(api, formatMessage) {
|
|
90
|
+
return (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.UP, formatMessage);
|
|
91
|
+
},
|
|
92
|
+
moveDown: function moveDown(api, formatMessage) {
|
|
93
|
+
return (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.DOWN, formatMessage);
|
|
94
|
+
},
|
|
95
|
+
copy: function copy() {
|
|
96
|
+
// TODO: implement copy
|
|
97
|
+
// console.log('copy');
|
|
98
|
+
},
|
|
99
|
+
delete: function _delete() {
|
|
100
|
+
// TODO: implement delete
|
|
101
|
+
// console.log('delete');
|
|
102
|
+
}
|
|
103
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
13
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
+
var _blockMenuItems = require("./block-menu-items");
|
|
15
|
+
var _consts = require("./consts");
|
|
16
|
+
var dragHandleSelector = '[data-blocks-drag-handle-container="true"] button';
|
|
17
|
+
var BlockMenu = function BlockMenu(_ref) {
|
|
18
|
+
var editorView = _ref.editorView,
|
|
19
|
+
mountPoint = _ref.mountPoint,
|
|
20
|
+
boundariesElement = _ref.boundariesElement,
|
|
21
|
+
scrollableElement = _ref.scrollableElement,
|
|
22
|
+
api = _ref.api,
|
|
23
|
+
formatMessage = _ref.intl.formatMessage;
|
|
24
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['blockControls']),
|
|
25
|
+
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
26
|
+
if (!(blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
var targetHandleRef = document.querySelector(dragHandleSelector);
|
|
30
|
+
var items = (0, _blockMenuItems.getBlockMenuItems)(formatMessage);
|
|
31
|
+
var handleOpenChange = function handleOpenChange(payload) {
|
|
32
|
+
if (!(payload !== null && payload !== void 0 && payload.isOpen)) {
|
|
33
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
34
|
+
closeMenu: true
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var onMenuItemActivated = function onMenuItemActivated(_ref2) {
|
|
39
|
+
var item = _ref2.item;
|
|
40
|
+
if (editorView) {
|
|
41
|
+
var _menuItemsCallback, _menuItemsCallback$ca;
|
|
42
|
+
(_menuItemsCallback = _blockMenuItems.menuItemsCallback[item.value.name]) === null || _menuItemsCallback === void 0 || (_menuItemsCallback$ca = _menuItemsCallback.call(_blockMenuItems.menuItemsCallback, api, formatMessage)) === null || _menuItemsCallback$ca === void 0 || _menuItemsCallback$ca(editorView.state, editorView.dispatch, editorView);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
46
|
+
alignX: 'right',
|
|
47
|
+
alignY: 'start'
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
50
|
+
,
|
|
51
|
+
target: targetHandleRef,
|
|
52
|
+
mountTo: undefined,
|
|
53
|
+
zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
|
|
54
|
+
forcePlacement: true,
|
|
55
|
+
stick: true,
|
|
56
|
+
offset: [-18, 8]
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_uiMenu.DropdownMenu, {
|
|
58
|
+
mountTo: mountPoint,
|
|
59
|
+
boundariesElement: boundariesElement,
|
|
60
|
+
scrollableElement: scrollableElement
|
|
61
|
+
//This needs be removed when the a11y is completely handled
|
|
62
|
+
//Disabling key navigation now as it works only partially
|
|
63
|
+
,
|
|
64
|
+
arrowKeyNavigationProviderOptions: {
|
|
65
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
66
|
+
},
|
|
67
|
+
items: items,
|
|
68
|
+
isOpen: true,
|
|
69
|
+
fitWidth: _consts.BLOCK_MENU_WIDTH,
|
|
70
|
+
section: {
|
|
71
|
+
hasSeparator: true
|
|
72
|
+
},
|
|
73
|
+
onOpenChange: handleOpenChange,
|
|
74
|
+
onItemActivated: onMenuItemActivated
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(BlockMenu);
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.topPositionAdjustment = exports.spaceLookupMap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = void 0;
|
|
7
|
+
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_MENU_WIDTH = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -111,6 +111,104 @@ Array.from({
|
|
|
111
111
|
}, 1000);
|
|
112
112
|
return [currKeyValue, dropTargetMarginMap[value]];
|
|
113
113
|
}));
|
|
114
|
+
var spacingBetweenNodesForPreview = exports.spacingBetweenNodesForPreview = {
|
|
115
|
+
paragraph: {
|
|
116
|
+
top: '0.75rem',
|
|
117
|
+
bottom: '0'
|
|
118
|
+
},
|
|
119
|
+
heading1: {
|
|
120
|
+
top: '1.45833em',
|
|
121
|
+
bottom: '0'
|
|
122
|
+
},
|
|
123
|
+
heading2: {
|
|
124
|
+
top: '1.4em',
|
|
125
|
+
bottom: '0'
|
|
126
|
+
},
|
|
127
|
+
heading3: {
|
|
128
|
+
top: '1.31249em',
|
|
129
|
+
bottom: '0'
|
|
130
|
+
},
|
|
131
|
+
heading4: {
|
|
132
|
+
top: '1.25em',
|
|
133
|
+
bottom: '0'
|
|
134
|
+
},
|
|
135
|
+
heading5: {
|
|
136
|
+
top: '1.45833em',
|
|
137
|
+
bottom: '0'
|
|
138
|
+
},
|
|
139
|
+
heading6: {
|
|
140
|
+
top: '1.59091em',
|
|
141
|
+
bottom: '0'
|
|
142
|
+
},
|
|
143
|
+
table: {
|
|
144
|
+
top: '0',
|
|
145
|
+
bottom: '0'
|
|
146
|
+
},
|
|
147
|
+
bulletList: {
|
|
148
|
+
top: '10px',
|
|
149
|
+
bottom: '0'
|
|
150
|
+
},
|
|
151
|
+
orderedList: {
|
|
152
|
+
top: '10px',
|
|
153
|
+
bottom: '0'
|
|
154
|
+
},
|
|
155
|
+
decisionList: {
|
|
156
|
+
top: '0.5rem',
|
|
157
|
+
bottom: '0'
|
|
158
|
+
},
|
|
159
|
+
taskList: {
|
|
160
|
+
top: '0.75rem',
|
|
161
|
+
bottom: '0'
|
|
162
|
+
},
|
|
163
|
+
codeBlock: {
|
|
164
|
+
top: '0.75rem',
|
|
165
|
+
bottom: '0'
|
|
166
|
+
},
|
|
167
|
+
panel: {
|
|
168
|
+
top: '0.75rem',
|
|
169
|
+
bottom: '0'
|
|
170
|
+
},
|
|
171
|
+
rule: {
|
|
172
|
+
top: '1.5rem',
|
|
173
|
+
bottom: '1.5rem'
|
|
174
|
+
},
|
|
175
|
+
mediaSingle: {
|
|
176
|
+
top: '24px',
|
|
177
|
+
bottom: '24px'
|
|
178
|
+
},
|
|
179
|
+
media: {
|
|
180
|
+
top: '24px',
|
|
181
|
+
bottom: '24px'
|
|
182
|
+
},
|
|
183
|
+
bodiedExtension: {
|
|
184
|
+
top: '0',
|
|
185
|
+
bottom: '0'
|
|
186
|
+
},
|
|
187
|
+
extension: {
|
|
188
|
+
top: '0',
|
|
189
|
+
bottom: '0'
|
|
190
|
+
},
|
|
191
|
+
layoutSection: {
|
|
192
|
+
top: '0',
|
|
193
|
+
bottom: '0'
|
|
194
|
+
},
|
|
195
|
+
blockquote: {
|
|
196
|
+
top: '0',
|
|
197
|
+
bottom: '0'
|
|
198
|
+
},
|
|
199
|
+
embedCard: {
|
|
200
|
+
top: '24px',
|
|
201
|
+
bottom: '24px'
|
|
202
|
+
},
|
|
203
|
+
blockCard: {
|
|
204
|
+
top: '0.75rem',
|
|
205
|
+
bottom: '0'
|
|
206
|
+
},
|
|
207
|
+
default: {
|
|
208
|
+
top: '0',
|
|
209
|
+
bottom: '0'
|
|
210
|
+
}
|
|
211
|
+
};
|
|
114
212
|
|
|
115
213
|
// This table contains the "margins" of different nodes
|
|
116
214
|
// Note this is not the actually margin of the DOM elements,
|
|
@@ -212,4 +310,5 @@ var DEFAULT_COLUMN_DISTRIBUTIONS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = {
|
|
|
212
310
|
3: 33.33,
|
|
213
311
|
4: 25,
|
|
214
312
|
5: 20
|
|
215
|
-
};
|
|
313
|
+
};
|
|
314
|
+
var BLOCK_MENU_WIDTH = exports.BLOCK_MENU_WIDTH = 220;
|