@atlaskit/editor-plugin-block-controls 13.1.2 → 13.1.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,19 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 13.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`283c55290e6cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/283c55290e6cc) -
8
+ Preserve visual selection after applying text color or highlight
9
+ - Updated dependencies
10
+
11
+ ## 13.1.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 13.1.2
4
18
 
5
19
  ### Patch Changes
@@ -11,7 +11,6 @@ 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");
15
14
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
15
  var _domAttrName = require("../ui/utils/dom-attr-name");
17
16
  var _decorationsAnchor = require("./decorations-anchor");
@@ -231,7 +230,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
231
230
  } else {
232
231
  pos = view.posAtDOM(rootElement, 0);
233
232
  }
234
- 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)) {
233
+ if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
235
234
  // Don't show drag handle for layout column in a single column layout,
236
235
  // unless the layout column menu is enabled (menu needs the handle to be accessible).
237
236
  return false;
@@ -10,6 +10,7 @@ var _bindEventListener = require("bind-event-listener");
10
10
  var _browserApis = require("@atlaskit/browser-apis");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _styles = require("@atlaskit/editor-common/styles");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
14
  var _main = require("../main");
14
15
  var _selection = require("../utils/selection");
15
16
  var _editorCommands = require("./editor-commands");
@@ -53,19 +54,37 @@ var createSelectionPreservationPlugin = exports.createSelectionPreservationPlugi
53
54
  key: _pluginKey.selectionPreservationPluginKey,
54
55
  state: {
55
56
  init: function init() {
56
- return {
57
- preservedSelection: undefined
58
- };
57
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
58
+ return {
59
+ preservedSelection: undefined,
60
+ syncDomSelectionForDoc: undefined
61
+ };
62
+ } else {
63
+ return {
64
+ preservedSelection: undefined
65
+ };
66
+ }
59
67
  },
60
68
  apply: function apply(tr, pluginState) {
61
69
  var meta = (0, _utils.getSelectionPreservationMeta)(tr);
62
70
  var newState = _objectSpread({}, pluginState);
63
71
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'startPreserving') {
64
72
  newState.preservedSelection = (0, _selection.createPreservedSelection)(tr.doc.resolve(tr.selection.from), tr.doc.resolve(tr.selection.to));
73
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
74
+ newState.syncDomSelectionForDoc = undefined;
75
+ }
65
76
  } else if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'stopPreserving') {
66
77
  newState.preservedSelection = undefined;
67
- } else if (newState.preservedSelection && tr.docChanged) {
68
- newState.preservedSelection = (0, _selection.mapPreservedSelection)(newState.preservedSelection, tr);
78
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
79
+ newState.syncDomSelectionForDoc = undefined;
80
+ }
81
+ } else if (tr.docChanged) {
82
+ if (newState.preservedSelection) {
83
+ newState.preservedSelection = (0, _selection.mapPreservedSelection)(newState.preservedSelection, tr);
84
+ }
85
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
86
+ newState.syncDomSelectionForDoc = (0, _utils.hasFormatSelectionSyncMeta)(tr) ? tr.doc : undefined;
87
+ }
69
88
  }
70
89
  if (!(0, _utils.compareSelections)(newState.preservedSelection, pluginState.preservedSelection)) {
71
90
  if (newState.preservedSelection) {
@@ -111,6 +130,7 @@ var createSelectionPreservationPlugin = exports.createSelectionPreservationPlugi
111
130
  view: function view(initialView) {
112
131
  var view = initialView;
113
132
  var doc = (0, _browserApis.getDocument)();
133
+ var pendingFormatSelectionSyncFrame;
114
134
  if (!doc) {
115
135
  return {
116
136
  update: function update() {},
@@ -158,10 +178,11 @@ var createSelectionPreservationPlugin = exports.createSelectionPreservationPlugi
158
178
  });
159
179
  return {
160
180
  update: function update(updateView, prevState) {
161
- var _selectionPreservatio, _selectionPreservatio2, _key$getState, _key$getState2;
181
+ var _selectionPreservatio, _key$getState, _key$getState2;
162
182
  view = updateView;
163
183
  var prevPreservedSelection = (_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(prevState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
164
- var currPreservedSelection = (_selectionPreservatio2 = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio2 === void 0 ? void 0 : _selectionPreservatio2.preservedSelection;
184
+ var currPluginState = _pluginKey.selectionPreservationPluginKey.getState(view.state);
185
+ var currPreservedSelection = currPluginState === null || currPluginState === void 0 ? void 0 : currPluginState.preservedSelection;
165
186
  var prevActiveNode = (_key$getState = _main.key.getState(prevState)) === null || _key$getState === void 0 ? void 0 : _key$getState.activeNode;
166
187
  var currActiveNode = (_key$getState2 = _main.key.getState(view.state)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.activeNode;
167
188
 
@@ -172,12 +193,33 @@ var createSelectionPreservationPlugin = exports.createSelectionPreservationPlugi
172
193
  var preservedSelectionChanged = !(0, _utils.compareSelections)(prevPreservedSelection, currPreservedSelection);
173
194
  var activeNodeChanged = prevActiveNode !== currActiveNode;
174
195
  var docChanged = prevState.doc !== view.state.doc;
175
- var shouldSyncDOMSelection = hasPreservedSelection && (preservedSelectionChanged || activeNodeChanged) && docChanged;
196
+ var hasFormatSyncRequestForCurrentDoc = (currPluginState === null || currPluginState === void 0 ? void 0 : currPluginState.syncDomSelectionForDoc) === view.state.doc;
197
+ var shouldSyncDOMSelection = (hasPreservedSelection && (preservedSelectionChanged || activeNodeChanged) || (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true) && hasFormatSyncRequestForCurrentDoc) && docChanged;
176
198
  if (shouldSyncDOMSelection) {
177
- (0, _utils.syncDOMSelection)(view.state.selection, view);
199
+ var syncSelection = view.state.selection;
200
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
201
+ if (hasFormatSyncRequestForCurrentDoc) {
202
+ if (pendingFormatSelectionSyncFrame !== undefined) {
203
+ cancelAnimationFrame(pendingFormatSelectionSyncFrame);
204
+ }
205
+ pendingFormatSelectionSyncFrame = requestAnimationFrame(function () {
206
+ pendingFormatSelectionSyncFrame = undefined;
207
+ (0, _utils.syncDOMSelection)(syncSelection, view, {
208
+ focusEditor: true
209
+ });
210
+ });
211
+ } else {
212
+ (0, _utils.syncDOMSelection)(syncSelection, view);
213
+ }
214
+ } else {
215
+ (0, _utils.syncDOMSelection)(syncSelection, view);
216
+ }
178
217
  }
179
218
  },
180
219
  destroy: function destroy() {
220
+ if (pendingFormatSelectionSyncFrame !== undefined) {
221
+ cancelAnimationFrame(pendingFormatSelectionSyncFrame);
222
+ }
181
223
  unbindDocumentMouseDown();
182
224
  }
183
225
  };
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.syncDOMSelection = exports.hasUserSelectionChange = exports.getSelectionPreservationMeta = exports.compareSelections = void 0;
6
+ exports.syncDOMSelection = exports.hasUserSelectionChange = exports.hasFormatSelectionSyncMeta = exports.getSelectionPreservationMeta = exports.compareSelections = void 0;
7
7
  var _browserApis = require("@atlaskit/browser-apis");
8
+ var _selection = require("@atlaskit/editor-common/selection");
8
9
  var _pluginKey = require("./plugin-key");
9
10
  /**
10
11
  * Detects if any of the transactions include user-driven selection changes.
@@ -20,6 +21,9 @@ var hasUserSelectionChange = exports.hasUserSelectionChange = function hasUserSe
20
21
  var getSelectionPreservationMeta = exports.getSelectionPreservationMeta = function getSelectionPreservationMeta(tr) {
21
22
  return tr.getMeta(_pluginKey.selectionPreservationPluginKey);
22
23
  };
24
+ var hasFormatSelectionSyncMeta = exports.hasFormatSelectionSyncMeta = function hasFormatSelectionSyncMeta(tr) {
25
+ return tr.getMeta(_selection.FORMAT_SELECTION_SYNC_META) === true;
26
+ };
23
27
 
24
28
  /**
25
29
  * Compares two selections for equality based on their from and to positions.
@@ -42,8 +46,13 @@ var compareSelections = exports.compareSelections = function compareSelections(a
42
46
  * @param selection The current ProseMirror selection state to sync to DOM.
43
47
  * @param view The EditorView instance used to convert ProseMirror positions to DOM positions.
44
48
  */
45
- var syncDOMSelection = exports.syncDOMSelection = function syncDOMSelection(selection, view) {
49
+ var syncDOMSelection = exports.syncDOMSelection = function syncDOMSelection(selection, view, options) {
46
50
  try {
51
+ if (options !== null && options !== void 0 && options.focusEditor && !view.hasFocus()) {
52
+ // The native browser selection is only painted while the editor owns focus.
53
+ // Formatting toolbar interactions can move focus away before we restore the range.
54
+ view.focus();
55
+ }
47
56
  var domSelection = window.getSelection();
48
57
  if (!domSelection) {
49
58
  return;
@@ -510,7 +510,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
510
510
  if (startPos === undefined) {
511
511
  return tr;
512
512
  }
513
- if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
513
+ if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
514
514
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
515
515
  }
516
516
  var resolvedStartPos = tr.doc.resolve(startPos);
@@ -561,7 +561,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
561
561
  if (startPos === undefined) {
562
562
  return tr;
563
563
  }
564
- if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
564
+ if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
565
565
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
566
566
  }
567
567
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
@@ -649,7 +649,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
649
649
  api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.startPreservingSelection()({
650
650
  tr: tr
651
651
  });
652
- if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
652
+ if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
653
653
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
654
654
  }
655
655
  var rootPos = (0, _experiments.editorExperiment)('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
@@ -949,7 +949,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
949
949
  }
950
950
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
951
951
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
952
- var isLayoutColumnMenuEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true);
952
+ var isLayoutColumnMenuEnabled = (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true);
953
953
  if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
954
954
  setDragHandleDisabled(true);
955
955
  } else {
@@ -961,7 +961,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
961
961
  }) : formatMessage(_messages.blockControlsMessages.dragToMove);
962
962
 
963
963
  // Create a string version for aria-label
964
- var dragHandleAriaLabel = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
964
+ var dragHandleAriaLabel = (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
965
965
  br: ' '
966
966
  }) : formatMessage(_messages.blockControlsMessages.dragToMove);
967
967
  var helpDescriptors = isTopLevelNodeValue ? [{
@@ -1163,7 +1163,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
1163
1163
  }
1164
1164
  }, renderButton());
1165
1165
  };
1166
- var tooltipContent = isLayoutColumn && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
1166
+ var tooltipContent = isLayoutColumn && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
1167
1167
  helpDescriptors: helpDescriptors
1168
1168
  });
1169
1169
  var isTooltip = !dragHandleDisabled;
@@ -3,7 +3,6 @@ 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';
7
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
7
  import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
9
8
  import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
@@ -223,7 +222,7 @@ export const handleMouseOver = (view, event, api) => {
223
222
  } else {
224
223
  pos = view.posAtDOM(rootElement, 0);
225
224
  }
226
- 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)) {
225
+ if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
227
226
  // Don't show drag handle for layout column in a single column layout,
228
227
  // unless the layout column menu is enabled (menu needs the handle to be accessible).
229
228
  return false;
@@ -2,11 +2,12 @@ import { bind } from 'bind-event-listener';
2
2
  import { getDocument } from '@atlaskit/browser-apis';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { key } from '../main';
6
7
  import { createPreservedSelection, mapPreservedSelection } from '../utils/selection';
7
8
  import { stopPreservingSelection } from './editor-commands';
8
9
  import { selectionPreservationPluginKey } from './plugin-key';
9
- import { compareSelections, getSelectionPreservationMeta, hasUserSelectionChange, syncDOMSelection } from './utils';
10
+ import { compareSelections, getSelectionPreservationMeta, hasFormatSelectionSyncMeta, hasUserSelectionChange, syncDOMSelection } from './utils';
10
11
 
11
12
  /**
12
13
  * Selection Preservation Plugin
@@ -43,9 +44,16 @@ export const createSelectionPreservationPlugin = api => () => {
43
44
  key: selectionPreservationPluginKey,
44
45
  state: {
45
46
  init() {
46
- return {
47
- preservedSelection: undefined
48
- };
47
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
48
+ return {
49
+ preservedSelection: undefined,
50
+ syncDomSelectionForDoc: undefined
51
+ };
52
+ } else {
53
+ return {
54
+ preservedSelection: undefined
55
+ };
56
+ }
49
57
  },
50
58
  apply(tr, pluginState) {
51
59
  const meta = getSelectionPreservationMeta(tr);
@@ -54,10 +62,21 @@ export const createSelectionPreservationPlugin = api => () => {
54
62
  };
55
63
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'startPreserving') {
56
64
  newState.preservedSelection = createPreservedSelection(tr.doc.resolve(tr.selection.from), tr.doc.resolve(tr.selection.to));
65
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
66
+ newState.syncDomSelectionForDoc = undefined;
67
+ }
57
68
  } else if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'stopPreserving') {
58
69
  newState.preservedSelection = undefined;
59
- } else if (newState.preservedSelection && tr.docChanged) {
60
- newState.preservedSelection = mapPreservedSelection(newState.preservedSelection, tr);
70
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
71
+ newState.syncDomSelectionForDoc = undefined;
72
+ }
73
+ } else if (tr.docChanged) {
74
+ if (newState.preservedSelection) {
75
+ newState.preservedSelection = mapPreservedSelection(newState.preservedSelection, tr);
76
+ }
77
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
78
+ newState.syncDomSelectionForDoc = hasFormatSelectionSyncMeta(tr) ? tr.doc : undefined;
79
+ }
61
80
  }
62
81
  if (!compareSelections(newState.preservedSelection, pluginState.preservedSelection)) {
63
82
  if (newState.preservedSelection) {
@@ -103,6 +122,7 @@ export const createSelectionPreservationPlugin = api => () => {
103
122
  view(initialView) {
104
123
  let view = initialView;
105
124
  const doc = getDocument();
125
+ let pendingFormatSelectionSyncFrame;
106
126
  if (!doc) {
107
127
  return {
108
128
  update() {},
@@ -151,10 +171,11 @@ export const createSelectionPreservationPlugin = api => () => {
151
171
  });
152
172
  return {
153
173
  update(updateView, prevState) {
154
- var _selectionPreservatio, _selectionPreservatio2, _key$getState, _key$getState2;
174
+ var _selectionPreservatio, _key$getState, _key$getState2;
155
175
  view = updateView;
156
176
  const prevPreservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(prevState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
157
- const currPreservedSelection = (_selectionPreservatio2 = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio2 === void 0 ? void 0 : _selectionPreservatio2.preservedSelection;
177
+ const currPluginState = selectionPreservationPluginKey.getState(view.state);
178
+ const currPreservedSelection = currPluginState === null || currPluginState === void 0 ? void 0 : currPluginState.preservedSelection;
158
179
  const prevActiveNode = (_key$getState = key.getState(prevState)) === null || _key$getState === void 0 ? void 0 : _key$getState.activeNode;
159
180
  const currActiveNode = (_key$getState2 = key.getState(view.state)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.activeNode;
160
181
 
@@ -165,12 +186,33 @@ export const createSelectionPreservationPlugin = api => () => {
165
186
  const preservedSelectionChanged = !compareSelections(prevPreservedSelection, currPreservedSelection);
166
187
  const activeNodeChanged = prevActiveNode !== currActiveNode;
167
188
  const docChanged = prevState.doc !== view.state.doc;
168
- const shouldSyncDOMSelection = hasPreservedSelection && (preservedSelectionChanged || activeNodeChanged) && docChanged;
189
+ const hasFormatSyncRequestForCurrentDoc = (currPluginState === null || currPluginState === void 0 ? void 0 : currPluginState.syncDomSelectionForDoc) === view.state.doc;
190
+ const shouldSyncDOMSelection = (hasPreservedSelection && (preservedSelectionChanged || activeNodeChanged) || expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true) && hasFormatSyncRequestForCurrentDoc) && docChanged;
169
191
  if (shouldSyncDOMSelection) {
170
- syncDOMSelection(view.state.selection, view);
192
+ const syncSelection = view.state.selection;
193
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
194
+ if (hasFormatSyncRequestForCurrentDoc) {
195
+ if (pendingFormatSelectionSyncFrame !== undefined) {
196
+ cancelAnimationFrame(pendingFormatSelectionSyncFrame);
197
+ }
198
+ pendingFormatSelectionSyncFrame = requestAnimationFrame(() => {
199
+ pendingFormatSelectionSyncFrame = undefined;
200
+ syncDOMSelection(syncSelection, view, {
201
+ focusEditor: true
202
+ });
203
+ });
204
+ } else {
205
+ syncDOMSelection(syncSelection, view);
206
+ }
207
+ } else {
208
+ syncDOMSelection(syncSelection, view);
209
+ }
171
210
  }
172
211
  },
173
212
  destroy() {
213
+ if (pendingFormatSelectionSyncFrame !== undefined) {
214
+ cancelAnimationFrame(pendingFormatSelectionSyncFrame);
215
+ }
174
216
  unbindDocumentMouseDown();
175
217
  }
176
218
  };
@@ -1,4 +1,5 @@
1
1
  import { getDocument } from '@atlaskit/browser-apis';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
2
3
  import { selectionPreservationPluginKey } from './plugin-key';
3
4
  /**
4
5
  * Detects if any of the transactions include user-driven selection changes.
@@ -12,6 +13,7 @@ export const hasUserSelectionChange = transactions => {
12
13
  export const getSelectionPreservationMeta = tr => {
13
14
  return tr.getMeta(selectionPreservationPluginKey);
14
15
  };
16
+ export const hasFormatSelectionSyncMeta = tr => tr.getMeta(FORMAT_SELECTION_SYNC_META) === true;
15
17
 
16
18
  /**
17
19
  * Compares two selections for equality based on their from and to positions.
@@ -34,8 +36,13 @@ export const compareSelections = (a, b) => {
34
36
  * @param selection The current ProseMirror selection state to sync to DOM.
35
37
  * @param view The EditorView instance used to convert ProseMirror positions to DOM positions.
36
38
  */
37
- export const syncDOMSelection = (selection, view) => {
39
+ export const syncDOMSelection = (selection, view, options) => {
38
40
  try {
41
+ if (options !== null && options !== void 0 && options.focusEditor && !view.hasFocus()) {
42
+ // The native browser selection is only painted while the editor owns focus.
43
+ // Formatting toolbar interactions can move focus away before we restore the range.
44
+ view.focus();
45
+ }
39
46
  const domSelection = window.getSelection();
40
47
  if (!domSelection) {
41
48
  return;
@@ -483,7 +483,7 @@ export const DragHandle = ({
483
483
  if (startPos === undefined) {
484
484
  return tr;
485
485
  }
486
- if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
486
+ if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
487
487
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
488
488
  }
489
489
  const resolvedStartPos = tr.doc.resolve(startPos);
@@ -535,7 +535,7 @@ export const DragHandle = ({
535
535
  if (startPos === undefined) {
536
536
  return tr;
537
537
  }
538
- if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
538
+ if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
539
539
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
540
540
  }
541
541
  const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
@@ -623,7 +623,7 @@ export const DragHandle = ({
623
623
  api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.startPreservingSelection()({
624
624
  tr
625
625
  });
626
- if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
626
+ if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
627
627
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
628
628
  }
629
629
  const rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
@@ -929,7 +929,7 @@ export const DragHandle = ({
929
929
  }
930
930
  const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
931
931
  const $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
932
- const isLayoutColumnMenuEnabled = expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true);
932
+ const isLayoutColumnMenuEnabled = expValEquals('platform_editor_layout_column_menu', 'isEnabled', true);
933
933
  if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
934
934
  setDragHandleDisabled(true);
935
935
  } else {
@@ -941,7 +941,7 @@ export const DragHandle = ({
941
941
  }) : formatMessage(blockControlsMessages.dragToMove);
942
942
 
943
943
  // Create a string version for aria-label
944
- const dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
944
+ const dragHandleAriaLabel = expValEquals('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
945
945
  br: ' '
946
946
  }) : formatMessage(blockControlsMessages.dragToMove);
947
947
  let helpDescriptors = isTopLevelNodeValue ? [{
@@ -1135,7 +1135,7 @@ export const DragHandle = ({
1135
1135
  });
1136
1136
  }
1137
1137
  }, renderButton());
1138
- const tooltipContent = isLayoutColumn && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
1138
+ const tooltipContent = isLayoutColumn && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
1139
1139
  helpDescriptors: helpDescriptors
1140
1140
  });
1141
1141
  const isTooltip = !dragHandleDisabled;
@@ -4,7 +4,6 @@ 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';
8
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
8
  import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
10
9
  import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
@@ -224,7 +223,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
224
223
  } else {
225
224
  pos = view.posAtDOM(rootElement, 0);
226
225
  }
227
- 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)) {
226
+ if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true) && !expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
228
227
  // Don't show drag handle for layout column in a single column layout,
229
228
  // unless the layout column menu is enabled (menu needs the handle to be accessible).
230
229
  return false;
@@ -5,11 +5,12 @@ import { bind } from 'bind-event-listener';
5
5
  import { getDocument } from '@atlaskit/browser-apis';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
8
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
9
  import { key } from '../main';
9
10
  import { createPreservedSelection, mapPreservedSelection } from '../utils/selection';
10
11
  import { stopPreservingSelection } from './editor-commands';
11
12
  import { selectionPreservationPluginKey } from './plugin-key';
12
- import { compareSelections, getSelectionPreservationMeta, hasUserSelectionChange, syncDOMSelection } from './utils';
13
+ import { compareSelections, getSelectionPreservationMeta, hasFormatSelectionSyncMeta, hasUserSelectionChange, syncDOMSelection } from './utils';
13
14
 
14
15
  /**
15
16
  * Selection Preservation Plugin
@@ -47,19 +48,37 @@ export var createSelectionPreservationPlugin = function createSelectionPreservat
47
48
  key: selectionPreservationPluginKey,
48
49
  state: {
49
50
  init: function init() {
50
- return {
51
- preservedSelection: undefined
52
- };
51
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
52
+ return {
53
+ preservedSelection: undefined,
54
+ syncDomSelectionForDoc: undefined
55
+ };
56
+ } else {
57
+ return {
58
+ preservedSelection: undefined
59
+ };
60
+ }
53
61
  },
54
62
  apply: function apply(tr, pluginState) {
55
63
  var meta = getSelectionPreservationMeta(tr);
56
64
  var newState = _objectSpread({}, pluginState);
57
65
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'startPreserving') {
58
66
  newState.preservedSelection = createPreservedSelection(tr.doc.resolve(tr.selection.from), tr.doc.resolve(tr.selection.to));
67
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
68
+ newState.syncDomSelectionForDoc = undefined;
69
+ }
59
70
  } else if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'stopPreserving') {
60
71
  newState.preservedSelection = undefined;
61
- } else if (newState.preservedSelection && tr.docChanged) {
62
- newState.preservedSelection = mapPreservedSelection(newState.preservedSelection, tr);
72
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
73
+ newState.syncDomSelectionForDoc = undefined;
74
+ }
75
+ } else if (tr.docChanged) {
76
+ if (newState.preservedSelection) {
77
+ newState.preservedSelection = mapPreservedSelection(newState.preservedSelection, tr);
78
+ }
79
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
80
+ newState.syncDomSelectionForDoc = hasFormatSelectionSyncMeta(tr) ? tr.doc : undefined;
81
+ }
63
82
  }
64
83
  if (!compareSelections(newState.preservedSelection, pluginState.preservedSelection)) {
65
84
  if (newState.preservedSelection) {
@@ -105,6 +124,7 @@ export var createSelectionPreservationPlugin = function createSelectionPreservat
105
124
  view: function view(initialView) {
106
125
  var view = initialView;
107
126
  var doc = getDocument();
127
+ var pendingFormatSelectionSyncFrame;
108
128
  if (!doc) {
109
129
  return {
110
130
  update: function update() {},
@@ -152,10 +172,11 @@ export var createSelectionPreservationPlugin = function createSelectionPreservat
152
172
  });
153
173
  return {
154
174
  update: function update(updateView, prevState) {
155
- var _selectionPreservatio, _selectionPreservatio2, _key$getState, _key$getState2;
175
+ var _selectionPreservatio, _key$getState, _key$getState2;
156
176
  view = updateView;
157
177
  var prevPreservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(prevState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
158
- var currPreservedSelection = (_selectionPreservatio2 = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio2 === void 0 ? void 0 : _selectionPreservatio2.preservedSelection;
178
+ var currPluginState = selectionPreservationPluginKey.getState(view.state);
179
+ var currPreservedSelection = currPluginState === null || currPluginState === void 0 ? void 0 : currPluginState.preservedSelection;
159
180
  var prevActiveNode = (_key$getState = key.getState(prevState)) === null || _key$getState === void 0 ? void 0 : _key$getState.activeNode;
160
181
  var currActiveNode = (_key$getState2 = key.getState(view.state)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.activeNode;
161
182
 
@@ -166,12 +187,33 @@ export var createSelectionPreservationPlugin = function createSelectionPreservat
166
187
  var preservedSelectionChanged = !compareSelections(prevPreservedSelection, currPreservedSelection);
167
188
  var activeNodeChanged = prevActiveNode !== currActiveNode;
168
189
  var docChanged = prevState.doc !== view.state.doc;
169
- var shouldSyncDOMSelection = hasPreservedSelection && (preservedSelectionChanged || activeNodeChanged) && docChanged;
190
+ var hasFormatSyncRequestForCurrentDoc = (currPluginState === null || currPluginState === void 0 ? void 0 : currPluginState.syncDomSelectionForDoc) === view.state.doc;
191
+ var shouldSyncDOMSelection = (hasPreservedSelection && (preservedSelectionChanged || activeNodeChanged) || expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true) && hasFormatSyncRequestForCurrentDoc) && docChanged;
170
192
  if (shouldSyncDOMSelection) {
171
- syncDOMSelection(view.state.selection, view);
193
+ var syncSelection = view.state.selection;
194
+ if (expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
195
+ if (hasFormatSyncRequestForCurrentDoc) {
196
+ if (pendingFormatSelectionSyncFrame !== undefined) {
197
+ cancelAnimationFrame(pendingFormatSelectionSyncFrame);
198
+ }
199
+ pendingFormatSelectionSyncFrame = requestAnimationFrame(function () {
200
+ pendingFormatSelectionSyncFrame = undefined;
201
+ syncDOMSelection(syncSelection, view, {
202
+ focusEditor: true
203
+ });
204
+ });
205
+ } else {
206
+ syncDOMSelection(syncSelection, view);
207
+ }
208
+ } else {
209
+ syncDOMSelection(syncSelection, view);
210
+ }
172
211
  }
173
212
  },
174
213
  destroy: function destroy() {
214
+ if (pendingFormatSelectionSyncFrame !== undefined) {
215
+ cancelAnimationFrame(pendingFormatSelectionSyncFrame);
216
+ }
175
217
  unbindDocumentMouseDown();
176
218
  }
177
219
  };
@@ -1,4 +1,5 @@
1
1
  import { getDocument } from '@atlaskit/browser-apis';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
2
3
  import { selectionPreservationPluginKey } from './plugin-key';
3
4
  /**
4
5
  * Detects if any of the transactions include user-driven selection changes.
@@ -14,6 +15,9 @@ export var hasUserSelectionChange = function hasUserSelectionChange(transactions
14
15
  export var getSelectionPreservationMeta = function getSelectionPreservationMeta(tr) {
15
16
  return tr.getMeta(selectionPreservationPluginKey);
16
17
  };
18
+ export var hasFormatSelectionSyncMeta = function hasFormatSelectionSyncMeta(tr) {
19
+ return tr.getMeta(FORMAT_SELECTION_SYNC_META) === true;
20
+ };
17
21
 
18
22
  /**
19
23
  * Compares two selections for equality based on their from and to positions.
@@ -36,8 +40,13 @@ export var compareSelections = function compareSelections(a, b) {
36
40
  * @param selection The current ProseMirror selection state to sync to DOM.
37
41
  * @param view The EditorView instance used to convert ProseMirror positions to DOM positions.
38
42
  */
39
- export var syncDOMSelection = function syncDOMSelection(selection, view) {
43
+ export var syncDOMSelection = function syncDOMSelection(selection, view, options) {
40
44
  try {
45
+ if (options !== null && options !== void 0 && options.focusEditor && !view.hasFocus()) {
46
+ // The native browser selection is only painted while the editor owns focus.
47
+ // Formatting toolbar interactions can move focus away before we restore the range.
48
+ view.focus();
49
+ }
41
50
  var domSelection = window.getSelection();
42
51
  if (!domSelection) {
43
52
  return;
@@ -506,7 +506,7 @@ export var DragHandle = function DragHandle(_ref) {
506
506
  if (startPos === undefined) {
507
507
  return tr;
508
508
  }
509
- if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
509
+ if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
510
510
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
511
511
  }
512
512
  var resolvedStartPos = tr.doc.resolve(startPos);
@@ -557,7 +557,7 @@ export var DragHandle = function DragHandle(_ref) {
557
557
  if (startPos === undefined) {
558
558
  return tr;
559
559
  }
560
- if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
560
+ if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
561
561
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
562
562
  }
563
563
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
@@ -645,7 +645,7 @@ export var DragHandle = function DragHandle(_ref) {
645
645
  api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.startPreservingSelection()({
646
646
  tr: tr
647
647
  });
648
- if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
648
+ if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
649
649
  tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, true));
650
650
  }
651
651
  var rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
@@ -945,7 +945,7 @@ export var DragHandle = function DragHandle(_ref) {
945
945
  }
946
946
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
947
947
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
948
- var isLayoutColumnMenuEnabled = expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true);
948
+ var isLayoutColumnMenuEnabled = expValEquals('platform_editor_layout_column_menu', 'isEnabled', true);
949
949
  if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
950
950
  setDragHandleDisabled(true);
951
951
  } else {
@@ -957,7 +957,7 @@ export var DragHandle = function DragHandle(_ref) {
957
957
  }) : formatMessage(blockControlsMessages.dragToMove);
958
958
 
959
959
  // Create a string version for aria-label
960
- var dragHandleAriaLabel = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
960
+ var dragHandleAriaLabel = expValEquals('platform_editor_block_menu', 'isEnabled', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
961
961
  br: ' '
962
962
  }) : formatMessage(blockControlsMessages.dragToMove);
963
963
  var helpDescriptors = isTopLevelNodeValue ? [{
@@ -1159,7 +1159,7 @@ export var DragHandle = function DragHandle(_ref) {
1159
1159
  }
1160
1160
  }, renderButton());
1161
1161
  };
1162
- var tooltipContent = isLayoutColumn && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
1162
+ var tooltipContent = isLayoutColumn && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true) && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
1163
1163
  helpDescriptors: helpDescriptors
1164
1164
  });
1165
1165
  var isTooltip = !dragHandleDisabled;
@@ -1,6 +1,8 @@
1
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
1
2
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  export type SelectionPreservationPluginState = {
3
4
  preservedSelection?: Selection;
5
+ syncDomSelectionForDoc?: PMNode;
4
6
  };
5
7
  export type SelectionPreservationMeta = {
6
8
  type: 'startPreserving' | 'stopPreserving';
@@ -9,6 +9,7 @@ import type { SelectionPreservationMeta } from './types';
9
9
  */
10
10
  export declare const hasUserSelectionChange: (transactions: readonly Transaction[]) => boolean;
11
11
  export declare const getSelectionPreservationMeta: (tr: Transaction | ReadonlyTransaction) => SelectionPreservationMeta | undefined;
12
+ export declare const hasFormatSelectionSyncMeta: (tr: Transaction | ReadonlyTransaction) => boolean;
12
13
  /**
13
14
  * Compares two selections for equality based on their from and to positions.
14
15
  *
@@ -27,4 +28,6 @@ export declare const compareSelections: (a?: Selection, b?: Selection) => boolea
27
28
  * @param selection The current ProseMirror selection state to sync to DOM.
28
29
  * @param view The EditorView instance used to convert ProseMirror positions to DOM positions.
29
30
  */
30
- export declare const syncDOMSelection: (selection: Selection, view: EditorView) => void;
31
+ export declare const syncDOMSelection: (selection: Selection, view: EditorView, options?: {
32
+ focusEditor?: boolean;
33
+ }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "13.1.2",
3
+ "version": "13.1.4",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -20,8 +20,8 @@
20
20
  ],
21
21
  "atlaskit:src": "src/index.ts",
22
22
  "dependencies": {
23
- "@atlaskit/browser-apis": "^1.0.0",
24
- "@atlaskit/button": "^24.1.0",
23
+ "@atlaskit/browser-apis": "^1.1.0",
24
+ "@atlaskit/button": "^24.3.0",
25
25
  "@atlaskit/editor-plugin-accessibility-utils": "^12.0.0",
26
26
  "@atlaskit/editor-plugin-analytics": "^12.0.0",
27
27
  "@atlaskit/editor-plugin-editor-disabled": "^12.0.0",
@@ -39,18 +39,18 @@
39
39
  "@atlaskit/editor-prosemirror": "^8.0.0",
40
40
  "@atlaskit/editor-shared-styles": "^4.0.0",
41
41
  "@atlaskit/editor-tables": "^3.0.0",
42
- "@atlaskit/icon": "^36.0.0",
43
- "@atlaskit/icon-lab": "^7.1.0",
44
- "@atlaskit/link": "^4.0.0",
42
+ "@atlaskit/icon": "^36.1.0",
43
+ "@atlaskit/icon-lab": "^7.2.0",
44
+ "@atlaskit/link": "^4.1.0",
45
45
  "@atlaskit/platform-feature-flags": "^2.0.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
47
47
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
48
- "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.0.0",
49
- "@atlaskit/primitives": "^20.0.0",
50
- "@atlaskit/theme": "^26.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^113.0.0",
52
- "@atlaskit/tokens": "^15.0.0",
53
- "@atlaskit/tooltip": "^23.0.0",
48
+ "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.1.0",
49
+ "@atlaskit/primitives": "^20.2.0",
50
+ "@atlaskit/theme": "^26.1.0",
51
+ "@atlaskit/tmp-editor-statsig": "^114.6.0",
52
+ "@atlaskit/tokens": "^15.2.0",
53
+ "@atlaskit/tooltip": "^23.1.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1",
56
56
  "bind-event-listener": "^3.0.0",
@@ -59,7 +59,7 @@
59
59
  "uuid": "^3.1.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@atlaskit/editor-common": "^116.12.0",
62
+ "@atlaskit/editor-common": "^116.17.0",
63
63
  "react": "^18.2.0",
64
64
  "react-dom": "^18.2.0",
65
65
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"