@atlaskit/editor-plugin-block-controls 7.5.2 → 7.5.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,20 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 7.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`13e78771cb389`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13e78771cb389) -
8
+ ED-29600 gate unnecessary decoration operations in apply function
9
+ - Updated dependencies
10
+
11
+ ## 7.5.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [`3b9ebe635ab0a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b9ebe635ab0a) -
16
+ Cleanup of platform_editor_draghandle_safari_scroll_fix
17
+
3
18
  ## 7.5.2
4
19
 
5
20
  ### Patch Changes
@@ -321,7 +321,7 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
321
321
  }
322
322
 
323
323
  // we don't want to remove marks when moving/re-ordering layoutSection
324
- var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true) && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_3'));
324
+ var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true));
325
325
  var fromContentBeforeBreakoutMarksRemoved = (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true) ? tr.doc.slice($sourceFrom.pos, sourceTo).content : $sourceFrom.nodeAfter;
326
326
 
327
327
  // remove breakout from source content
@@ -355,7 +355,9 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
355
355
  // Re-create node decorations
356
356
  var isDecSetEmpty = decorations === _view.DecorationSet.empty;
357
357
  var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
358
- var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging));
358
+ var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
359
+ // Skip expensive anchor node decoration recalculations when native anchor support is enabled
360
+ !((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('editor_native_anchor_remove_decoration_in_apply'));
359
361
  var isActiveNodeModified = false;
360
362
  if (api && shouldRedrawNodeDecs) {
361
363
  var oldNodeDecs = (0, _decorationsAnchor.findNodeDecs)(newState, decorations, from, to);
@@ -441,20 +441,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
441
441
  });
442
442
  view.focus();
443
443
  }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
