@atlaskit/editor-plugin-block-menu 0.0.7 → 0.0.8

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 0.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1bed58ba517b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1bed58ba517b7) -
8
+ [ux] BlockMenu will be opened to the left or the drag handle by default and to the right when
9
+ there is no enough space.
10
+
3
11
  ## 0.0.7
4
12
 
5
13
  ### Patch Changes
@@ -23,6 +23,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
23
23
  var styles = {
24
24
  base: "_2rkoglpi _bfhk1bhr _16qs1cd0"
25
25
  };
26
+ var DEFAULT_MENU_WIDTH = 230;
26
27
  var DRAG_HANDLE_OFFSET_PADDING = 5;
27
28
  var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
28
29
  var BlockMenuContent = function BlockMenuContent(_ref) {
@@ -106,8 +107,9 @@ var BlockMenu = function BlockMenu(_ref2) {
106
107
  var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(_styles.DRAG_HANDLE_SELECTOR);
107
108
  if (targetHandleRef instanceof HTMLElement) {
108
109
  return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
109
- alignX: 'left',
110
- alignY: 'start',
110
+ alignX: 'right',
111
+ alignY: 'start' // respected when forcePlacement is true
112
+ ,
111
113
  handleClickOutside: closeMenu,
112
114
  handleEscapeKeydown: closeMenu,
113
115
  mountTo: mountTo,
@@ -115,7 +117,10 @@ var BlockMenu = function BlockMenu(_ref2) {
115
117
  scrollableElement: scrollableElement,
116
118
  target: targetHandleRef,
117
119
  zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
120
+ fitWidth: DEFAULT_MENU_WIDTH,
118
121
  forcePlacement: true,
122
+ preventOverflow: true // disables forced horizontal placement when forcePlacement is on, so fitWidth controls flipping
123
+ ,
119
124
  stick: true,
120
125
  offset: [_styles.DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, 0]
121
126
  }, /*#__PURE__*/_react.default.createElement(BlockMenuContent, {
@@ -15,6 +15,7 @@ import { BlockMenuRenderer } from './block-menu-renderer';
15
15
  const styles = {
16
16
  base: "_2rkoglpi _bfhk1bhr _16qs1cd0"
17
17
  };
18
+ const DEFAULT_MENU_WIDTH = 230;
18
19
  const DRAG_HANDLE_OFFSET_PADDING = 5;
19
20
  const PopupWithListeners = withReactEditorViewOuterListeners(Popup);
20
21
  const BlockMenuContent = ({
@@ -96,8 +97,9 @@ const BlockMenu = ({
96
97
  const targetHandleRef = editorView === null || editorView === void 0 ? void 0 : (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
97
98
  if (targetHandleRef instanceof HTMLElement) {
98
99
  return /*#__PURE__*/React.createElement(PopupWithListeners, {
99
- alignX: 'left',
100
- alignY: 'start',
100
+ alignX: 'right',
101
+ alignY: 'start' // respected when forcePlacement is true
102
+ ,
101
103
  handleClickOutside: closeMenu,
102
104
  handleEscapeKeydown: closeMenu,
103
105
  mountTo: mountTo,
@@ -105,7 +107,10 @@ const BlockMenu = ({
105
107
  scrollableElement: scrollableElement,
106
108
  target: targetHandleRef,
107
109
  zIndex: akEditorFloatingOverlapPanelZIndex,
110
+ fitWidth: DEFAULT_MENU_WIDTH,
108
111
  forcePlacement: true,
112
+ preventOverflow: true // disables forced horizontal placement when forcePlacement is on, so fitWidth controls flipping
113
+ ,
109
114
  stick: true,
110
115
  offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, 0]
111
116
  }, /*#__PURE__*/React.createElement(BlockMenuContent, {
@@ -15,6 +15,7 @@ import { BlockMenuRenderer } from './block-menu-renderer';
15
15
  var styles = {
16
16
  base: "_2rkoglpi _bfhk1bhr _16qs1cd0"
17
17
  };
18
+ var DEFAULT_MENU_WIDTH = 230;
18
19
  var DRAG_HANDLE_OFFSET_PADDING = 5;
19
20
  var PopupWithListeners = withReactEditorViewOuterListeners(Popup);
20
21
  var BlockMenuContent = function BlockMenuContent(_ref) {
@@ -98,8 +99,9 @@ var BlockMenu = function BlockMenu(_ref2) {
98
99
  var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
99
100
  if (targetHandleRef instanceof HTMLElement) {
100
101
  return /*#__PURE__*/React.createElement(PopupWithListeners, {
101
- alignX: 'left',
102
- alignY: 'start',
102
+ alignX: 'right',
103
+ alignY: 'start' // respected when forcePlacement is true
104
+ ,
103
105
  handleClickOutside: closeMenu,
104
106
  handleEscapeKeydown: closeMenu,
105
107
  mountTo: mountTo,
@@ -107,7 +109,10 @@ var BlockMenu = function BlockMenu(_ref2) {
107
109
  scrollableElement: scrollableElement,
108
110
  target: targetHandleRef,
109
111
  zIndex: akEditorFloatingOverlapPanelZIndex,
112
+ fitWidth: DEFAULT_MENU_WIDTH,
110
113
  forcePlacement: true,
114
+ preventOverflow: true // disables forced horizontal placement when forcePlacement is on, so fitWidth controls flipping
115
+ ,
111
116
  stick: true,
112
117
  offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, 0]
113
118
  }, /*#__PURE__*/React.createElement(BlockMenuContent, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",