@atlaskit/editor-plugin-block-controls 7.2.3 → 7.2.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 7.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dc211dc1927b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc211dc1927b5) -
8
+ [ux] ED-29232: Fixed issues with block menu for file
9
+ - Updated dependencies
10
+
3
11
  ## 7.2.3
4
12
 
5
13
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getShouldMoveNode = exports.getPosWhenMoveNodeUp = exports.getPosWhenMoveNodeDown = exports.getCurrentNodePosFromDragHandleSelection = exports.canMoveNodeUpOrDown = void 0;
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
8
9
  var _utils = require("@atlaskit/editor-tables/utils");
9
10
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
10
11
  var _getNestedNodePosition = require("../../pm-plugins/utils/getNestedNodePosition");
@@ -21,6 +22,10 @@ var getCurrentNodePosFromDragHandleSelection = exports.getCurrentNodePosFromDrag
21
22
  // We only move table node if it's fully selected
22
23
  // to avoid shortcut collision with table drag and drop
23
24
  currentNodePos = (_findTable$pos = (_findTable = (0, _utils.findTable)(selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) !== null && _findTable$pos !== void 0 ? _findTable$pos : currentNodePos;
25
+ } else if (selection instanceof _state.NodeSelection && selection.node.type === schema.nodes.media && selection.node.attrs.type === 'file' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
26
+ // When a file is selected, it is actually wrapped in a media group
27
+ // return the position of the media group , as the group is the node that we want to move up or down
28
+ currentNodePos = selection.$from.pos - 1;
24
29
  } else if (!(selection instanceof _selection.GapCursorSelection)) {
25
30
  // 2. caret cursor is inside the node
26
31
  // 3. the start of the selection is inside the node
@@ -1,4 +1,5 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
3
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
3
4
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
5
  import { getNestedNodePosition } from '../../pm-plugins/utils/getNestedNodePosition';
@@ -16,6 +17,10 @@ export const getCurrentNodePosFromDragHandleSelection = ({
16
17
  // We only move table node if it's fully selected
17
18
  // to avoid shortcut collision with table drag and drop
18
19
  currentNodePos = (_findTable$pos = (_findTable = findTable(selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) !== null && _findTable$pos !== void 0 ? _findTable$pos : currentNodePos;
20
+ } else if (selection instanceof NodeSelection && selection.node.type === schema.nodes.media && selection.node.attrs.type === 'file' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
21
+ // When a file is selected, it is actually wrapped in a media group
22
+ // return the position of the media group , as the group is the node that we want to move up or down
23
+ currentNodePos = selection.$from.pos - 1;
19
24
  } else if (!(selection instanceof GapCursorSelection)) {
20
25
  // 2. caret cursor is inside the node
21
26
  // 3. the start of the selection is inside the node
@@ -1,4 +1,5 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
3
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
3
4
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
5
  import { getNestedNodePosition } from '../../pm-plugins/utils/getNestedNodePosition';
@@ -15,6 +16,10 @@ export var getCurrentNodePosFromDragHandleSelection = function getCurrentNodePos
15
16
  // We only move table node if it's fully selected
16
17
  // to avoid shortcut collision with table drag and drop
17
18
  currentNodePos = (_findTable$pos = (_findTable = findTable(selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) !== null && _findTable$pos !== void 0 ? _findTable$pos : currentNodePos;
19
+ } else if (selection instanceof NodeSelection && selection.node.type === schema.nodes.media && selection.node.attrs.type === 'file' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
20
+ // When a file is selected, it is actually wrapped in a media group
21
+ // return the position of the media group , as the group is the node that we want to move up or down
22
+ currentNodePos = selection.$from.pos - 1;
18
23
  } else if (!(selection instanceof GapCursorSelection)) {
19
24
  // 2. caret cursor is inside the node
20
25
  // 3. the start of the selection is inside the node
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "7.2.3",
3
+ "version": "7.2.4",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,8 +37,8 @@
37
37
  "@atlaskit/editor-plugin-limited-mode": "^3.0.0",
38
38
  "@atlaskit/editor-plugin-metrics": "^7.0.0",
39
39
  "@atlaskit/editor-plugin-quick-insert": "^6.0.0",
40
- "@atlaskit/editor-plugin-selection": "^6.0.0",
41
- "@atlaskit/editor-plugin-type-ahead": "^6.2.0",
40
+ "@atlaskit/editor-plugin-selection": "^6.1.0",
41
+ "@atlaskit/editor-plugin-type-ahead": "^6.3.0",
42
42
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
43
43
  "@atlaskit/editor-plugin-width": "^7.0.0",
44
44
  "@atlaskit/editor-prosemirror": "7.0.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": "^13.2.0",
55
+ "@atlaskit/tmp-editor-statsig": "^13.4.0",
56
56
  "@atlaskit/tokens": "^6.4.0",
57
57
  "@atlaskit/tooltip": "^20.5.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": "^110.4.0",
67
+ "@atlaskit/editor-common": "^110.7.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"