@atlaskit/editor-plugin-block-controls 6.3.6 → 6.3.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,25 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 6.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f7bc2f60e0fc6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f7bc2f60e0fc6) -
8
+ [ux] Updates copy text for drag handle, copy block, copy link and updates order of items in Turn
9
+ into menu.
10
+ - [`a6522c44ddfbb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a6522c44ddfbb) -
11
+ [ux] ED-29408 Fix move up option being enabled for first node in layoutColumn
12
+ - Updated dependencies
13
+
14
+ ## 6.3.7
15
+
16
+ ### Patch Changes
17
+
18
+ - [`15efb9ffafdd5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/15efb9ffafdd5) -
19
+ [ux] Fix for scroll to top that happened when drag handle is clicked at the bottom of a long page
20
+ in Safari.
21
+ - Updated dependencies
22
+
3
23
  ## 6.3.6
4
24
 
5
25
  ### Patch Changes
@@ -76,6 +76,9 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
76
76
  return function (_ref4) {
77
77
  var _api$userIntent, _options$anchorName, _api$blockControls;
78
78
  var tr = _ref4.tr;
79
+ if (!(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
80
+ return tr;
81
+ }
79
82
  var currMeta = tr.getMeta(_main.key);
80
83
  var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
81
84
  if (options !== null && options !== void 0 && options.closeMenu) {
@@ -13,6 +13,10 @@ var _moveNodeUtils = require("./utils/move-node-utils");
13
13
  var moveNodeWithBlockMenu = exports.moveNodeWithBlockMenu = function moveNodeWithBlockMenu(api, direction) {
14
14
  return function (_ref) {
15
15
  var tr = _ref.tr;
16
+ if (!(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
17
+ return tr;
18
+ }
19
+
16
20
  // Nodes like lists nest within themselves, we need to find the top most position
17
21
  var currentNodePos = (0, _moveNodeUtils.getCurrentNodePosFromDragHandleSelection)({
18
22
  selection: tr.selection,
@@ -38,6 +38,9 @@ var getCurrentNodePosFromDragHandleSelection = exports.getCurrentNodePosFromDrag
38
38
  var getPosWhenMoveNodeUp = exports.getPosWhenMoveNodeUp = function getPosWhenMoveNodeUp($currentNodePos, currentNodePos) {
39
39
  var nodeIndex = $currentNodePos.index();
40
40
  var nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
41
+ if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
42
+ return -1;
43
+ }
41
44
  return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
42
45
  };
43
46
  var getPosWhenMoveNodeDown = exports.getPosWhenMoveNodeDown = function getPosWhenMoveNodeDown(_ref2) {
@@ -406,7 +406,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
406
406
  // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
407
407
  // but ensures the preview is generated correctly.
408
408
  var handleMouseDown = (0, _react.useCallback)(function () {
409
- if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
409
+ if ((0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _platformFeatureFlags.fg)('platform_editor_draghandle_safari_scroll_fix')) {
410
410
  var _buttonRef$current;
411
411
  // prevent native drag and drop.
412
412
  (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
@@ -828,8 +828,16 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
828
828
  setDragHandleDisabled(false);
829
829
  }
830
830
  }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNode, view]);
831
+ var dragHandleMessage = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
832
+ br: (0, _react2.jsx)("br", null)
833
+ }) : formatMessage(_messages.blockControlsMessages.dragToMove);
834
+
835
+ // Create a string version for aria-label
836
+ var dragHandleAriaLabel = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
837
+ br: ' '
838
+ }) : formatMessage(_messages.blockControlsMessages.dragToMove);
831
839
  var helpDescriptors = isTopLevelNode ? [{
832
- description: formatMessage(_messages.blockControlsMessages.dragToMove)
840
+ description: dragHandleMessage
833
841
  }, {
834
842
  description: formatMessage(_messages.blockControlsMessages.moveUp),
835
843
  keymap: _keymaps.dragToMoveUp
@@ -843,7 +851,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
843
851
  description: formatMessage(_messages.blockControlsMessages.moveRight),
844
852
  keymap: _keymaps.dragToMoveRight
845
853
  }] : [{
846
- description: formatMessage(_messages.blockControlsMessages.dragToMove)
854
+ description: dragHandleMessage
847
855
  }, {
848
856
  description: formatMessage(_messages.blockControlsMessages.moveUp),
849
857
  keymap: _keymaps.dragToMoveUp
@@ -890,7 +898,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
890
898
  }
891
899
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
892
900
  helpDescriptors = [{
893
- description: formatMessage(_messages.blockControlsMessages.dragToMove)
901
+ description: dragHandleMessage
894
902
  }];
895
903
  }
896
904
  var message = helpDescriptors.map(function (descriptor) {
@@ -922,7 +930,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
922
930
  disabled: dragHandleDisabled,
923
931
  "data-editor-block-ctrl-drag-handle": true,
924
932
  "data-testid": "block-ctrl-drag-handle",
925
- "aria-label": (0, _expValEquals.expValEquals)('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? formatMessage(_messages.blockControlsMessages.dragToMove) : ''
933
+ "aria-label": (0, _expValEquals.expValEquals)('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : ''
926
934
  }, (0, _react2.jsx)(_primitives.Box, {
927
935
  xcss: iconWrapperStyles
928
936
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
@@ -65,6 +65,9 @@ export const blockControlsPlugin = ({
65
65
  tr
66
66
  }) => {
67
67
  var _api$userIntent, _api$userIntent$share, _options$anchorName, _api$blockControls, _api$blockControls$sh;
68
+ if (!expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
69
+ return tr;
70
+ }
68
71
  const currMeta = tr.getMeta(key);
69
72
  const currentUserIntent = api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent;
70
73
  if (options !== null && options !== void 0 && options.closeMenu) {
@@ -8,6 +8,10 @@ export const moveNodeWithBlockMenu = (api, direction) => {
8
8
  return ({
9
9
  tr
10
10
  }) => {
11
+ if (!expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
12
+ return tr;
13
+ }
14
+
11
15
  // Nodes like lists nest within themselves, we need to find the top most position
12
16
  const currentNodePos = getCurrentNodePosFromDragHandleSelection({
13
17
  selection: tr.selection,
@@ -33,6 +33,9 @@ export const getCurrentNodePosFromDragHandleSelection = ({
33
33
  export const getPosWhenMoveNodeUp = ($currentNodePos, currentNodePos) => {
34
34
  const nodeIndex = $currentNodePos.index();
35
35
  const nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
36
+ if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
37
+ return -1;
38
+ }
36
39
  return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
37
40
  };
38
41
  export const getPosWhenMoveNodeDown = ({
@@ -386,7 +386,7 @@ export const DragHandle = ({
386
386
  // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
387
387
  // but ensures the preview is generated correctly.
388
388
  const handleMouseDown = useCallback(() => {
389
- if (editorExperiment('advanced_layouts', true)) {
389
+ if (editorExperiment('advanced_layouts', true) && !fg('platform_editor_draghandle_safari_scroll_fix')) {
390
390
  var _buttonRef$current;
391
391
  // prevent native drag and drop.
392
392
  (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
@@ -819,8 +819,16 @@ export const DragHandle = ({
819
819
  setDragHandleDisabled(false);
820
820
  }
821
821
  }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNode, view]);
822
+ const dragHandleMessage = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
823
+ br: jsx("br", null)
824
+ }) : formatMessage(blockControlsMessages.dragToMove);
825
+
826
+ // Create a string version for aria-label
827
+ const dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
828
+ br: ' '
829
+ }) : formatMessage(blockControlsMessages.dragToMove);
822
830
  let helpDescriptors = isTopLevelNode ? [{
823
- description: formatMessage(blockControlsMessages.dragToMove)
831
+ description: dragHandleMessage
824
832
  }, {
825
833
  description: formatMessage(blockControlsMessages.moveUp),
826
834
  keymap: dragToMoveUp
@@ -834,7 +842,7 @@ export const DragHandle = ({
834
842
  description: formatMessage(blockControlsMessages.moveRight),
835
843
  keymap: dragToMoveRight
836
844
  }] : [{
837
- description: formatMessage(blockControlsMessages.dragToMove)
845
+ description: dragHandleMessage
838
846
  }, {
839
847
  description: formatMessage(blockControlsMessages.moveUp),
840
848
  keymap: dragToMoveUp
@@ -881,7 +889,7 @@ export const DragHandle = ({
881
889
  }
882
890
  if (editorExperiment('platform_editor_controls', 'variant1')) {
883
891
  helpDescriptors = [{
884
- description: formatMessage(blockControlsMessages.dragToMove)
892
+ description: dragHandleMessage
885
893
  }];
886
894
  }
887
895
  const message = helpDescriptors.map(descriptor => {
@@ -912,7 +920,7 @@ export const DragHandle = ({
912
920
  disabled: dragHandleDisabled,
913
921
  "data-editor-block-ctrl-drag-handle": true,
914
922
  "data-testid": "block-ctrl-drag-handle",
915
- "aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMove) : ''
923
+ "aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : ''
916
924
  }, jsx(Box, {
917
925
  xcss: iconWrapperStyles
918
926
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
@@ -69,6 +69,9 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
69
69
  return function (_ref4) {
70
70
  var _api$userIntent, _options$anchorName, _api$blockControls;
71
71
  var tr = _ref4.tr;
72
+ if (!expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
73
+ return tr;
74
+ }
72
75
  var currMeta = tr.getMeta(key);
73
76
  var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
74
77
  if (options !== null && options !== void 0 && options.closeMenu) {
@@ -7,6 +7,10 @@ import { getCurrentNodePosFromDragHandleSelection, getPosWhenMoveNodeDown, getPo
7
7
  export var moveNodeWithBlockMenu = function moveNodeWithBlockMenu(api, direction) {
8
8
  return function (_ref) {
9
9
  var tr = _ref.tr;
10
+ if (!expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
11
+ return tr;
12
+ }
13
+
10
14
  // Nodes like lists nest within themselves, we need to find the top most position
11
15
  var currentNodePos = getCurrentNodePosFromDragHandleSelection({
12
16
  selection: tr.selection,
@@ -32,6 +32,9 @@ export var getCurrentNodePosFromDragHandleSelection = function getCurrentNodePos
32
32
  export var getPosWhenMoveNodeUp = function getPosWhenMoveNodeUp($currentNodePos, currentNodePos) {
33
33
  var nodeIndex = $currentNodePos.index();
34
34
  var nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
35
+ if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
36
+ return -1;
37
+ }
35
38
  return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
36
39
  };
37
40
  export var getPosWhenMoveNodeDown = function getPosWhenMoveNodeDown(_ref2) {
@@ -403,7 +403,7 @@ export var DragHandle = function DragHandle(_ref) {
403
403
  // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
404
404
  // but ensures the preview is generated correctly.
405
405
  var handleMouseDown = useCallback(function () {
406
- if (editorExperiment('advanced_layouts', true)) {
406
+ if (editorExperiment('advanced_layouts', true) && !fg('platform_editor_draghandle_safari_scroll_fix')) {
407
407
  var _buttonRef$current;
408
408
  // prevent native drag and drop.
409
409
  (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
@@ -825,8 +825,16 @@ export var DragHandle = function DragHandle(_ref) {
825
825
  setDragHandleDisabled(false);
826
826
  }
827
827
  }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNode, view]);
828
+ var dragHandleMessage = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
829
+ br: jsx("br", null)
830
+ }) : formatMessage(blockControlsMessages.dragToMove);
831
+
832
+ // Create a string version for aria-label
833
+ var dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_patch_1') ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
834
+ br: ' '
835
+ }) : formatMessage(blockControlsMessages.dragToMove);
828
836
  var helpDescriptors = isTopLevelNode ? [{
829
- description: formatMessage(blockControlsMessages.dragToMove)
837
+ description: dragHandleMessage
830
838
  }, {
831
839
  description: formatMessage(blockControlsMessages.moveUp),
832
840
  keymap: dragToMoveUp
@@ -840,7 +848,7 @@ export var DragHandle = function DragHandle(_ref) {
840
848
  description: formatMessage(blockControlsMessages.moveRight),
841
849
  keymap: dragToMoveRight
842
850
  }] : [{
843
- description: formatMessage(blockControlsMessages.dragToMove)
851
+ description: dragHandleMessage
844
852
  }, {
845
853
  description: formatMessage(blockControlsMessages.moveUp),
846
854
  keymap: dragToMoveUp
@@ -887,7 +895,7 @@ export var DragHandle = function DragHandle(_ref) {
887
895
  }
888
896
  if (editorExperiment('platform_editor_controls', 'variant1')) {
889
897
  helpDescriptors = [{
890
- description: formatMessage(blockControlsMessages.dragToMove)
898
+ description: dragHandleMessage
891
899
  }];
892
900
  }
893
901
  var message = helpDescriptors.map(function (descriptor) {
@@ -919,7 +927,7 @@ export var DragHandle = function DragHandle(_ref) {
919
927
  disabled: dragHandleDisabled,
920
928
  "data-editor-block-ctrl-drag-handle": true,
921
929
  "data-testid": "block-ctrl-drag-handle",
922
- "aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMove) : ''
930
+ "aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : ''
923
931
  }, jsx(Box, {
924
932
  xcss: iconWrapperStyles
925
933
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "6.3.6",
3
+ "version": "6.3.8",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
53
53
  "@atlaskit/primitives": "^14.15.0",
54
54
  "@atlaskit/theme": "^21.0.0",
55
- "@atlaskit/tmp-editor-statsig": "^12.28.0",
55
+ "@atlaskit/tmp-editor-statsig": "^12.29.0",
56
56
  "@atlaskit/tokens": "^6.3.0",
57
57
  "@atlaskit/tooltip": "^20.4.0",
58
58
  "@babel/runtime": "^7.0.0",
@@ -64,7 +64,7 @@
64
64
  "uuid": "^3.1.0"
65
65
  },
66
66
  "peerDependencies": {
67
- "@atlaskit/editor-common": "^109.11.0",
67
+ "@atlaskit/editor-common": "^109.14.0",
68
68
  "react": "^18.2.0",
69
69
  "react-dom": "^18.2.0",
70
70
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -162,8 +162,14 @@
162
162
  "platform_editor_breakout_resizing_hello_release": {
163
163
  "type": "boolean"
164
164
  },
165
+ "platform_editor_block_menu_patch_1": {
166
+ "type": "boolean"
167
+ },
165
168
  "platform_editor_breakout_resizing_widget_fix": {
166
169
  "type": "boolean"
170
+ },
171
+ "platform_editor_draghandle_safari_scroll_fix": {
172
+ "type": "boolean"
167
173
  }
168
174
  }
169
175
  }