444
-
445
- // TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
446
- // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
447
- // but ensures the preview is generated correctly.
448
- var handleMouseDown = (0, _react.useCallback)(function () {
449
- if ((0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _platformFeatureFlags.fg)('platform_editor_draghandle_safari_scroll_fix')) {
450
- var _buttonRef$current;
451
- // prevent native drag and drop.
452
- (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
453
- if (!isLayoutColumn) {
454
- return undefined;
455
- }
456
- }
457
- }, [isLayoutColumn]);
458
444
  var handleKeyDown = (0, _react.useCallback)(function (e) {
459
445
  // allow user to use spacebar to select the node
460
446
  if (!e.repeat && e.key === ' ') {
@@ -847,8 +833,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
847
833
  (0, _react.useEffect)(function () {
848
834
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
849
835
  var id = requestAnimationFrame(function () {
850
- var _buttonRef$current2;
851
- (_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 || _buttonRef$current2.focus();
836
+ var _buttonRef$current;
837
+ (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
852
838
  });
853
839
  return function () {
854
840
  cancelAnimationFrame(id);
@@ -972,7 +958,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
972
958
  ,
973
959
  style: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
974
960
  onClick: handleOnClick,
975
- onMouseDown: handleMouseDown,
976
961
  onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
977
962
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
978
963
  ,
@@ -308,7 +308,7 @@ export const moveToLayout = api => (from, to, options) => ({
308
308
  }
309
309
 
310
310
  // we don't want to remove marks when moving/re-ordering layoutSection
311
- const shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) && fg('platform_editor_elements_dnd_multi_select_patch_3'));
311
+ const shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true));
312
312
  const fromContentBeforeBreakoutMarksRemoved = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) ? tr.doc.slice($sourceFrom.pos, sourceTo).content : $sourceFrom.nodeAfter;
313
313
 
314
314
  // remove breakout from source content
@@ -354,7 +354,9 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
354
354
  // Re-create node decorations
355
355
  const isDecSetEmpty = decorations === DecorationSet.empty;
356
356
  const isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || editorExperiment('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
357
- const shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging));
357
+ const shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
358
+ // Skip expensive anchor node decoration recalculations when native anchor support is enabled
359
+ !(expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) && fg('editor_native_anchor_remove_decoration_in_apply'));
358
360
  let isActiveNodeModified = false;
359
361
  if (api && shouldRedrawNodeDecs) {
360
362
  const oldNodeDecs = findNodeDecs(newState, decorations, from, to);
@@ -418,20 +418,6 @@ export const DragHandle = ({
418
418
  });
419
419
  view.focus();
420
420
  }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
421
-
422
- // TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
423
- // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
424
- // but ensures the preview is generated correctly.
425
- const handleMouseDown = useCallback(() => {
426
- if (editorExperiment('advanced_layouts', true) && !fg('platform_editor_draghandle_safari_scroll_fix')) {
427
- var _buttonRef$current;
428
- // prevent native drag and drop.
429
- (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
430
- if (!isLayoutColumn) {
431
- return undefined;
432
- }
433
- }
434
- }, [isLayoutColumn]);
435
421
  const handleKeyDown = useCallback(e => {
436
422
  // allow user to use spacebar to select the node
437
423
  if (!e.repeat && e.key === ' ') {
@@ -833,8 +819,8 @@ export const DragHandle = ({
833
819
  useEffect(() => {
834
820
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
835
821
  const id = requestAnimationFrame(() => {
836
- var _buttonRef$current2;
837
- (_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 ? void 0 : _buttonRef$current2.focus();
822
+ var _buttonRef$current;
823
+ (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
838
824
  });
839
825
  return () => {
840
826
  cancelAnimationFrame(id);
@@ -957,7 +943,6 @@ export const DragHandle = ({
957
943
  ,
958
944
  style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
959
945
  onClick: handleOnClick,
960
- onMouseDown: handleMouseDown,
961
946
  onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
962
947
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
963
948
  ,
@@ -315,7 +315,7 @@ export var moveToLayout = function moveToLayout(api) {
315
315
  }
316
316
 
317
317
  // we don't want to remove marks when moving/re-ordering layoutSection
318
- var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) && fg('platform_editor_elements_dnd_multi_select_patch_3'));
318
+ var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true));
319
319
  var fromContentBeforeBreakoutMarksRemoved = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) ? tr.doc.slice($sourceFrom.pos, sourceTo).content : $sourceFrom.nodeAfter;
320
320
 
321
321
  // remove breakout from source content
@@ -348,7 +348,9 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
348
348
  // Re-create node decorations
349
349
  var isDecSetEmpty = decorations === DecorationSet.empty;
350
350
  var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || editorExperiment('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
351
- var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging));
351
+ var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
352
+ // Skip expensive anchor node decoration recalculations when native anchor support is enabled
353
+ !(expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) && fg('editor_native_anchor_remove_decoration_in_apply'));
352
354
  var isActiveNodeModified = false;
353
355
  if (api && shouldRedrawNodeDecs) {
354
356
  var oldNodeDecs = findNodeDecs(newState, decorations, from, to);
@@ -438,20 +438,6 @@ export var DragHandle = function DragHandle(_ref) {
438
438
  });
439
439
  view.focus();
440
440
  }, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
441
-
442
- // TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
443
- // as expected with a node selection. This workaround sets the selection to the node on mouseDown,
444
- // but ensures the preview is generated correctly.
445
- var handleMouseDown = useCallback(function () {
446
- if (editorExperiment('advanced_layouts', true) && !fg('platform_editor_draghandle_safari_scroll_fix')) {
447
- var _buttonRef$current;
448
- // prevent native drag and drop.
449
- (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
450
- if (!isLayoutColumn) {
451
- return undefined;
452
- }
453
- }
454
- }, [isLayoutColumn]);
455
441
  var handleKeyDown = useCallback(function (e) {
456
442
  // allow user to use spacebar to select the node
457
443
  if (!e.repeat && e.key === ' ') {
@@ -844,8 +830,8 @@ export var DragHandle = function DragHandle(_ref) {
844
830
  useEffect(function () {
845
831
  if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
846
832
  var id = requestAnimationFrame(function () {
847
- var _buttonRef$current2;
848
- (_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 || _buttonRef$current2.focus();
833
+ var _buttonRef$current;
834
+ (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
849
835
  });
850
836
  return function () {
851
837
  cancelAnimationFrame(id);
@@ -969,7 +955,6 @@ export var DragHandle = function DragHandle(_ref) {
969
955
  ,
970
956
  style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
971
957
  onClick: handleOnClick,
972
- onMouseDown: handleMouseDown,
973
958
  onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
974
959
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
975
960
  ,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "7.5.2",
3
+ "version": "7.5.4",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -53,8 +53,8 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
54
54
  "@atlaskit/primitives": "^16.1.0",
55
55
  "@atlaskit/theme": "^21.0.0",
56
- "@atlaskit/tmp-editor-statsig": "^13.25.0",
57
- "@atlaskit/tokens": "^7.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^13.29.0",
57
+ "@atlaskit/tokens": "^7.1.0",
58
58
  "@atlaskit/tooltip": "^20.7.0",
59
59
  "@babel/runtime": "^7.0.0",
60
60
  "@emotion/react": "^11.7.1",
@@ -65,7 +65,7 @@
65
65
  "uuid": "^3.1.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@atlaskit/editor-common": "^110.20.0",
68
+ "@atlaskit/editor-common": "^110.22.0",
69
69
  "react": "^18.2.0",
70
70
  "react-dom": "^18.2.0",
71
71
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -127,9 +127,6 @@
127
127
  "platform_editor_multi_body_extension_extensibility": {
128
128
  "type": "boolean"
129
129
  },
130
- "platform_editor_elements_dnd_multi_select_patch_3": {
131
- "type": "boolean"
132
- },
133
130
  "platform_editor_drag_and_drop_perf_analytics": {
134
131
  "type": "boolean"
135
132
  },
@@ -148,10 +145,10 @@
148
145
  "platform_editor_block_menu_patch_1": {
149
146
  "type": "boolean"
150
147
  },
151
- "platform_editor_breakout_resizing_widget_fix": {
148
+ "editor_native_anchor_remove_decoration_in_apply": {
152
149
  "type": "boolean"
153
150
  },
154
- "platform_editor_draghandle_safari_scroll_fix": {
151
+ "platform_editor_breakout_resizing_widget_fix": {
155
152
  "type": "boolean"
156
153
  },
157
154
  "platform_editor_content_mode_button_mvp": {