@atlaskit/editor-plugin-block-controls 11.4.6 → 11.5.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 11.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`71eaad00529a1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71eaad00529a1) -
8
+ Support multi-column layout column menu selections
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 11.4.7
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 11.4.6
4
21
 
5
22
  ### Patch Changes
@@ -11,6 +11,7 @@ var _selection = require("@atlaskit/editor-common/selection");
11
11
  var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
12
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
13
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
14
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
15
16
  var _domAttrName = require("../ui/utils/dom-attr-name");
16
17
  var _decorationsAnchor = require("./decorations-anchor");
@@ -234,8 +235,9 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
234
235
  } else {
235
236
  pos = view.posAtDOM(rootElement, 0);
236
237
  }
237
- if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
238
- // Don't show drag handle for layout column in a single column layout
238
+ if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
239
+ // Don't show drag handle for layout column in a single column layout,
240
+ // unless the layout column menu is enabled (menu needs the handle to be accessible).
239
241
  return false;
240
242
  }
241
243
  var targetPos = view.state.doc.resolve(pos).pos;
@@ -466,6 +466,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
466
466
  }
467
467
  if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
468
468
  tr.setMeta('toggleLayoutColumnMenu', {
469
+ anchorPos: startPos,
469
470
  isOpen: true
470
471
  });
471
472
  }
@@ -519,6 +520,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
519
520
  }
520
521
  if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
521
522
  tr.setMeta('toggleLayoutColumnMenu', {
523
+ anchorPos: startPos,
522
524
  isOpen: true
523
525
  });
524
526
  }
@@ -895,12 +897,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
895
897
  }
896
898
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
897
899
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
898
- if (isShiftDown && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
900
+ var isLayoutColumnMenuEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true);
901
+ if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
899
902
  setDragHandleDisabled(true);
900
903
  } else {
901
904
  setDragHandleDisabled(false);
902
905
  }
903
- }, [api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isShiftDown, isTopLevelNodeValue, view]);
906
+ }, [api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isLayoutColumn, isShiftDown, isTopLevelNodeValue, view]);
904
907
  var dragHandleMessage = (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
905
908
  br: (0, _react2.jsx)("br", null)
906
909
  }) : formatMessage(_messages.blockControlsMessages.dragToMove);
@@ -3,6 +3,7 @@ import { isMultiBlockSelection } from '@atlaskit/editor-common/selection';
3
3
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
  import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
8
9
  import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
@@ -226,8 +227,9 @@ export const handleMouseOver = (view, event, api) => {
226
227
  } else {
227
228
  pos = view.posAtDOM(rootElement, 0);
228
229
  }
229
- if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true)) {
230
- // Don't show drag handle for layout column in a single column layout
230
+ if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
231
+ // Don't show drag handle for layout column in a single column layout,
232
+ // unless the layout column menu is enabled (menu needs the handle to be accessible).
231
233
  return false;
232
234
  }
233
235
  const targetPos = view.state.doc.resolve(pos).pos;
@@ -441,6 +441,7 @@ export const DragHandle = ({
441
441
  }
442
442
  if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
443
443
  tr.setMeta('toggleLayoutColumnMenu', {
444
+ anchorPos: startPos,
444
445
  isOpen: true
445
446
  });
446
447
  }
@@ -495,6 +496,7 @@ export const DragHandle = ({
495
496
  }
496
497
  if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
497
498
  tr.setMeta('toggleLayoutColumnMenu', {
499
+ anchorPos: startPos,
498
500
  isOpen: true
499
501
  });
500
502
  }
@@ -877,12 +879,13 @@ export const DragHandle = ({
877
879
  }
878
880
  const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
879
881
  const $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
880
- if (isShiftDown && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
882
+ const isLayoutColumnMenuEnabled = expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true);
883
+ if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
881
884
  setDragHandleDisabled(true);
882
885
  } else {
883
886
  setDragHandleDisabled(false);
884
887
  }
885
- }, [api === null || api === void 0 ? void 0 : (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isShiftDown, isTopLevelNodeValue, view]);
888
+ }, [api === null || api === void 0 ? void 0 : (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isLayoutColumn, isShiftDown, isTopLevelNodeValue, view]);
886
889
  const dragHandleMessage = editorExperiment('platform_editor_block_menu', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
887
890
  br: jsx("br", null)
888
891
  }) : formatMessage(blockControlsMessages.dragToMove);
@@ -4,6 +4,7 @@ import { isMultiBlockSelection } from '@atlaskit/editor-common/selection';
4
4
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
7
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
9
10
  import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
@@ -227,8 +228,9 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
227
228
  } else {
228
229
  pos = view.posAtDOM(rootElement, 0);
229
230
  }
230
- if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true)) {
231
- // Don't show drag handle for layout column in a single column layout
231
+ if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
232
+ // Don't show drag handle for layout column in a single column layout,
233
+ // unless the layout column menu is enabled (menu needs the handle to be accessible).
232
234
  return false;
233
235
  }
234
236
  var targetPos = view.state.doc.resolve(pos).pos;
@@ -462,6 +462,7 @@ export var DragHandle = function DragHandle(_ref) {
462
462
  }
463
463
  if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
464
464
  tr.setMeta('toggleLayoutColumnMenu', {
465
+ anchorPos: startPos,
465
466
  isOpen: true
466
467
  });
467
468
  }
@@ -515,6 +516,7 @@ export var DragHandle = function DragHandle(_ref) {
515
516
  }
516
517
  if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
517
518
  tr.setMeta('toggleLayoutColumnMenu', {
519
+ anchorPos: startPos,
518
520
  isOpen: true
519
521
  });
520
522
  }
@@ -891,12 +893,13 @@ export var DragHandle = function DragHandle(_ref) {
891
893
  }
892
894
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
893
895
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
894
- if (isShiftDown && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
896
+ var isLayoutColumnMenuEnabled = expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true);
897
+ if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
895
898
  setDragHandleDisabled(true);
896
899
  } else {
897
900
  setDragHandleDisabled(false);
898
901
  }
899
- }, [api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isShiftDown, isTopLevelNodeValue, view]);
902
+ }, [api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isLayoutColumn, isShiftDown, isTopLevelNodeValue, view]);
900
903
  var dragHandleMessage = editorExperiment('platform_editor_block_menu', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
901
904
  br: jsx("br", null)
902
905
  }) : formatMessage(blockControlsMessages.dragToMove);
@@ -5,37 +5,39 @@
5
5
 
6
6
  import path from 'path';
7
7
 
8
- import type { ComponentStructuredContentSource } from '@atlassian/structured-docs-types';
8
+ import type { StructuredContentSource } from '@atlassian/structured-docs-types/types';
9
9
 
10
10
  import packageJson from './package.json';
11
11
 
12
12
  const packagePath = path.resolve(__dirname);
13
13
 
14
- const documentation: ComponentStructuredContentSource[] = [
15
- {
16
- name: 'Editor Plugin Block Controls',
17
- description: 'Block controls plugin for @atlaskit/editor-core',
18
- status: 'general-availability',
19
- import: {
20
- name: 'blockControlsPlugin',
21
- package: '@atlaskit/editor-plugin-block-controls',
22
- type: 'named',
23
- packagePath,
24
- packageJson,
25
- },
26
- usageGuidelines: [],
27
- contentGuidelines: [],
28
- accessibilityGuidelines: [],
29
- keywords: ['editor', 'editor-plugin-block-controls', 'atlaskit'],
30
- categories: ['editor'],
31
- examples: [
32
- {
33
- name: 'Basic',
34
- description: 'Block controls plugin in composable editor.',
35
- source: path.resolve(packagePath, './examples/1-basic.tsx'),
14
+ const documentation: StructuredContentSource = {
15
+ components: [
16
+ {
17
+ name: 'Editor Plugin Block Controls',
18
+ description: 'Block controls plugin for @atlaskit/editor-core',
19
+ status: 'general-availability',
20
+ import: {
21
+ name: 'blockControlsPlugin',
22
+ package: '@atlaskit/editor-plugin-block-controls',
23
+ type: 'named',
24
+ packagePath,
25
+ packageJson,
36
26
  },
37
- ],
38
- },
39
- ];
27
+ usageGuidelines: [],
28
+ contentGuidelines: [],
29
+ accessibilityGuidelines: [],
30
+ keywords: ['editor', 'editor-plugin-block-controls', 'atlaskit'],
31
+ categories: ['editor'],
32
+ examples: [
33
+ {
34
+ name: 'Basic',
35
+ description: 'Block controls plugin in composable editor.',
36
+ source: path.resolve(packagePath, './examples/1-basic.tsx'),
37
+ },
38
+ ],
39
+ },
40
+ ],
41
+ };
40
42
 
41
43
  export default documentation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "11.4.6",
3
+ "version": "11.5.0",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/editor-plugin-quick-insert": "^10.4.0",
42
42
  "@atlaskit/editor-plugin-selection": "^10.1.0",
43
43
  "@atlaskit/editor-plugin-toolbar": "^7.3.0",
44
- "@atlaskit/editor-plugin-type-ahead": "^10.1.0",
44
+ "@atlaskit/editor-plugin-type-ahead": "^10.2.0",
45
45
  "@atlaskit/editor-plugin-user-intent": "^8.2.0",
46
46
  "@atlaskit/editor-plugin-width": "^11.1.0",
47
47
  "@atlaskit/editor-prosemirror": "^7.3.0",
@@ -55,10 +55,10 @@
55
55
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
56
56
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
57
57
  "@atlaskit/primitives": "^19.0.0",
58
- "@atlaskit/theme": "^23.2.0",
59
- "@atlaskit/tmp-editor-statsig": "^82.0.0",
58
+ "@atlaskit/theme": "^24.0.0",
59
+ "@atlaskit/tmp-editor-statsig": "^82.5.0",
60
60
  "@atlaskit/tokens": "^13.0.0",
61
- "@atlaskit/tooltip": "^22.2.0",
61
+ "@atlaskit/tooltip": "^22.3.0",
62
62
  "@babel/runtime": "^7.0.0",
63
63
  "@emotion/react": "^11.7.1",
64
64
  "bind-event-listener": "^3.0.0",
@@ -67,7 +67,7 @@
67
67
  "uuid": "^3.1.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@atlaskit/editor-common": "^114.37.0",
70
+ "@atlaskit/editor-common": "^114.45.0",
71
71
  "react": "^18.2.0",
72
72
  "react-dom": "^18.2.0",
73
73
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -150,6 +150,8 @@
150
150
  },
151
151
  "devDependencies": {
152
152
  "@atlassian/structured-docs-types": "workspace:^",
153
+ "react": "^18.2.0",
154
+ "react-dom": "^18.2.0",
153
155
  "react-intl": "^6.6.2"
154
156
  }
155
157
  }