@atlaskit/editor-plugin-block-controls 11.4.5 → 11.4.7

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.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 11.4.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`32dce97f78584`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/32dce97f78584) -
14
+ Fix preserved selection mapping when comment editors append a trailing paragraph after block menu
15
+ transforms.
16
+ - Updated dependencies
17
+
3
18
  ## 11.4.5
4
19
 
5
20
  ### 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;
@@ -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) {
@@ -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;
@@ -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) {
@@ -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;
@@ -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.5",
3
+ "version": "11.4.7",
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,8 +55,8 @@
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.3.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.41.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,12 +141,17 @@
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
  }
147
150
  },
148
151
  "devDependencies": {
149
152
  "@atlassian/structured-docs-types": "workspace:^",
153
+ "react": "^18.2.0",
154
+ "react-dom": "^18.2.0",
150
155
  "react-intl": "^6.6.2"
151
156
  }
152
157
  }