@atlaskit/editor-plugin-layout 10.7.1 → 10.8.0
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 +11 -0
- package/dist/cjs/pm-plugins/utils/layout-column-selection.js +4 -3
- package/dist/cjs/ui/LayoutColumnMenu/VerticalAlignDropdownItem.js +2 -1
- package/dist/cjs/ui/LayoutColumnMenu/VerticalAlignNestedMenu.js +1 -4
- package/dist/cjs/ui/LayoutColumnMenu/components.js +18 -8
- package/dist/cjs/ui/LayoutColumnMenu/index.js +3 -36
- package/dist/es2019/pm-plugins/utils/layout-column-selection.js +4 -1
- package/dist/es2019/ui/LayoutColumnMenu/VerticalAlignDropdownItem.js +2 -1
- package/dist/es2019/ui/LayoutColumnMenu/VerticalAlignNestedMenu.js +2 -5
- package/dist/es2019/ui/LayoutColumnMenu/components.js +11 -2
- package/dist/es2019/ui/LayoutColumnMenu/index.js +5 -33
- package/dist/esm/pm-plugins/utils/layout-column-selection.js +4 -3
- package/dist/esm/ui/LayoutColumnMenu/VerticalAlignDropdownItem.js +2 -1
- package/dist/esm/ui/LayoutColumnMenu/VerticalAlignNestedMenu.js +2 -5
- package/dist/esm/ui/LayoutColumnMenu/components.js +16 -8
- package/dist/esm/ui/LayoutColumnMenu/index.js +5 -37
- package/dist/types/pm-plugins/actions.d.ts +1 -1
- package/dist/types/pm-plugins/utils/layout-column-selection.d.ts +1 -1
- package/dist/types/ui/LayoutColumnMenu/VerticalAlignDropdownItem.d.ts +4 -6
- package/dist/types/ui/LayoutColumnMenu/verticalAlignIcons.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/layout-column-selection.d.ts +1 -1
- package/dist/types-ts4.5/ui/LayoutColumnMenu/VerticalAlignDropdownItem.d.ts +4 -6
- package/dist/types-ts4.5/ui/LayoutColumnMenu/verticalAlignIcons.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 10.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1c86d46da6101`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1c86d46da6101) -
|
|
8
|
+
Address layout column alignment follow-up review feedback
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 10.7.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -112,7 +112,8 @@ var getLayoutSectionColumnCount = exports.getLayoutSectionColumnCount = function
|
|
|
112
112
|
return (layoutSection === null || layoutSection === void 0 ? void 0 : layoutSection.type.name) === 'layoutSection' ? layoutSection.childCount : 0;
|
|
113
113
|
};
|
|
114
114
|
var getLayoutColumnValign = exports.getLayoutColumnValign = function getLayoutColumnValign(layoutColumn) {
|
|
115
|
-
|
|
115
|
+
var _ref2;
|
|
116
|
+
return layoutColumn ? (_ref2 = layoutColumn.attrs.valign) !== null && _ref2 !== void 0 ? _ref2 : 'top' : undefined;
|
|
116
117
|
};
|
|
117
118
|
var getLayoutColumnMenuAnchorPos = exports.getLayoutColumnMenuAnchorPos = function getLayoutColumnMenuAnchorPos(selection, anchorPosFromHandle) {
|
|
118
119
|
var _clickedSelectedColum, _selectedLayoutColumn;
|
|
@@ -120,8 +121,8 @@ var getLayoutColumnMenuAnchorPos = exports.getLayoutColumnMenuAnchorPos = functi
|
|
|
120
121
|
if (!selectedLayoutColumns) {
|
|
121
122
|
return undefined;
|
|
122
123
|
}
|
|
123
|
-
var clickedSelectedColumn = selectedLayoutColumns.selectedColumns.find(function (
|
|
124
|
-
var pos =
|
|
124
|
+
var clickedSelectedColumn = selectedLayoutColumns.selectedColumns.find(function (_ref3) {
|
|
125
|
+
var pos = _ref3.pos;
|
|
125
126
|
return pos === anchorPosFromHandle;
|
|
126
127
|
});
|
|
127
128
|
return (_clickedSelectedColum = clickedSelectedColumn === null || clickedSelectedColumn === void 0 ? void 0 : clickedSelectedColumn.pos) !== null && _clickedSelectedColum !== void 0 ? _clickedSelectedColum : (_selectedLayoutColumn = selectedLayoutColumns.selectedColumns[0]) === null || _selectedLayoutColumn === void 0 ? void 0 : _selectedLayoutColumn.pos;
|
|
@@ -31,10 +31,7 @@ var VerticalAlignNestedMenu = exports.VerticalAlignNestedMenu = function Vertica
|
|
|
31
31
|
}
|
|
32
32
|
return firstValign;
|
|
33
33
|
}, [selectedLayoutColumns]);
|
|
34
|
-
var TriggerIcon = currentValign ? _verticalAlignIcons.VERTICAL_ALIGN_ICONS[currentValign] :
|
|
35
|
-
if (!selectedLayoutColumns) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
34
|
+
var TriggerIcon = currentValign ? _verticalAlignIcons.VERTICAL_ALIGN_ICONS[currentValign] : _verticalAlignIcons.VERTICAL_ALIGN_ICONS.top;
|
|
38
35
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarNestedDropdownMenu, {
|
|
39
36
|
elemBefore: /*#__PURE__*/_react.default.createElement(TriggerIcon, {
|
|
40
37
|
label: "",
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.getLayoutColumnMenuComponents = exports.LAYOUT_COLUMN_MENU_FALLBACKS = void 0;
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
11
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
14
|
var _toolbarMenuContainer = require("@atlaskit/editor-toolbar/toolbar-menu-container");
|
|
13
15
|
var _DeleteColumnDropdownItem = require("./DeleteColumnDropdownItem");
|
|
@@ -16,18 +18,26 @@ var _InsertColumnDropdownItem = require("./InsertColumnDropdownItem");
|
|
|
16
18
|
var _keys = require("./keys");
|
|
17
19
|
var _VerticalAlignDropdownItem = require("./VerticalAlignDropdownItem");
|
|
18
20
|
var _VerticalAlignNestedMenu = require("./VerticalAlignNestedMenu");
|
|
21
|
+
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
22
|
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; }
|
|
20
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
var LayoutColumnMenuContainer = function LayoutColumnMenuContainer(_ref) {
|
|
25
|
+
var children = _ref.children;
|
|
26
|
+
var setOutsideClickTargetRef = (0, _react.useContext)(_uiReact.OutsideClickTargetRefContext);
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarMenuContainer.ToolbarMenuContainer, {
|
|
28
|
+
ref: setOutsideClickTargetRef
|
|
29
|
+
}, children);
|
|
30
|
+
};
|
|
21
31
|
var LAYOUT_COLUMN_MENU_FALLBACKS = exports.LAYOUT_COLUMN_MENU_FALLBACKS = {
|
|
22
|
-
'menu-section': function menuSection(
|
|
23
|
-
var children =
|
|
32
|
+
'menu-section': function menuSection(_ref2) {
|
|
33
|
+
var children = _ref2.children;
|
|
24
34
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, children);
|
|
25
35
|
}
|
|
26
36
|
};
|
|
27
|
-
var getLayoutColumnMenuComponents = exports.getLayoutColumnMenuComponents = function getLayoutColumnMenuComponents(
|
|
28
|
-
var api =
|
|
37
|
+
var getLayoutColumnMenuComponents = exports.getLayoutColumnMenuComponents = function getLayoutColumnMenuComponents(_ref3) {
|
|
38
|
+
var api = _ref3.api;
|
|
29
39
|
return [_objectSpread(_objectSpread({}, _keys.LAYOUT_COLUMN_MENU), {}, {
|
|
30
|
-
component:
|
|
40
|
+
component: LayoutColumnMenuContainer
|
|
31
41
|
}), _objectSpread(_objectSpread({}, _keys.LAYOUT_COLUMN_MENU_SECTION), {}, {
|
|
32
42
|
parents: [_objectSpread(_objectSpread({}, _keys.LAYOUT_COLUMN_MENU), {}, {
|
|
33
43
|
rank: _keys.LAYOUT_COLUMN_MENU_RANK[_keys.LAYOUT_COLUMN_MENU_SECTION.key]
|
|
@@ -71,8 +81,8 @@ var getLayoutColumnMenuComponents = exports.getLayoutColumnMenuComponents = func
|
|
|
71
81
|
rank: _keys.LAYOUT_COLUMN_MENU_SECTION_RANK[_keys.DELETE_COLUMN_MENU_ITEM.key]
|
|
72
82
|
})]
|
|
73
83
|
}), _objectSpread(_objectSpread({}, _keys.VERTICAL_ALIGN_MENU), {}, {
|
|
74
|
-
component: function component(
|
|
75
|
-
var children =
|
|
84
|
+
component: function component(_ref4) {
|
|
85
|
+
var children = _ref4.children;
|
|
76
86
|
return /*#__PURE__*/_react.default.createElement(_VerticalAlignNestedMenu.VerticalAlignNestedMenu, {
|
|
77
87
|
api: api
|
|
78
88
|
}, children);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.LayoutColumnMenu = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
|
-
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
12
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
16
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -21,8 +18,8 @@ var _components = require("./components");
|
|
|
21
18
|
var _keys = require("./keys");
|
|
22
19
|
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); }
|
|
23
20
|
var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
|
|
24
|
-
var FALLBACK_MENU_HEIGHT = 300;
|
|
25
21
|
var LAYOUT_COLUMN_MENU_POPUP_OFFSET = [0, 4];
|
|
22
|
+
var TOOLBAR_MENU_SELECTOR = '[data-toolbar-component="menu"]';
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* Returns the drag handle button for the selected layout column.
|
|
@@ -58,20 +55,6 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
|
|
|
58
55
|
isLayoutColumnMenuOpen = _useSharedPluginState.isLayoutColumnMenuOpen,
|
|
59
56
|
layoutColumnMenuAnchorPos = _useSharedPluginState.layoutColumnMenuAnchorPos,
|
|
60
57
|
selection = _useSharedPluginState.selection;
|
|
61
|
-
var setOutsideClickTargetRef = (0, _react.useContext)(_uiReact.OutsideClickTargetRefContext);
|
|
62
|
-
var menuRef = (0, _react.useRef)(null);
|
|
63
|
-
var popupRef = (0, _react.useRef)(undefined);
|
|
64
|
-
var _React$useState = _react.default.useState(FALLBACK_MENU_HEIGHT),
|
|
65
|
-
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
66
|
-
menuHeight = _React$useState2[0],
|
|
67
|
-
setMenuHeight = _React$useState2[1];
|
|
68
|
-
(0, _react.useLayoutEffect)(function () {
|
|
69
|
-
var _popupRef$current;
|
|
70
|
-
if (!isLayoutColumnMenuOpen) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
setMenuHeight(((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.clientHeight) || FALLBACK_MENU_HEIGHT);
|
|
74
|
-
}, [isLayoutColumnMenuOpen]);
|
|
75
58
|
var closeLayoutColumnMenu = (0, _react.useCallback)(function () {
|
|
76
59
|
var _api$core, _api$layout;
|
|
77
60
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.toggleLayoutColumnMenu({
|
|
@@ -79,11 +62,7 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
|
|
|
79
62
|
}));
|
|
80
63
|
}, [api]);
|
|
81
64
|
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
82
|
-
|
|
83
|
-
if (event.target instanceof Node && (_menuRef$current = menuRef.current) !== null && _menuRef$current !== void 0 && _menuRef$current.contains(event.target)) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (event.target instanceof Element && event.target.closest('[data-toolbar-nested-dropdown-menu]')) {
|
|
65
|
+
if (event.target instanceof Element && (event.target.closest(TOOLBAR_MENU_SELECTOR) || event.target.closest('[data-toolbar-nested-dropdown-menu]'))) {
|
|
87
66
|
return;
|
|
88
67
|
}
|
|
89
68
|
|
|
@@ -100,13 +79,6 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
|
|
|
100
79
|
closeLayoutColumnMenu();
|
|
101
80
|
}
|
|
102
81
|
}, [closeLayoutColumnMenu]);
|
|
103
|
-
var handleMenuRef = (0, _react.useCallback)(function (el) {
|
|
104
|
-
setOutsideClickTargetRef === null || setOutsideClickTargetRef === void 0 || setOutsideClickTargetRef(el);
|
|
105
|
-
menuRef.current = el;
|
|
106
|
-
if (el) {
|
|
107
|
-
popupRef.current = el;
|
|
108
|
-
}
|
|
109
|
-
}, [setOutsideClickTargetRef]);
|
|
110
82
|
var components = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(_keys.LAYOUT_COLUMN_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
111
83
|
var target = (0, _react.useMemo)(function () {
|
|
112
84
|
return isLayoutColumnMenuOpen ? getLayoutColumnMenuTarget(editorView, selection, layoutColumnMenuAnchorPos) : null;
|
|
@@ -127,16 +99,11 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
|
|
|
127
99
|
scrollableElement: scrollableElement,
|
|
128
100
|
zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
|
|
129
101
|
alignX: "center",
|
|
130
|
-
fitHeight: menuHeight,
|
|
131
102
|
preventOverflow: true,
|
|
132
103
|
stick: true,
|
|
133
104
|
offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET,
|
|
134
105
|
handleClickOutside: handleClickOutside,
|
|
135
106
|
handleEscapeKeydown: closeLayoutColumnMenu
|
|
136
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
-
ref: handleMenuRef
|
|
138
|
-
}, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarProvider, {
|
|
139
|
-
editorView: editorView
|
|
140
107
|
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenuProvider, {
|
|
141
108
|
isOpen: isLayoutColumnMenuOpen,
|
|
142
109
|
setIsOpen: handleSetIsOpen
|
|
@@ -144,5 +111,5 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
|
|
|
144
111
|
components: components,
|
|
145
112
|
fallbacks: _components.LAYOUT_COLUMN_MENU_FALLBACKS,
|
|
146
113
|
surface: _keys.LAYOUT_COLUMN_MENU
|
|
147
|
-
})))
|
|
114
|
+
})));
|
|
148
115
|
});
|
|
@@ -104,7 +104,10 @@ export const getSelectedLayoutColumns = selection => {
|
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
106
|
export const getLayoutSectionColumnCount = layoutSection => (layoutSection === null || layoutSection === void 0 ? void 0 : layoutSection.type.name) === 'layoutSection' ? layoutSection.childCount : 0;
|
|
107
|
-
export const getLayoutColumnValign = layoutColumn =>
|
|
107
|
+
export const getLayoutColumnValign = layoutColumn => {
|
|
108
|
+
var _ref;
|
|
109
|
+
return layoutColumn ? (_ref = layoutColumn.attrs.valign) !== null && _ref !== void 0 ? _ref : 'top' : undefined;
|
|
110
|
+
};
|
|
108
111
|
export const getLayoutColumnMenuAnchorPos = (selection, anchorPosFromHandle) => {
|
|
109
112
|
var _clickedSelectedColum, _selectedLayoutColumn;
|
|
110
113
|
const selectedLayoutColumns = getSelectedLayoutColumns(selection);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import {
|
|
4
|
+
import { NestedDropdownRightIcon, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import { getLayoutColumnValign } from '../../pm-plugins/utils/layout-column-selection';
|
|
6
6
|
import { useSelectedLayoutColumns } from './useSelectedLayoutColumns';
|
|
7
7
|
import { VERTICAL_ALIGN_ICONS } from './verticalAlignIcons';
|
|
@@ -24,10 +24,7 @@ export const VerticalAlignNestedMenu = ({
|
|
|
24
24
|
}
|
|
25
25
|
return firstValign;
|
|
26
26
|
}, [selectedLayoutColumns]);
|
|
27
|
-
const TriggerIcon = currentValign ? VERTICAL_ALIGN_ICONS[currentValign] :
|
|
28
|
-
if (!selectedLayoutColumns) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
27
|
+
const TriggerIcon = currentValign ? VERTICAL_ALIGN_ICONS[currentValign] : VERTICAL_ALIGN_ICONS.top;
|
|
31
28
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
32
29
|
elemBefore: /*#__PURE__*/React.createElement(TriggerIcon, {
|
|
33
30
|
label: "",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { OutsideClickTargetRefContext } from '@atlaskit/editor-common/ui-react';
|
|
3
4
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
5
|
import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
|
|
5
6
|
import { DeleteColumnDropdownItem } from './DeleteColumnDropdownItem';
|
|
@@ -8,6 +9,14 @@ import { InsertColumnDropdownItem } from './InsertColumnDropdownItem';
|
|
|
8
9
|
import { DELETE_COLUMN_MENU_ITEM, DISTRIBUTE_COLUMNS_MENU_ITEM, INSERT_COLUMN_LEFT_MENU_ITEM, INSERT_COLUMN_RIGHT_MENU_ITEM, LAYOUT_COLUMN_MENU, LAYOUT_COLUMN_MENU_RANK, LAYOUT_COLUMN_MENU_SECTION, LAYOUT_COLUMN_MENU_SECTION_RANK, LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_BOTTOM_MENU_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_MENU_ITEM, VERTICAL_ALIGN_TOP_MENU_ITEM } from './keys';
|
|
9
10
|
import { VerticalAlignDropdownItem } from './VerticalAlignDropdownItem';
|
|
10
11
|
import { VerticalAlignNestedMenu } from './VerticalAlignNestedMenu';
|
|
12
|
+
const LayoutColumnMenuContainer = ({
|
|
13
|
+
children
|
|
14
|
+
}) => {
|
|
15
|
+
const setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
16
|
+
return /*#__PURE__*/React.createElement(ToolbarMenuContainer, {
|
|
17
|
+
ref: setOutsideClickTargetRef
|
|
18
|
+
}, children);
|
|
19
|
+
};
|
|
11
20
|
export const LAYOUT_COLUMN_MENU_FALLBACKS = {
|
|
12
21
|
'menu-section': ({
|
|
13
22
|
children
|
|
@@ -18,7 +27,7 @@ export const getLayoutColumnMenuComponents = ({
|
|
|
18
27
|
}) => {
|
|
19
28
|
return [{
|
|
20
29
|
...LAYOUT_COLUMN_MENU,
|
|
21
|
-
component:
|
|
30
|
+
component: LayoutColumnMenuContainer
|
|
22
31
|
}, {
|
|
23
32
|
...LAYOUT_COLUMN_MENU_SECTION,
|
|
24
33
|
parents: [{
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
1
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
4
|
-
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar';
|
|
5
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
6
|
-
import {
|
|
5
|
+
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
7
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
8
7
|
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
@@ -11,8 +10,8 @@ import { getLayoutColumnMenuAnchorPos } from '../../pm-plugins/utils/layout-colu
|
|
|
11
10
|
import { LAYOUT_COLUMN_MENU_FALLBACKS } from './components';
|
|
12
11
|
import { LAYOUT_COLUMN_MENU } from './keys';
|
|
13
12
|
const PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
14
|
-
const FALLBACK_MENU_HEIGHT = 300;
|
|
15
13
|
const LAYOUT_COLUMN_MENU_POPUP_OFFSET = [0, 4];
|
|
14
|
+
const TOOLBAR_MENU_SELECTOR = '[data-toolbar-component="menu"]';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Returns the drag handle button for the selected layout column.
|
|
@@ -50,17 +49,6 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
|
|
|
50
49
|
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
51
50
|
};
|
|
52
51
|
});
|
|
53
|
-
const setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
54
|
-
const menuRef = useRef(null);
|
|
55
|
-
const popupRef = useRef(undefined);
|
|
56
|
-
const [menuHeight, setMenuHeight] = React.useState(FALLBACK_MENU_HEIGHT);
|
|
57
|
-
useLayoutEffect(() => {
|
|
58
|
-
var _popupRef$current;
|
|
59
|
-
if (!isLayoutColumnMenuOpen) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
setMenuHeight(((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.clientHeight) || FALLBACK_MENU_HEIGHT);
|
|
63
|
-
}, [isLayoutColumnMenuOpen]);
|
|
64
52
|
const closeLayoutColumnMenu = useCallback(() => {
|
|
65
53
|
var _api$core, _api$layout;
|
|
66
54
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.toggleLayoutColumnMenu({
|
|
@@ -68,11 +56,7 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
|
|
|
68
56
|
}));
|
|
69
57
|
}, [api]);
|
|
70
58
|
const handleClickOutside = useCallback(event => {
|
|
71
|
-
|
|
72
|
-
if (event.target instanceof Node && (_menuRef$current = menuRef.current) !== null && _menuRef$current !== void 0 && _menuRef$current.contains(event.target)) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (event.target instanceof Element && event.target.closest('[data-toolbar-nested-dropdown-menu]')) {
|
|
59
|
+
if (event.target instanceof Element && (event.target.closest(TOOLBAR_MENU_SELECTOR) || event.target.closest('[data-toolbar-nested-dropdown-menu]'))) {
|
|
76
60
|
return;
|
|
77
61
|
}
|
|
78
62
|
|
|
@@ -89,13 +73,6 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
|
|
|
89
73
|
closeLayoutColumnMenu();
|
|
90
74
|
}
|
|
91
75
|
}, [closeLayoutColumnMenu]);
|
|
92
|
-
const handleMenuRef = useCallback(el => {
|
|
93
|
-
setOutsideClickTargetRef === null || setOutsideClickTargetRef === void 0 ? void 0 : setOutsideClickTargetRef(el);
|
|
94
|
-
menuRef.current = el;
|
|
95
|
-
if (el) {
|
|
96
|
-
popupRef.current = el;
|
|
97
|
-
}
|
|
98
|
-
}, [setOutsideClickTargetRef]);
|
|
99
76
|
const components = (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(LAYOUT_COLUMN_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
100
77
|
const target = useMemo(() => isLayoutColumnMenuOpen ? getLayoutColumnMenuTarget(editorView, selection, layoutColumnMenuAnchorPos) : null, [editorView, isLayoutColumnMenuOpen, layoutColumnMenuAnchorPos, selection]);
|
|
101
78
|
const hasValidTarget = target instanceof HTMLElement;
|
|
@@ -114,16 +91,11 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
|
|
|
114
91
|
scrollableElement: scrollableElement,
|
|
115
92
|
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
116
93
|
alignX: "center",
|
|
117
|
-
fitHeight: menuHeight,
|
|
118
94
|
preventOverflow: true,
|
|
119
95
|
stick: true,
|
|
120
96
|
offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET,
|
|
121
97
|
handleClickOutside: handleClickOutside,
|
|
122
98
|
handleEscapeKeydown: closeLayoutColumnMenu
|
|
123
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
ref: handleMenuRef
|
|
125
|
-
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
126
|
-
editorView: editorView
|
|
127
99
|
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
|
|
128
100
|
isOpen: isLayoutColumnMenuOpen,
|
|
129
101
|
setIsOpen: handleSetIsOpen
|
|
@@ -131,5 +103,5 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
|
|
|
131
103
|
components: components,
|
|
132
104
|
fallbacks: LAYOUT_COLUMN_MENU_FALLBACKS,
|
|
133
105
|
surface: LAYOUT_COLUMN_MENU
|
|
134
|
-
})))
|
|
106
|
+
})));
|
|
135
107
|
});
|
|
@@ -106,7 +106,8 @@ export var getLayoutSectionColumnCount = function getLayoutSectionColumnCount(la
|
|
|
106
106
|
return (layoutSection === null || layoutSection === void 0 ? void 0 : layoutSection.type.name) === 'layoutSection' ? layoutSection.childCount : 0;
|
|
107
107
|
};
|
|
108
108
|
export var getLayoutColumnValign = function getLayoutColumnValign(layoutColumn) {
|
|
109
|
-
|
|
109
|
+
var _ref2;
|
|
110
|
+
return layoutColumn ? (_ref2 = layoutColumn.attrs.valign) !== null && _ref2 !== void 0 ? _ref2 : 'top' : undefined;
|
|
110
111
|
};
|
|
111
112
|
export var getLayoutColumnMenuAnchorPos = function getLayoutColumnMenuAnchorPos(selection, anchorPosFromHandle) {
|
|
112
113
|
var _clickedSelectedColum, _selectedLayoutColumn;
|
|
@@ -114,8 +115,8 @@ export var getLayoutColumnMenuAnchorPos = function getLayoutColumnMenuAnchorPos(
|
|
|
114
115
|
if (!selectedLayoutColumns) {
|
|
115
116
|
return undefined;
|
|
116
117
|
}
|
|
117
|
-
var clickedSelectedColumn = selectedLayoutColumns.selectedColumns.find(function (
|
|
118
|
-
var pos =
|
|
118
|
+
var clickedSelectedColumn = selectedLayoutColumns.selectedColumns.find(function (_ref3) {
|
|
119
|
+
var pos = _ref3.pos;
|
|
119
120
|
return pos === anchorPosFromHandle;
|
|
120
121
|
});
|
|
121
122
|
return (_clickedSelectedColum = clickedSelectedColumn === null || clickedSelectedColumn === void 0 ? void 0 : clickedSelectedColumn.pos) !== null && _clickedSelectedColum !== void 0 ? _clickedSelectedColum : (_selectedLayoutColumn = selectedLayoutColumns.selectedColumns[0]) === null || _selectedLayoutColumn === void 0 ? void 0 : _selectedLayoutColumn.pos;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import {
|
|
4
|
+
import { NestedDropdownRightIcon, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import { getLayoutColumnValign } from '../../pm-plugins/utils/layout-column-selection';
|
|
6
6
|
import { useSelectedLayoutColumns } from './useSelectedLayoutColumns';
|
|
7
7
|
import { VERTICAL_ALIGN_ICONS } from './verticalAlignIcons';
|
|
@@ -23,10 +23,7 @@ export var VerticalAlignNestedMenu = function VerticalAlignNestedMenu(_ref) {
|
|
|
23
23
|
}
|
|
24
24
|
return firstValign;
|
|
25
25
|
}, [selectedLayoutColumns]);
|
|
26
|
-
var TriggerIcon = currentValign ? VERTICAL_ALIGN_ICONS[currentValign] :
|
|
27
|
-
if (!selectedLayoutColumns) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
26
|
+
var TriggerIcon = currentValign ? VERTICAL_ALIGN_ICONS[currentValign] : VERTICAL_ALIGN_ICONS.top;
|
|
30
27
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
31
28
|
elemBefore: /*#__PURE__*/React.createElement(TriggerIcon, {
|
|
32
29
|
label: "",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
5
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { OutsideClickTargetRefContext } from '@atlaskit/editor-common/ui-react';
|
|
6
7
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
7
8
|
import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
|
|
8
9
|
import { DeleteColumnDropdownItem } from './DeleteColumnDropdownItem';
|
|
@@ -11,16 +12,23 @@ import { InsertColumnDropdownItem } from './InsertColumnDropdownItem';
|
|
|
11
12
|
import { DELETE_COLUMN_MENU_ITEM, DISTRIBUTE_COLUMNS_MENU_ITEM, INSERT_COLUMN_LEFT_MENU_ITEM, INSERT_COLUMN_RIGHT_MENU_ITEM, LAYOUT_COLUMN_MENU, LAYOUT_COLUMN_MENU_RANK, LAYOUT_COLUMN_MENU_SECTION, LAYOUT_COLUMN_MENU_SECTION_RANK, LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_BOTTOM_MENU_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_MENU_ITEM, VERTICAL_ALIGN_TOP_MENU_ITEM } from './keys';
|
|
12
13
|
import { VerticalAlignDropdownItem } from './VerticalAlignDropdownItem';
|
|
13
14
|
import { VerticalAlignNestedMenu } from './VerticalAlignNestedMenu';
|
|
15
|
+
var LayoutColumnMenuContainer = function LayoutColumnMenuContainer(_ref) {
|
|
16
|
+
var children = _ref.children;
|
|
17
|
+
var setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
18
|
+
return /*#__PURE__*/React.createElement(ToolbarMenuContainer, {
|
|
19
|
+
ref: setOutsideClickTargetRef
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
14
22
|
export var LAYOUT_COLUMN_MENU_FALLBACKS = {
|
|
15
|
-
'menu-section': function menuSection(
|
|
16
|
-
var children =
|
|
23
|
+
'menu-section': function menuSection(_ref2) {
|
|
24
|
+
var children = _ref2.children;
|
|
17
25
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
|
|
18
26
|
}
|
|
19
27
|
};
|
|
20
|
-
export var getLayoutColumnMenuComponents = function getLayoutColumnMenuComponents(
|
|
21
|
-
var api =
|
|
28
|
+
export var getLayoutColumnMenuComponents = function getLayoutColumnMenuComponents(_ref3) {
|
|
29
|
+
var api = _ref3.api;
|
|
22
30
|
return [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_MENU), {}, {
|
|
23
|
-
component:
|
|
31
|
+
component: LayoutColumnMenuContainer
|
|
24
32
|
}), _objectSpread(_objectSpread({}, LAYOUT_COLUMN_MENU_SECTION), {}, {
|
|
25
33
|
parents: [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_MENU), {}, {
|
|
26
34
|
rank: LAYOUT_COLUMN_MENU_RANK[LAYOUT_COLUMN_MENU_SECTION.key]
|
|
@@ -64,8 +72,8 @@ export var getLayoutColumnMenuComponents = function getLayoutColumnMenuComponent
|
|
|
64
72
|
rank: LAYOUT_COLUMN_MENU_SECTION_RANK[DELETE_COLUMN_MENU_ITEM.key]
|
|
65
73
|
})]
|
|
66
74
|
}), _objectSpread(_objectSpread({}, VERTICAL_ALIGN_MENU), {}, {
|
|
67
|
-
component: function component(
|
|
68
|
-
var children =
|
|
75
|
+
component: function component(_ref4) {
|
|
76
|
+
var children = _ref4.children;
|
|
69
77
|
return /*#__PURE__*/React.createElement(VerticalAlignNestedMenu, {
|
|
70
78
|
api: api
|
|
71
79
|
}, children);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
3
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
5
|
-
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar';
|
|
6
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
7
|
-
import {
|
|
5
|
+
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
8
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
9
7
|
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar';
|
|
10
8
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
@@ -12,8 +10,8 @@ import { getLayoutColumnMenuAnchorPos } from '../../pm-plugins/utils/layout-colu
|
|
|
12
10
|
import { LAYOUT_COLUMN_MENU_FALLBACKS } from './components';
|
|
13
11
|
import { LAYOUT_COLUMN_MENU } from './keys';
|
|
14
12
|
var PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
15
|
-
var FALLBACK_MENU_HEIGHT = 300;
|
|
16
13
|
var LAYOUT_COLUMN_MENU_POPUP_OFFSET = [0, 4];
|
|
14
|
+
var TOOLBAR_MENU_SELECTOR = '[data-toolbar-component="menu"]';
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Returns the drag handle button for the selected layout column.
|
|
@@ -49,20 +47,6 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
49
47
|
isLayoutColumnMenuOpen = _useSharedPluginState.isLayoutColumnMenuOpen,
|
|
50
48
|
layoutColumnMenuAnchorPos = _useSharedPluginState.layoutColumnMenuAnchorPos,
|
|
51
49
|
selection = _useSharedPluginState.selection;
|
|
52
|
-
var setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
53
|
-
var menuRef = useRef(null);
|
|
54
|
-
var popupRef = useRef(undefined);
|
|
55
|
-
var _React$useState = React.useState(FALLBACK_MENU_HEIGHT),
|
|
56
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
57
|
-
menuHeight = _React$useState2[0],
|
|
58
|
-
setMenuHeight = _React$useState2[1];
|
|
59
|
-
useLayoutEffect(function () {
|
|
60
|
-
var _popupRef$current;
|
|
61
|
-
if (!isLayoutColumnMenuOpen) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
setMenuHeight(((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.clientHeight) || FALLBACK_MENU_HEIGHT);
|
|
65
|
-
}, [isLayoutColumnMenuOpen]);
|
|
66
50
|
var closeLayoutColumnMenu = useCallback(function () {
|
|
67
51
|
var _api$core, _api$layout;
|
|
68
52
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.toggleLayoutColumnMenu({
|
|
@@ -70,11 +54,7 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
70
54
|
}));
|
|
71
55
|
}, [api]);
|
|
72
56
|
var handleClickOutside = useCallback(function (event) {
|
|
73
|
-
|
|
74
|
-
if (event.target instanceof Node && (_menuRef$current = menuRef.current) !== null && _menuRef$current !== void 0 && _menuRef$current.contains(event.target)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (event.target instanceof Element && event.target.closest('[data-toolbar-nested-dropdown-menu]')) {
|
|
57
|
+
if (event.target instanceof Element && (event.target.closest(TOOLBAR_MENU_SELECTOR) || event.target.closest('[data-toolbar-nested-dropdown-menu]'))) {
|
|
78
58
|
return;
|
|
79
59
|
}
|
|
80
60
|
|
|
@@ -91,13 +71,6 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
91
71
|
closeLayoutColumnMenu();
|
|
92
72
|
}
|
|
93
73
|
}, [closeLayoutColumnMenu]);
|
|
94
|
-
var handleMenuRef = useCallback(function (el) {
|
|
95
|
-
setOutsideClickTargetRef === null || setOutsideClickTargetRef === void 0 || setOutsideClickTargetRef(el);
|
|
96
|
-
menuRef.current = el;
|
|
97
|
-
if (el) {
|
|
98
|
-
popupRef.current = el;
|
|
99
|
-
}
|
|
100
|
-
}, [setOutsideClickTargetRef]);
|
|
101
74
|
var components = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(LAYOUT_COLUMN_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
102
75
|
var target = useMemo(function () {
|
|
103
76
|
return isLayoutColumnMenuOpen ? getLayoutColumnMenuTarget(editorView, selection, layoutColumnMenuAnchorPos) : null;
|
|
@@ -118,16 +91,11 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
118
91
|
scrollableElement: scrollableElement,
|
|
119
92
|
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
120
93
|
alignX: "center",
|
|
121
|
-
fitHeight: menuHeight,
|
|
122
94
|
preventOverflow: true,
|
|
123
95
|
stick: true,
|
|
124
96
|
offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET,
|
|
125
97
|
handleClickOutside: handleClickOutside,
|
|
126
98
|
handleEscapeKeydown: closeLayoutColumnMenu
|
|
127
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
-
ref: handleMenuRef
|
|
129
|
-
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
130
|
-
editorView: editorView
|
|
131
99
|
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
|
|
132
100
|
isOpen: isLayoutColumnMenuOpen,
|
|
133
101
|
setIsOpen: handleSetIsOpen
|
|
@@ -135,5 +103,5 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
135
103
|
components: components,
|
|
136
104
|
fallbacks: LAYOUT_COLUMN_MENU_FALLBACKS,
|
|
137
105
|
surface: LAYOUT_COLUMN_MENU
|
|
138
|
-
})))
|
|
106
|
+
})));
|
|
139
107
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
1
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { Command, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { Valign } from '@atlaskit/editor-common/types/valign';
|
|
5
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { Change, PresetLayout } from '../types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Valign } from '@atlaskit/
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
export type SelectedLayoutColumn = {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MessageDescriptor } from 'react-intl';
|
|
3
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
3
4
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { Valign } from '@atlaskit/editor-common/types/valign';
|
|
5
5
|
import type { LayoutPlugin } from '../../layoutPluginType';
|
|
6
|
-
|
|
6
|
+
type VerticalAlignDropdownItemProps = {
|
|
7
|
+
api: ExtractInjectionAPI<LayoutPlugin> | undefined;
|
|
7
8
|
label: MessageDescriptor;
|
|
8
9
|
value: Valign;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
api: ExtractInjectionAPI<LayoutPlugin> | undefined;
|
|
12
|
-
};
|
|
13
|
-
export declare const VerticalAlignDropdownItem: ({ api, label, value, }: VerticalAlignDropdownItemProps) => React.JSX.Element | null;
|
|
11
|
+
export declare const VerticalAlignDropdownItem: ({ api, label, value, }: VerticalAlignDropdownItemProps) => React.JSX.Element;
|
|
14
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Valign } from '@atlaskit/
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
2
|
import AlignContentTopIcon from '@atlaskit/icon-lab/core/align-content-top';
|
|
3
3
|
type VerticalAlignIcon = typeof AlignContentTopIcon;
|
|
4
4
|
export declare const VERTICAL_ALIGN_ICONS: Record<Valign, VerticalAlignIcon>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
1
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { Command, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { Valign } from '@atlaskit/editor-common/types/valign';
|
|
5
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { Change, PresetLayout } from '../types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Valign } from '@atlaskit/
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
export type SelectedLayoutColumn = {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MessageDescriptor } from 'react-intl';
|
|
3
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
3
4
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { Valign } from '@atlaskit/editor-common/types/valign';
|
|
5
5
|
import type { LayoutPlugin } from '../../layoutPluginType';
|
|
6
|
-
|
|
6
|
+
type VerticalAlignDropdownItemProps = {
|
|
7
|
+
api: ExtractInjectionAPI<LayoutPlugin> | undefined;
|
|
7
8
|
label: MessageDescriptor;
|
|
8
9
|
value: Valign;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
api: ExtractInjectionAPI<LayoutPlugin> | undefined;
|
|
12
|
-
};
|
|
13
|
-
export declare const VerticalAlignDropdownItem: ({ api, label, value, }: VerticalAlignDropdownItemProps) => React.JSX.Element | null;
|
|
11
|
+
export declare const VerticalAlignDropdownItem: ({ api, label, value, }: VerticalAlignDropdownItemProps) => React.JSX.Element;
|
|
14
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Valign } from '@atlaskit/
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
2
|
import AlignContentTopIcon from '@atlaskit/icon-lab/core/align-content-top';
|
|
3
3
|
type VerticalAlignIcon = typeof AlignContentTopIcon;
|
|
4
4
|
export declare const VERTICAL_ALIGN_ICONS: Record<Valign, VerticalAlignIcon>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.8.0",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.15.0",
|
|
33
33
|
"@atlaskit/css": "^0.19.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^10.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-block-menu": "^9.2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-width": "^11.1.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
46
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
46
|
+
"@atlaskit/editor-toolbar": "^1.8.0",
|
|
47
47
|
"@atlaskit/editor-ui-control-model": "^1.2.0",
|
|
48
48
|
"@atlaskit/icon": "^35.3.0",
|
|
49
49
|
"@atlaskit/icon-lab": "^6.12.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"bind-event-listener": "^3.0.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^114.
|
|
58
|
+
"@atlaskit/editor-common": "^114.48.0",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
61
61
|
},
|