@atlaskit/editor-plugin-block-controls 11.4.4 → 11.4.6

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,20 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 11.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`32dce97f78584`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/32dce97f78584) -
8
+ Fix preserved selection mapping when comment editors append a trailing paragraph after block menu
9
+ transforms.
10
+ - Updated dependencies
11
+
12
+ ## 11.4.5
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 11.4.4
4
19
 
5
20
  ### Patch Changes
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mapPreservedSelection = exports.getSelectedSlicePosition = exports.getMultiSelectionIfPosInside = exports.expandSelectionHeadToNodeAtPos = exports.createPreservedSelection = exports.alignAnchorHeadInDirectionOfPos = exports.adjustSelectionBoundsForEdgePositions = void 0;
7
+ var _blockType = require("@atlaskit/editor-common/block-type");
7
8
  var _selection = require("@atlaskit/editor-common/selection");
8
9
  var _state = require("@atlaskit/editor-prosemirror/state");
9
10
  var _utils = require("@atlaskit/editor-tables/utils");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
12
  var _main = require("../main");
11
13
  var _getSelection = require("./getSelection");
12
14
  var getMultiSelectionIfPosInside = exports.getMultiSelectionIfPosInside = function getMultiSelectionIfPosInside(api, pos, tr) {
@@ -94,7 +96,11 @@ var mapPreservedSelection = exports.mapPreservedSelection = function mapPreserve
94
96
  preservedSelectionMapping = _ref.preservedSelectionMapping;
95
97
  var mapping = preservedSelectionMapping || tr.mapping;
96
98
  var from = mapping.map(selection.from);
97
- var to = mapping.map(selection.to);
99
+ // When lastNodeMustBeParagraph inserts a trailing paragraph exactly at the end boundary
100
+ // of a preserved block selection, keep the mapped end position on the left side of the
101
+ // inserted paragraph so it is not included in the preserved selection.
102
+ var shouldTrimTrailingParagraph = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_jira_patch_2') && tr.getMeta(_blockType.INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META) === true;
103
+ var to = shouldTrimTrailingParagraph ? mapping.map(selection.to, -1) : mapping.map(selection.to);
98
104
  var isSelectionEmpty = from === to;
99
105
  var wasSelectionEmpty = selection.from === selection.to;
100
106
  if (isSelectionEmpty && !wasSelectionEmpty) {
@@ -1,6 +1,8 @@
1
+ import { INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META } from '@atlaskit/editor-common/block-type';
1
2
  import { expandToBlockRange, isMultiBlockRange } from '@atlaskit/editor-common/selection';
2
3
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
4
  import { getTableSelectionClosesToPos } from '@atlaskit/editor-tables/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  import { getBlockControlsMeta, key } from '../main';
5
7
  import { newGetSelection } from './getSelection';
6
8
  export const getMultiSelectionIfPosInside = (api, pos, tr) => {
@@ -90,7 +92,11 @@ export const mapPreservedSelection = (selection, tr) => {
90
92
  } = getBlockControlsMeta(tr) || {};
91
93
  const mapping = preservedSelectionMapping || tr.mapping;
92
94
  const from = mapping.map(selection.from);
93
- const to = mapping.map(selection.to);
95
+ // When lastNodeMustBeParagraph inserts a trailing paragraph exactly at the end boundary
96
+ // of a preserved block selection, keep the mapped end position on the left side of the
97
+ // inserted paragraph so it is not included in the preserved selection.
98
+ const shouldTrimTrailingParagraph = fg('platform_editor_block_menu_jira_patch_2') && tr.getMeta(INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META) === true;
99
+ const to = shouldTrimTrailingParagraph ? mapping.map(selection.to, -1) : mapping.map(selection.to);
94
100
  const isSelectionEmpty = from === to;
95
101
  const wasSelectionEmpty = selection.from === selection.to;
96
102
  if (isSelectionEmpty && !wasSelectionEmpty) {
@@ -1,6 +1,8 @@
1
+ import { INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META } from '@atlaskit/editor-common/block-type';
1
2
  import { expandToBlockRange, isMultiBlockRange } from '@atlaskit/editor-common/selection';
2
3
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
4
  import { getTableSelectionClosesToPos } from '@atlaskit/editor-tables/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  import { getBlockControlsMeta, key } from '../main';
5
7
  import { newGetSelection } from './getSelection';
6
8
  export var getMultiSelectionIfPosInside = function getMultiSelectionIfPosInside(api, pos, tr) {
@@ -88,7 +90,11 @@ export var mapPreservedSelection = function mapPreservedSelection(selection, tr)
88
90
  preservedSelectionMapping = _ref.preservedSelectionMapping;
89
91
  var mapping = preservedSelectionMapping || tr.mapping;
90
92
  var from = mapping.map(selection.from);
91
- var to = mapping.map(selection.to);
93
+ // When lastNodeMustBeParagraph inserts a trailing paragraph exactly at the end boundary
94
+ // of a preserved block selection, keep the mapped end position on the left side of the
95
+ // inserted paragraph so it is not included in the preserved selection.
96
+ var shouldTrimTrailingParagraph = fg('platform_editor_block_menu_jira_patch_2') && tr.getMeta(INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META) === true;
97
+ var to = shouldTrimTrailingParagraph ? mapping.map(selection.to, -1) : mapping.map(selection.to);
92
98
  var isSelectionEmpty = from === to;
93
99
  var wasSelectionEmpty = selection.from === selection.to;
94
100
  if (isSelectionEmpty && !wasSelectionEmpty) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "11.4.4",
3
+ "version": "11.4.6",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
57
57
  "@atlaskit/primitives": "^19.0.0",
58
58
  "@atlaskit/theme": "^23.2.0",
59
- "@atlaskit/tmp-editor-statsig": "^81.3.0",
59
+ "@atlaskit/tmp-editor-statsig": "^82.0.0",
60
60
  "@atlaskit/tokens": "^13.0.0",
61
61
  "@atlaskit/tooltip": "^22.2.0",
62
62
  "@babel/runtime": "^7.0.0",
@@ -67,7 +67,7 @@
67
67
  "uuid": "^3.1.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@atlaskit/editor-common": "^114.36.0",
70
+ "@atlaskit/editor-common": "^114.37.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"
@@ -141,6 +141,9 @@
141
141
  "platform_editor_block_menu_jira_patch_1": {
142
142
  "type": "boolean"
143
143
  },
144
+ "platform_editor_block_menu_jira_patch_2": {
145
+ "type": "boolean"
146
+ },
144
147
  "confluence_remix_button_right_side_block_fg": {
145
148
  "type": "boolean"
146
149
  }