@atlaskit/editor-plugin-selection-toolbar 3.6.14 → 3.7.1

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,23 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.7.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#158546](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158546)
14
+ [`b7fe4e6f226f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7fe4e6f226f3) -
15
+ ED-27284 use user preferences plugin in editor preset.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 3.6.14
4
22
 
5
23
  ### Patch Changes
@@ -30,6 +30,12 @@ var getToolbarDocking = function getToolbarDocking(contextualFormattingEnabled,
30
30
  }
31
31
  return 'top';
32
32
  };
33
+ var getToolbarDockingV2 = function getToolbarDockingV2(contextualFormattingEnabled, dockingPreference) {
34
+ if (contextualFormattingEnabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
35
+ return dockingPreference !== null && dockingPreference !== void 0 ? dockingPreference : 'none';
36
+ }
37
+ return 'top';
38
+ };
33
39
  var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
34
40
  var api = _ref.api,
35
41
  config = _ref.config;
@@ -90,27 +96,31 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
90
96
  }))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
91
97
  },
92
98
  setToolbarDocking: function setToolbarDocking(toolbarDocking) {
93
- var _api$core$actions$exe3, _api$analytics;
94
- return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.setToolbarDocking)({
99
+ var _api$core$actions$exe4, _api$analytics;
100
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
101
+ var _api$core$actions$exe3, _api$userPreferences;
102
+ return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.actions.updateUserPreference('toolbarDockingPosition', toolbarDocking))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
103
+ }
104
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.setToolbarDocking)({
95
105
  toolbarDocking: toolbarDocking,
96
106
  userPreferencesProvider: userPreferencesProvider,
97
107
  editorAnalyticsApi: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
98
- }))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
108
+ }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
99
109
  },
100
110
  forceToolbarDockingWithoutAnalytics: function forceToolbarDockingWithoutAnalytics(toolbarDocking) {
101
- var _api$core$actions$exe4;
102
- return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.forceToolbarDockingWithoutAnalytics)({
111
+ var _api$core$actions$exe5;
112
+ return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.forceToolbarDockingWithoutAnalytics)({
103
113
  toolbarDocking: toolbarDocking,
104
114
  userPreferencesProvider: userPreferencesProvider
105
- }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
115
+ }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
106
116
  },
107
117
  refreshToolbarDocking: function refreshToolbarDocking() {
108
118
  if (userPreferencesProvider) {
109
- var _api$core$actions$exe5;
119
+ var _api$core$actions$exe6;
110
120
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
111
- return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.updateToolbarDocking)({
121
+ return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.updateToolbarDocking)({
112
122
  toolbarDocking: userToolbarDockingPref
113
- }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
123
+ }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
114
124
  }
115
125
  return false;
116
126
  }
@@ -122,9 +132,11 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
122
132
  return _pluginKey.selectionToolbarPluginKey.getState(editorState);
123
133
  },
124
134
  pmPlugins: function pmPlugins(selectionToolbarHandlers) {
135
+ var _api$userPreferences2;
125
136
  if (selectionToolbarHandlers) {
126
137
  __selectionToolbarHandlers.push.apply(__selectionToolbarHandlers, (0, _toConsumableArray2.default)(selectionToolbarHandlers));
127
138
  }
139
+ var initialToolbarDocking = (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? getToolbarDockingV2(contextualFormattingEnabled, api === null || api === void 0 || (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 || (_api$userPreferences2 = _api$userPreferences2.sharedState.currentState()) === null || _api$userPreferences2 === void 0 || (_api$userPreferences2 = _api$userPreferences2.preferences) === null || _api$userPreferences2 === void 0 ? void 0 : _api$userPreferences2.toolbarDockingPosition) : getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
128
140
  return [{
129
141
  name: 'selection-tracker',
130
142
  plugin: function plugin() {
@@ -135,7 +147,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
135
147
  return {
136
148
  selectionStable: false,
137
149
  hide: false,
138
- toolbarDocking: getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider)
150
+ toolbarDocking: initialToolbarDocking
139
151
  };
140
152
  },
141
153
  apply: function apply(tr, pluginState) {
@@ -194,6 +206,9 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
194
206
  };
195
207
  },
196
208
  appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
209
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
210
+ return null;
211
+ }
197
212
  if (!isPreferenceInitialized && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2')) {
198
213
  var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
199
214
  if (toolbarDockingPreference !== undefined) {
@@ -317,16 +332,18 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
317
332
  }
318
333
  }
319
334
  if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
335
+ var _api$userPreferences3;
336
+ var toolbarDockingPref = api !== null && api !== void 0 && api.userPreferences && (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences3 = api.userPreferences) === null || _api$userPreferences3 === void 0 || (_api$userPreferences3 = _api$userPreferences3.sharedState.currentState()) === null || _api$userPreferences3 === void 0 || (_api$userPreferences3 = _api$userPreferences3.preferences) === null || _api$userPreferences3 === void 0 ? void 0 : _api$userPreferences3.toolbarDockingPosition : toolbarDocking;
320
337
  if ((0, _experiments.editorExperiment)('platform_editor_controls_toolbar_pinning_exp', true)) {
321
338
  items.push.apply(items, (0, _toConsumableArray2.default)((0, _pinToolbarConfig.getPinOptionToolbarConfig)({
322
339
  api: api,
323
- toolbarDocking: toolbarDocking,
340
+ toolbarDocking: toolbarDockingPref,
324
341
  intl: intl
325
342
  })));
326
343
  } else {
327
344
  items.push.apply(items, (0, _toConsumableArray2.default)((0, _overflowToolbarConfig.getOverflowFloatingToolbarConfig)({
328
345
  api: api,
329
- toolbarDocking: toolbarDocking,
346
+ toolbarDocking: toolbarDockingPref,
330
347
  intl: intl
331
348
  })));
332
349
  }
@@ -351,7 +368,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
351
368
  });
352
369
  }
353
370
  },
354
- contentComponent: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_user_preferences_provider_update') ? function () {
371
+ contentComponent: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') && (0, _platformFeatureFlags.fg)('platform_editor_user_preferences_provider_update') ? function () {
355
372
  return /*#__PURE__*/_react.default.createElement(_PageVisibilityWatcher.PageVisibilityWatcher, {
356
373
  api: api,
357
374
  userPreferencesProvider: userPreferencesProvider
@@ -29,6 +29,10 @@ var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig
29
29
  title: intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionInline),
30
30
  onClick: function onClick() {
31
31
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
32
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
33
+ var _api$core$actions$exe, _api$userPreferences, _api$userPreferences$;
34
+ return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.actions) === null || _api$userPreferences === void 0 || (_api$userPreferences$ = _api$userPreferences.updateUserPreference) === null || _api$userPreferences$ === void 0 ? void 0 : _api$userPreferences$.call(_api$userPreferences, 'toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
35
+ }
32
36
  return (_api$selectionToolbar = api === null || api === void 0 || (_api$selectionToolbar2 = api.selectionToolbar.actions) === null || _api$selectionToolbar2 === void 0 || (_api$selectionToolbar3 = _api$selectionToolbar2.setToolbarDocking) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.call(_api$selectionToolbar2, 'none')) !== null && _api$selectionToolbar !== void 0 ? _api$selectionToolbar : false;
33
37
  },
34
38
  icon: (0, _minus.default)({
@@ -43,6 +47,10 @@ var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig
43
47
  title: intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionFixedAtTop),
44
48
  onClick: function onClick() {
45
49
  var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
50
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
51
+ var _api$core$actions$exe2, _api$userPreferences2, _api$userPreferences3;
52
+ return (_api$core$actions$exe2 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 || (_api$userPreferences2 = _api$userPreferences2.actions) === null || _api$userPreferences2 === void 0 || (_api$userPreferences3 = _api$userPreferences2.updateUserPreference) === null || _api$userPreferences3 === void 0 ? void 0 : _api$userPreferences3.call(_api$userPreferences2, 'toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
53
+ }
46
54
  return (_api$selectionToolbar4 = api === null || api === void 0 || (_api$selectionToolbar5 = api.selectionToolbar.actions) === null || _api$selectionToolbar5 === void 0 || (_api$selectionToolbar6 = _api$selectionToolbar5.setToolbarDocking) === null || _api$selectionToolbar6 === void 0 ? void 0 : _api$selectionToolbar6.call(_api$selectionToolbar5, 'top')) !== null && _api$selectionToolbar4 !== void 0 ? _api$selectionToolbar4 : false;
47
55
  },
48
56
  icon: (0, _dockToolbarTop.default)({
@@ -85,6 +93,10 @@ var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig =
85
93
  },
86
94
  onClick: function onClick() {
87
95
  var _api$selectionToolbar7, _api$selectionToolbar8, _api$selectionToolbar9;
96
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
97
+ var _api$core$actions$exe3, _api$userPreferences4, _api$userPreferences5;
98
+ return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences4 = api.userPreferences) === null || _api$userPreferences4 === void 0 || (_api$userPreferences4 = _api$userPreferences4.actions) === null || _api$userPreferences4 === void 0 || (_api$userPreferences5 = _api$userPreferences4.updateUserPreference) === null || _api$userPreferences5 === void 0 ? void 0 : _api$userPreferences5.call(_api$userPreferences4, 'toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
99
+ }
88
100
  return (_api$selectionToolbar7 = api === null || api === void 0 || (_api$selectionToolbar8 = api.selectionToolbar.actions) === null || _api$selectionToolbar8 === void 0 || (_api$selectionToolbar9 = _api$selectionToolbar8.setToolbarDocking) === null || _api$selectionToolbar9 === void 0 ? void 0 : _api$selectionToolbar9.call(_api$selectionToolbar8, 'none')) !== null && _api$selectionToolbar7 !== void 0 ? _api$selectionToolbar7 : false;
89
101
  },
90
102
  elemBefore: (0, _minus.default)({
@@ -97,6 +109,10 @@ var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig =
97
109
  },
98
110
  onClick: function onClick() {
99
111
  var _api$selectionToolbar0, _api$selectionToolbar1, _api$selectionToolbar10;
112
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
113
+ var _api$core$actions$exe4, _api$userPreferences6, _api$userPreferences7;
114
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences6 = api.userPreferences) === null || _api$userPreferences6 === void 0 || (_api$userPreferences6 = _api$userPreferences6.actions) === null || _api$userPreferences6 === void 0 || (_api$userPreferences7 = _api$userPreferences6.updateUserPreference) === null || _api$userPreferences7 === void 0 ? void 0 : _api$userPreferences7.call(_api$userPreferences6, 'toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
115
+ }
100
116
  return (_api$selectionToolbar0 = api === null || api === void 0 || (_api$selectionToolbar1 = api.selectionToolbar.actions) === null || _api$selectionToolbar1 === void 0 || (_api$selectionToolbar10 = _api$selectionToolbar1.setToolbarDocking) === null || _api$selectionToolbar10 === void 0 ? void 0 : _api$selectionToolbar10.call(_api$selectionToolbar1, 'top')) !== null && _api$selectionToolbar0 !== void 0 ? _api$selectionToolbar0 : false;
101
117
  },
102
118
  isActive: true,
@@ -19,6 +19,12 @@ const getToolbarDocking = (contextualFormattingEnabled, userPreferencesProvider)
19
19
  }
20
20
  return 'top';
21
21
  };
22
+ const getToolbarDockingV2 = (contextualFormattingEnabled, dockingPreference) => {
23
+ if (contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1')) {
24
+ return dockingPreference !== null && dockingPreference !== void 0 ? dockingPreference : 'none';
25
+ }
26
+ return 'top';
27
+ };
22
28
  export const selectionToolbarPlugin = ({
23
29
  api,
24
30
  config
@@ -82,27 +88,31 @@ export const selectionToolbarPlugin = ({
82
88
  }))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
83
89
  },
84
90
  setToolbarDocking: toolbarDocking => {
85
- var _api$core$actions$exe3, _api$analytics;
86
- return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(setToolbarDocking({
91
+ var _api$core$actions$exe4, _api$analytics;
92
+ if (fg('platform_editor_use_preferences_plugin')) {
93
+ var _api$core$actions$exe3, _api$userPreferences;
94
+ return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.actions.updateUserPreference('toolbarDockingPosition', toolbarDocking))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
95
+ }
96
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(setToolbarDocking({
87
97
  toolbarDocking,
88
98
  userPreferencesProvider,
89
99
  editorAnalyticsApi: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
90
- }))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
100
+ }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
91
101
  },
92
102
  forceToolbarDockingWithoutAnalytics: toolbarDocking => {
93
- var _api$core$actions$exe4;
94
- return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(forceToolbarDockingWithoutAnalytics({
103
+ var _api$core$actions$exe5;
104
+ return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(forceToolbarDockingWithoutAnalytics({
95
105
  toolbarDocking,
96
106
  userPreferencesProvider
97
- }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
107
+ }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
98
108
  },
99
109
  refreshToolbarDocking: () => {
100
110
  if (userPreferencesProvider) {
101
- var _api$core$actions$exe5;
111
+ var _api$core$actions$exe6;
102
112
  const userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
103
- return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
113
+ return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
104
114
  toolbarDocking: userToolbarDockingPref
105
- }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
115
+ }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
106
116
  }
107
117
  return false;
108
118
  }
@@ -114,9 +124,11 @@ export const selectionToolbarPlugin = ({
114
124
  return selectionToolbarPluginKey.getState(editorState);
115
125
  },
116
126
  pmPlugins(selectionToolbarHandlers) {
127
+ var _api$userPreferences2, _api$userPreferences3, _api$userPreferences4;
117
128
  if (selectionToolbarHandlers) {
118
129
  __selectionToolbarHandlers.push(...selectionToolbarHandlers);
119
130
  }
131
+ const initialToolbarDocking = fg('platform_editor_use_preferences_plugin') ? getToolbarDockingV2(contextualFormattingEnabled, api === null || api === void 0 ? void 0 : (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 ? void 0 : (_api$userPreferences3 = _api$userPreferences2.sharedState.currentState()) === null || _api$userPreferences3 === void 0 ? void 0 : (_api$userPreferences4 = _api$userPreferences3.preferences) === null || _api$userPreferences4 === void 0 ? void 0 : _api$userPreferences4.toolbarDockingPosition) : getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
120
132
  return [{
121
133
  name: 'selection-tracker',
122
134
  plugin: () => {
@@ -127,7 +139,7 @@ export const selectionToolbarPlugin = ({
127
139
  return {
128
140
  selectionStable: false,
129
141
  hide: false,
130
- toolbarDocking: getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider)
142
+ toolbarDocking: initialToolbarDocking
131
143
  };
132
144
  },
133
145
  apply(tr, pluginState) {
@@ -190,6 +202,9 @@ export const selectionToolbarPlugin = ({
190
202
  };
191
203
  },
192
204
  appendTransaction(_transactions, _oldState, newState) {
205
+ if (fg('platform_editor_use_preferences_plugin')) {
206
+ return null;
207
+ }
193
208
  if (!isPreferenceInitialized && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2')) {
194
209
  const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
195
210
  if (toolbarDockingPreference !== undefined) {
@@ -310,16 +325,18 @@ export const selectionToolbarPlugin = ({
310
325
  }
311
326
  }
312
327
  if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
328
+ var _api$userPreferences5, _api$userPreferences6, _api$userPreferences7;
329
+ const toolbarDockingPref = api !== null && api !== void 0 && api.userPreferences && fg('platform_editor_use_preferences_plugin') ? api === null || api === void 0 ? void 0 : (_api$userPreferences5 = api.userPreferences) === null || _api$userPreferences5 === void 0 ? void 0 : (_api$userPreferences6 = _api$userPreferences5.sharedState.currentState()) === null || _api$userPreferences6 === void 0 ? void 0 : (_api$userPreferences7 = _api$userPreferences6.preferences) === null || _api$userPreferences7 === void 0 ? void 0 : _api$userPreferences7.toolbarDockingPosition : toolbarDocking;
313
330
  if (editorExperiment('platform_editor_controls_toolbar_pinning_exp', true)) {
314
331
  items.push(...getPinOptionToolbarConfig({
315
332
  api,
316
- toolbarDocking,
333
+ toolbarDocking: toolbarDockingPref,
317
334
  intl
318
335
  }));
319
336
  } else {
320
337
  items.push(...getOverflowFloatingToolbarConfig({
321
338
  api,
322
- toolbarDocking,
339
+ toolbarDocking: toolbarDockingPref,
323
340
  intl
324
341
  }));
325
342
  }
@@ -344,7 +361,7 @@ export const selectionToolbarPlugin = ({
344
361
  };
345
362
  }
346
363
  },
347
- contentComponent: editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_user_preferences_provider_update') ? () => /*#__PURE__*/React.createElement(PageVisibilityWatcher, {
364
+ contentComponent: editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_use_preferences_plugin') && fg('platform_editor_user_preferences_provider_update') ? () => /*#__PURE__*/React.createElement(PageVisibilityWatcher, {
348
365
  api: api,
349
366
  userPreferencesProvider: userPreferencesProvider
350
367
  }) : undefined,
@@ -21,6 +21,10 @@ export const getOverflowFloatingToolbarConfig = ({
21
21
  title: intl.formatMessage(selectionToolbarMessages.toolbarPositionInline),
22
22
  onClick: () => {
23
23
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
24
+ if (fg('platform_editor_use_preferences_plugin')) {
25
+ var _api$core$actions$exe, _api$userPreferences, _api$userPreferences$, _api$userPreferences$2;
26
+ return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : (_api$userPreferences$ = _api$userPreferences.actions) === null || _api$userPreferences$ === void 0 ? void 0 : (_api$userPreferences$2 = _api$userPreferences$.updateUserPreference) === null || _api$userPreferences$2 === void 0 ? void 0 : _api$userPreferences$2.call(_api$userPreferences$, 'toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
27
+ }
24
28
  return (_api$selectionToolbar = api === null || api === void 0 ? void 0 : (_api$selectionToolbar2 = api.selectionToolbar.actions) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.setToolbarDocking) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.call(_api$selectionToolbar2, 'none')) !== null && _api$selectionToolbar !== void 0 ? _api$selectionToolbar : false;
25
29
  },
26
30
  icon: MinusIcon({
@@ -35,6 +39,10 @@ export const getOverflowFloatingToolbarConfig = ({
35
39
  title: intl.formatMessage(selectionToolbarMessages.toolbarPositionFixedAtTop),
36
40
  onClick: () => {
37
41
  var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
42
+ if (fg('platform_editor_use_preferences_plugin')) {
43
+ var _api$core$actions$exe2, _api$userPreferences2, _api$userPreferences3, _api$userPreferences4;
44
+ return (_api$core$actions$exe2 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 ? void 0 : (_api$userPreferences3 = _api$userPreferences2.actions) === null || _api$userPreferences3 === void 0 ? void 0 : (_api$userPreferences4 = _api$userPreferences3.updateUserPreference) === null || _api$userPreferences4 === void 0 ? void 0 : _api$userPreferences4.call(_api$userPreferences3, 'toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
45
+ }
38
46
  return (_api$selectionToolbar4 = api === null || api === void 0 ? void 0 : (_api$selectionToolbar5 = api.selectionToolbar.actions) === null || _api$selectionToolbar5 === void 0 ? void 0 : (_api$selectionToolbar6 = _api$selectionToolbar5.setToolbarDocking) === null || _api$selectionToolbar6 === void 0 ? void 0 : _api$selectionToolbar6.call(_api$selectionToolbar5, 'top')) !== null && _api$selectionToolbar4 !== void 0 ? _api$selectionToolbar4 : false;
39
47
  },
40
48
  icon: DockToolbarTopIcon({
@@ -77,6 +85,10 @@ export const getOverflowPrimaryToolbarConfig = ({
77
85
  },
78
86
  onClick: () => {
79
87
  var _api$selectionToolbar7, _api$selectionToolbar8, _api$selectionToolbar9;
88
+ if (fg('platform_editor_use_preferences_plugin')) {
89
+ var _api$core$actions$exe3, _api$userPreferences5, _api$userPreferences6, _api$userPreferences7;
90
+ return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userPreferences5 = api.userPreferences) === null || _api$userPreferences5 === void 0 ? void 0 : (_api$userPreferences6 = _api$userPreferences5.actions) === null || _api$userPreferences6 === void 0 ? void 0 : (_api$userPreferences7 = _api$userPreferences6.updateUserPreference) === null || _api$userPreferences7 === void 0 ? void 0 : _api$userPreferences7.call(_api$userPreferences6, 'toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
91
+ }
80
92
  return (_api$selectionToolbar7 = api === null || api === void 0 ? void 0 : (_api$selectionToolbar8 = api.selectionToolbar.actions) === null || _api$selectionToolbar8 === void 0 ? void 0 : (_api$selectionToolbar9 = _api$selectionToolbar8.setToolbarDocking) === null || _api$selectionToolbar9 === void 0 ? void 0 : _api$selectionToolbar9.call(_api$selectionToolbar8, 'none')) !== null && _api$selectionToolbar7 !== void 0 ? _api$selectionToolbar7 : false;
81
93
  },
82
94
  elemBefore: MinusIcon({
@@ -89,6 +101,10 @@ export const getOverflowPrimaryToolbarConfig = ({
89
101
  },
90
102
  onClick: () => {
91
103
  var _api$selectionToolbar0, _api$selectionToolbar1, _api$selectionToolbar10;
104
+ if (fg('platform_editor_use_preferences_plugin')) {
105
+ var _api$core$actions$exe4, _api$userPreferences8, _api$userPreferences9, _api$userPreferences0;
106
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userPreferences8 = api.userPreferences) === null || _api$userPreferences8 === void 0 ? void 0 : (_api$userPreferences9 = _api$userPreferences8.actions) === null || _api$userPreferences9 === void 0 ? void 0 : (_api$userPreferences0 = _api$userPreferences9.updateUserPreference) === null || _api$userPreferences0 === void 0 ? void 0 : _api$userPreferences0.call(_api$userPreferences9, 'toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
107
+ }
92
108
  return (_api$selectionToolbar0 = api === null || api === void 0 ? void 0 : (_api$selectionToolbar1 = api.selectionToolbar.actions) === null || _api$selectionToolbar1 === void 0 ? void 0 : (_api$selectionToolbar10 = _api$selectionToolbar1.setToolbarDocking) === null || _api$selectionToolbar10 === void 0 ? void 0 : _api$selectionToolbar10.call(_api$selectionToolbar1, 'top')) !== null && _api$selectionToolbar0 !== void 0 ? _api$selectionToolbar0 : false;
93
109
  },
94
110
  isActive: true,
@@ -23,6 +23,12 @@ var getToolbarDocking = function getToolbarDocking(contextualFormattingEnabled,
23
23
  }
24
24
  return 'top';
25
25
  };
26
+ var getToolbarDockingV2 = function getToolbarDockingV2(contextualFormattingEnabled, dockingPreference) {
27
+ if (contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1')) {
28
+ return dockingPreference !== null && dockingPreference !== void 0 ? dockingPreference : 'none';
29
+ }
30
+ return 'top';
31
+ };
26
32
  export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
27
33
  var api = _ref.api,
28
34
  config = _ref.config;
@@ -83,27 +89,31 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
83
89
  }))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
84
90
  },
85
91
  setToolbarDocking: function setToolbarDocking(toolbarDocking) {
86
- var _api$core$actions$exe3, _api$analytics;
87
- return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_setToolbarDocking({
92
+ var _api$core$actions$exe4, _api$analytics;
93
+ if (fg('platform_editor_use_preferences_plugin')) {
94
+ var _api$core$actions$exe3, _api$userPreferences;
95
+ return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.actions.updateUserPreference('toolbarDockingPosition', toolbarDocking))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
96
+ }
97
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_setToolbarDocking({
88
98
  toolbarDocking: toolbarDocking,
89
99
  userPreferencesProvider: userPreferencesProvider,
90
100
  editorAnalyticsApi: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
91
- }))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
101
+ }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
92
102
  },
93
103
  forceToolbarDockingWithoutAnalytics: function forceToolbarDockingWithoutAnalytics(toolbarDocking) {
94
- var _api$core$actions$exe4;
95
- return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_forceToolbarDockingWithoutAnalytics({
104
+ var _api$core$actions$exe5;
105
+ return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_forceToolbarDockingWithoutAnalytics({
96
106
  toolbarDocking: toolbarDocking,
97
107
  userPreferencesProvider: userPreferencesProvider
98
- }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
108
+ }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
99
109
  },
100
110
  refreshToolbarDocking: function refreshToolbarDocking() {
101
111
  if (userPreferencesProvider) {
102
- var _api$core$actions$exe5;
112
+ var _api$core$actions$exe6;
103
113
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
104
- return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
114
+ return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
105
115
  toolbarDocking: userToolbarDockingPref
106
- }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
116
+ }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
107
117
  }
108
118
  return false;
109
119
  }
@@ -115,9 +125,11 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
115
125
  return selectionToolbarPluginKey.getState(editorState);
116
126
  },
117
127
  pmPlugins: function pmPlugins(selectionToolbarHandlers) {
128
+ var _api$userPreferences2;
118
129
  if (selectionToolbarHandlers) {
119
130
  __selectionToolbarHandlers.push.apply(__selectionToolbarHandlers, _toConsumableArray(selectionToolbarHandlers));
120
131
  }
132
+ var initialToolbarDocking = fg('platform_editor_use_preferences_plugin') ? getToolbarDockingV2(contextualFormattingEnabled, api === null || api === void 0 || (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 || (_api$userPreferences2 = _api$userPreferences2.sharedState.currentState()) === null || _api$userPreferences2 === void 0 || (_api$userPreferences2 = _api$userPreferences2.preferences) === null || _api$userPreferences2 === void 0 ? void 0 : _api$userPreferences2.toolbarDockingPosition) : getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
121
133
  return [{
122
134
  name: 'selection-tracker',
123
135
  plugin: function plugin() {
@@ -128,7 +140,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
128
140
  return {
129
141
  selectionStable: false,
130
142
  hide: false,
131
- toolbarDocking: getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider)
143
+ toolbarDocking: initialToolbarDocking
132
144
  };
133
145
  },
134
146
  apply: function apply(tr, pluginState) {
@@ -187,6 +199,9 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
187
199
  };
188
200
  },
189
201
  appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
202
+ if (fg('platform_editor_use_preferences_plugin')) {
203
+ return null;
204
+ }
190
205
  if (!isPreferenceInitialized && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2')) {
191
206
  var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
192
207
  if (toolbarDockingPreference !== undefined) {
@@ -310,16 +325,18 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
310
325
  }
311
326
  }
312
327
  if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
328
+ var _api$userPreferences3;
329
+ var toolbarDockingPref = api !== null && api !== void 0 && api.userPreferences && fg('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences3 = api.userPreferences) === null || _api$userPreferences3 === void 0 || (_api$userPreferences3 = _api$userPreferences3.sharedState.currentState()) === null || _api$userPreferences3 === void 0 || (_api$userPreferences3 = _api$userPreferences3.preferences) === null || _api$userPreferences3 === void 0 ? void 0 : _api$userPreferences3.toolbarDockingPosition : toolbarDocking;
313
330
  if (editorExperiment('platform_editor_controls_toolbar_pinning_exp', true)) {
314
331
  items.push.apply(items, _toConsumableArray(getPinOptionToolbarConfig({
315
332
  api: api,
316
- toolbarDocking: toolbarDocking,
333
+ toolbarDocking: toolbarDockingPref,
317
334
  intl: intl
318
335
  })));
319
336
  } else {
320
337
  items.push.apply(items, _toConsumableArray(getOverflowFloatingToolbarConfig({
321
338
  api: api,
322
- toolbarDocking: toolbarDocking,
339
+ toolbarDocking: toolbarDockingPref,
323
340
  intl: intl
324
341
  })));
325
342
  }
@@ -344,7 +361,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
344
361
  });
345
362
  }
346
363
  },
347
- contentComponent: editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_user_preferences_provider_update') ? function () {
364
+ contentComponent: editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_use_preferences_plugin') && fg('platform_editor_user_preferences_provider_update') ? function () {
348
365
  return /*#__PURE__*/React.createElement(PageVisibilityWatcher, {
349
366
  api: api,
350
367
  userPreferencesProvider: userPreferencesProvider
@@ -20,6 +20,10 @@ export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolba
20
20
  title: intl.formatMessage(selectionToolbarMessages.toolbarPositionInline),
21
21
  onClick: function onClick() {
22
22
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
23
+ if (fg('platform_editor_use_preferences_plugin')) {
24
+ var _api$core$actions$exe, _api$userPreferences, _api$userPreferences$;
25
+ return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.actions) === null || _api$userPreferences === void 0 || (_api$userPreferences$ = _api$userPreferences.updateUserPreference) === null || _api$userPreferences$ === void 0 ? void 0 : _api$userPreferences$.call(_api$userPreferences, 'toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
26
+ }
23
27
  return (_api$selectionToolbar = api === null || api === void 0 || (_api$selectionToolbar2 = api.selectionToolbar.actions) === null || _api$selectionToolbar2 === void 0 || (_api$selectionToolbar3 = _api$selectionToolbar2.setToolbarDocking) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.call(_api$selectionToolbar2, 'none')) !== null && _api$selectionToolbar !== void 0 ? _api$selectionToolbar : false;
24
28
  },
25
29
  icon: MinusIcon({
@@ -34,6 +38,10 @@ export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolba
34
38
  title: intl.formatMessage(selectionToolbarMessages.toolbarPositionFixedAtTop),
35
39
  onClick: function onClick() {
36
40
  var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
41
+ if (fg('platform_editor_use_preferences_plugin')) {
42
+ var _api$core$actions$exe2, _api$userPreferences2, _api$userPreferences3;
43
+ return (_api$core$actions$exe2 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 || (_api$userPreferences2 = _api$userPreferences2.actions) === null || _api$userPreferences2 === void 0 || (_api$userPreferences3 = _api$userPreferences2.updateUserPreference) === null || _api$userPreferences3 === void 0 ? void 0 : _api$userPreferences3.call(_api$userPreferences2, 'toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
44
+ }
37
45
  return (_api$selectionToolbar4 = api === null || api === void 0 || (_api$selectionToolbar5 = api.selectionToolbar.actions) === null || _api$selectionToolbar5 === void 0 || (_api$selectionToolbar6 = _api$selectionToolbar5.setToolbarDocking) === null || _api$selectionToolbar6 === void 0 ? void 0 : _api$selectionToolbar6.call(_api$selectionToolbar5, 'top')) !== null && _api$selectionToolbar4 !== void 0 ? _api$selectionToolbar4 : false;
38
46
  },
39
47
  icon: DockToolbarTopIcon({
@@ -76,6 +84,10 @@ export var getOverflowPrimaryToolbarConfig = function getOverflowPrimaryToolbarC
76
84
  },
77
85
  onClick: function onClick() {
78
86
  var _api$selectionToolbar7, _api$selectionToolbar8, _api$selectionToolbar9;
87
+ if (fg('platform_editor_use_preferences_plugin')) {
88
+ var _api$core$actions$exe3, _api$userPreferences4, _api$userPreferences5;
89
+ return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences4 = api.userPreferences) === null || _api$userPreferences4 === void 0 || (_api$userPreferences4 = _api$userPreferences4.actions) === null || _api$userPreferences4 === void 0 || (_api$userPreferences5 = _api$userPreferences4.updateUserPreference) === null || _api$userPreferences5 === void 0 ? void 0 : _api$userPreferences5.call(_api$userPreferences4, 'toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
90
+ }
79
91
  return (_api$selectionToolbar7 = api === null || api === void 0 || (_api$selectionToolbar8 = api.selectionToolbar.actions) === null || _api$selectionToolbar8 === void 0 || (_api$selectionToolbar9 = _api$selectionToolbar8.setToolbarDocking) === null || _api$selectionToolbar9 === void 0 ? void 0 : _api$selectionToolbar9.call(_api$selectionToolbar8, 'none')) !== null && _api$selectionToolbar7 !== void 0 ? _api$selectionToolbar7 : false;
80
92
  },
81
93
  elemBefore: MinusIcon({
@@ -88,6 +100,10 @@ export var getOverflowPrimaryToolbarConfig = function getOverflowPrimaryToolbarC
88
100
  },
89
101
  onClick: function onClick() {
90
102
  var _api$selectionToolbar0, _api$selectionToolbar1, _api$selectionToolbar10;
103
+ if (fg('platform_editor_use_preferences_plugin')) {
104
+ var _api$core$actions$exe4, _api$userPreferences6, _api$userPreferences7;
105
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences6 = api.userPreferences) === null || _api$userPreferences6 === void 0 || (_api$userPreferences6 = _api$userPreferences6.actions) === null || _api$userPreferences6 === void 0 || (_api$userPreferences7 = _api$userPreferences6.updateUserPreference) === null || _api$userPreferences7 === void 0 ? void 0 : _api$userPreferences7.call(_api$userPreferences6, 'toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
106
+ }
91
107
  return (_api$selectionToolbar0 = api === null || api === void 0 || (_api$selectionToolbar1 = api.selectionToolbar.actions) === null || _api$selectionToolbar1 === void 0 || (_api$selectionToolbar10 = _api$selectionToolbar1.setToolbarDocking) === null || _api$selectionToolbar10 === void 0 ? void 0 : _api$selectionToolbar10.call(_api$selectionToolbar1, 'top')) !== null && _api$selectionToolbar0 !== void 0 ? _api$selectionToolbar0 : false;
92
108
  },
93
109
  isActive: true,
@@ -4,6 +4,7 @@ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls
4
4
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
6
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
7
+ import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
7
8
  import type { ToolbarDocking } from './types';
8
9
  export type SelectionToolbarPluginOptions = {
9
10
  /** @defaults false */
@@ -21,11 +22,16 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
21
22
  OptionalPlugin<PrimaryToolbarPlugin>,
22
23
  OptionalPlugin<AnalyticsPlugin>,
23
24
  OptionalPlugin<BlockControlsPlugin>,
24
- OptionalPlugin<ConnectivityPlugin>
25
+ OptionalPlugin<ConnectivityPlugin>,
26
+ OptionalPlugin<UserPreferencesPlugin>
25
27
  ];
26
28
  actions?: {
27
29
  suppressToolbar?: () => boolean;
28
30
  unsuppressToolbar?: () => boolean;
31
+ /**
32
+ * @private
33
+ * @deprecated use userPreference API to set toolbar docking instead
34
+ */
29
35
  setToolbarDocking?: (toolbarDocking: ToolbarDocking) => boolean;
30
36
  forceToolbarDockingWithoutAnalytics?: (toolbarDocking: ToolbarDocking) => boolean;
31
37
  refreshToolbarDocking?: () => boolean;
@@ -4,6 +4,7 @@ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls
4
4
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
6
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
7
+ import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
7
8
  import type { ToolbarDocking } from './types';
8
9
  export type SelectionToolbarPluginOptions = {
9
10
  /** @defaults false */
@@ -21,11 +22,16 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
21
22
  OptionalPlugin<PrimaryToolbarPlugin>,
22
23
  OptionalPlugin<AnalyticsPlugin>,
23
24
  OptionalPlugin<BlockControlsPlugin>,
24
- OptionalPlugin<ConnectivityPlugin>
25
+ OptionalPlugin<ConnectivityPlugin>,
26
+ OptionalPlugin<UserPreferencesPlugin>
25
27
  ];
26
28
  actions?: {
27
29
  suppressToolbar?: () => boolean;
28
30
  unsuppressToolbar?: () => boolean;
31
+ /**
32
+ * @private
33
+ * @deprecated use userPreference API to set toolbar docking instead
34
+ */
29
35
  setToolbarDocking?: (toolbarDocking: ToolbarDocking) => boolean;
30
36
  forceToolbarDockingWithoutAnalytics?: (toolbarDocking: ToolbarDocking) => boolean;
31
37
  refreshToolbarDocking?: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "3.6.14",
3
+ "version": "3.7.1",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,19 +34,20 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/css": "^0.10.0",
37
- "@atlaskit/editor-common": "^106.6.0",
37
+ "@atlaskit/editor-common": "^106.9.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
39
- "@atlaskit/editor-plugin-block-controls": "^3.17.0",
39
+ "@atlaskit/editor-plugin-block-controls": "^3.19.0",
40
40
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
41
41
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
42
42
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
43
+ "@atlaskit/editor-plugin-user-preferences": "^0.2.0",
43
44
  "@atlaskit/editor-prosemirror": "7.0.0",
44
- "@atlaskit/icon": "^26.4.0",
45
- "@atlaskit/icon-lab": "^4.19.0",
45
+ "@atlaskit/icon": "^27.0.0",
46
+ "@atlaskit/icon-lab": "^5.0.0",
46
47
  "@atlaskit/menu": "^8.0.0",
47
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
- "@atlaskit/tmp-editor-statsig": "^7.0.0",
49
- "@atlaskit/tokens": "^5.1.0",
49
+ "@atlaskit/tmp-editor-statsig": "^7.1.0",
50
+ "@atlaskit/tokens": "^5.2.0",
50
51
  "@babel/runtime": "^7.0.0",
51
52
  "bind-event-listener": "^3.0.0"
52
53
  },
@@ -108,6 +109,9 @@
108
109
  "platform_editor_controls_patch_5": {
109
110
  "type": "boolean"
110
111
  },
112
+ "platform_editor_use_preferences_plugin": {
113
+ "type": "boolean"
114
+ },
111
115
  "platform_editor_controls_patch_6": {
112
116
  "type": "boolean"
113
117
  },