@atlaskit/editor-plugin-selection-toolbar 7.0.7 → 7.0.9

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-selection-toolbar
2
2
 
3
+ ## 7.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 7.0.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c04bcabb31f7c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c04bcabb31f7c) -
14
+ [ux] ED-29513 Force showing pinning toolbar for LCM using user preferences plugin
15
+ - Updated dependencies
16
+
3
17
  ## 7.0.7
4
18
 
5
19
  ### Patch Changes
@@ -98,19 +98,26 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
98
98
  }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
99
99
  },
100
100
  forceToolbarDockingWithoutAnalytics: function forceToolbarDockingWithoutAnalytics(toolbarDocking) {
101
- var _api$core$actions$exe5;
102
- return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.forceToolbarDockingWithoutAnalytics)({
101
+ var _api$core$actions$exe6;
102
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
103
+ if ((0, _platformFeatureFlags.fg)('platform_editor_lcm_toolbar_docking_fix')) {
104
+ var _api$core$actions$exe5, _api$userPreferences2;
105
+ // to avoid nested gate. Will remove when cleaning up platform_editor_lcm_toolbar_docking_fix
106
+ return (_api$core$actions$exe5 = 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 ? void 0 : _api$userPreferences2.actions.updateUserPreference('toolbarDockingPosition', toolbarDocking))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
107
+ }
108
+ }
109
+ return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.forceToolbarDockingWithoutAnalytics)({
103
110
  toolbarDocking: toolbarDocking,
104
111
  userPreferencesProvider: userPreferencesProvider
105
- }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
112
+ }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
106
113
  },
107
114
  refreshToolbarDocking: function refreshToolbarDocking() {
108
115
  if (userPreferencesProvider) {
109
- var _api$core$actions$exe6;
116
+ var _api$core$actions$exe7;
110
117
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
111
- return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.updateToolbarDocking)({
118
+ return (_api$core$actions$exe7 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.updateToolbarDocking)({
112
119
  toolbarDocking: userToolbarDockingPref
113
- }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
120
+ }))) !== null && _api$core$actions$exe7 !== void 0 ? _api$core$actions$exe7 : false;
114
121
  }
115
122
  return false;
116
123
  }
@@ -122,11 +129,11 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
122
129
  return _pluginKey.selectionToolbarPluginKey.getState(editorState);
123
130
  },
124
131
  pmPlugins: function pmPlugins(selectionToolbarHandlers) {
125
- var _api$userPreferences2;
132
+ var _api$userPreferences3;
126
133
  if (selectionToolbarHandlers) {
127
134
  __selectionToolbarHandlers.push.apply(__selectionToolbarHandlers, (0, _toConsumableArray2.default)(selectionToolbarHandlers));
128
135
  }
129
- 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);
136
+ var initialToolbarDocking = (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? getToolbarDockingV2(contextualFormattingEnabled, 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) : getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
130
137
  return [{
131
138
  name: 'selection-tracker',
132
139
  plugin: function plugin() {
@@ -330,8 +337,8 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
330
337
  }
331
338
  }
332
339
  if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
333
- var _api$userPreferences3;
334
- 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;
340
+ var _api$userPreferences4;
341
+ var toolbarDockingPref = api !== null && api !== void 0 && api.userPreferences && (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences4 = api.userPreferences) === null || _api$userPreferences4 === void 0 || (_api$userPreferences4 = _api$userPreferences4.sharedState.currentState()) === null || _api$userPreferences4 === void 0 || (_api$userPreferences4 = _api$userPreferences4.preferences) === null || _api$userPreferences4 === void 0 ? void 0 : _api$userPreferences4.toolbarDockingPosition : toolbarDocking;
335
342
  items.push.apply(items, (0, _toConsumableArray2.default)((0, _pinToolbarConfig.getPinOptionToolbarConfig)({
336
343
  api: api,
337
344
  toolbarDocking: toolbarDockingPref,
@@ -91,19 +91,26 @@ export const selectionToolbarPlugin = ({
91
91
  }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
92
92
  },
93
93
  forceToolbarDockingWithoutAnalytics: toolbarDocking => {
94
- var _api$core$actions$exe5;
95
- return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(forceToolbarDockingWithoutAnalytics({
94
+ var _api$core$actions$exe6;
95
+ if (fg('platform_editor_use_preferences_plugin')) {
96
+ if (fg('platform_editor_lcm_toolbar_docking_fix')) {
97
+ var _api$core$actions$exe5, _api$userPreferences2;
98
+ // to avoid nested gate. Will remove when cleaning up platform_editor_lcm_toolbar_docking_fix
99
+ return (_api$core$actions$exe5 = 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$userPreferences2.actions.updateUserPreference('toolbarDockingPosition', toolbarDocking))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
100
+ }
101
+ }
102
+ return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute(forceToolbarDockingWithoutAnalytics({
96
103
  toolbarDocking,
97
104
  userPreferencesProvider
98
- }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
105
+ }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
99
106
  },
100
107
  refreshToolbarDocking: () => {
101
108
  if (userPreferencesProvider) {
102
- var _api$core$actions$exe6;
109
+ var _api$core$actions$exe7;
103
110
  const userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
104
- return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
111
+ return (_api$core$actions$exe7 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
105
112
  toolbarDocking: userToolbarDockingPref
106
- }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
113
+ }))) !== null && _api$core$actions$exe7 !== void 0 ? _api$core$actions$exe7 : false;
107
114
  }
108
115
  return false;
109
116
  }
@@ -115,11 +122,11 @@ export const selectionToolbarPlugin = ({
115
122
  return selectionToolbarPluginKey.getState(editorState);
116
123
  },
117
124
  pmPlugins(selectionToolbarHandlers) {
118
- var _api$userPreferences2, _api$userPreferences3, _api$userPreferences4;
125
+ var _api$userPreferences3, _api$userPreferences4, _api$userPreferences5;
119
126
  if (selectionToolbarHandlers) {
120
127
  __selectionToolbarHandlers.push(...selectionToolbarHandlers);
121
128
  }
122
- 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);
129
+ const initialToolbarDocking = fg('platform_editor_use_preferences_plugin') ? getToolbarDockingV2(contextualFormattingEnabled, api === null || api === void 0 ? void 0 : (_api$userPreferences3 = api.userPreferences) === null || _api$userPreferences3 === void 0 ? void 0 : (_api$userPreferences4 = _api$userPreferences3.sharedState.currentState()) === null || _api$userPreferences4 === void 0 ? void 0 : (_api$userPreferences5 = _api$userPreferences4.preferences) === null || _api$userPreferences5 === void 0 ? void 0 : _api$userPreferences5.toolbarDockingPosition) : getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
123
130
  return [{
124
131
  name: 'selection-tracker',
125
132
  plugin: () => {
@@ -325,8 +332,8 @@ export const selectionToolbarPlugin = ({
325
332
  }
326
333
  }
327
334
  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;
335
+ var _api$userPreferences6, _api$userPreferences7, _api$userPreferences8;
336
+ const toolbarDockingPref = api !== null && api !== void 0 && api.userPreferences && fg('platform_editor_use_preferences_plugin') ? api === null || api === void 0 ? void 0 : (_api$userPreferences6 = api.userPreferences) === null || _api$userPreferences6 === void 0 ? void 0 : (_api$userPreferences7 = _api$userPreferences6.sharedState.currentState()) === null || _api$userPreferences7 === void 0 ? void 0 : (_api$userPreferences8 = _api$userPreferences7.preferences) === null || _api$userPreferences8 === void 0 ? void 0 : _api$userPreferences8.toolbarDockingPosition : toolbarDocking;
330
337
  items.push(...getPinOptionToolbarConfig({
331
338
  api,
332
339
  toolbarDocking: toolbarDockingPref,
@@ -91,19 +91,26 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
91
91
  }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
92
92
  },
93
93
  forceToolbarDockingWithoutAnalytics: function forceToolbarDockingWithoutAnalytics(toolbarDocking) {
94
- var _api$core$actions$exe5;
95
- return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_forceToolbarDockingWithoutAnalytics({
94
+ var _api$core$actions$exe6;
95
+ if (fg('platform_editor_use_preferences_plugin')) {
96
+ if (fg('platform_editor_lcm_toolbar_docking_fix')) {
97
+ var _api$core$actions$exe5, _api$userPreferences2;
98
+ // to avoid nested gate. Will remove when cleaning up platform_editor_lcm_toolbar_docking_fix
99
+ return (_api$core$actions$exe5 = 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 ? void 0 : _api$userPreferences2.actions.updateUserPreference('toolbarDockingPosition', toolbarDocking))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
100
+ }
101
+ }
102
+ return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_forceToolbarDockingWithoutAnalytics({
96
103
  toolbarDocking: toolbarDocking,
97
104
  userPreferencesProvider: userPreferencesProvider
98
- }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
105
+ }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
99
106
  },
100
107
  refreshToolbarDocking: function refreshToolbarDocking() {
101
108
  if (userPreferencesProvider) {
102
- var _api$core$actions$exe6;
109
+ var _api$core$actions$exe7;
103
110
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
104
- return (_api$core$actions$exe6 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
111
+ return (_api$core$actions$exe7 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
105
112
  toolbarDocking: userToolbarDockingPref
106
- }))) !== null && _api$core$actions$exe6 !== void 0 ? _api$core$actions$exe6 : false;
113
+ }))) !== null && _api$core$actions$exe7 !== void 0 ? _api$core$actions$exe7 : false;
107
114
  }
108
115
  return false;
109
116
  }
@@ -115,11 +122,11 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
115
122
  return selectionToolbarPluginKey.getState(editorState);
116
123
  },
117
124
  pmPlugins: function pmPlugins(selectionToolbarHandlers) {
118
- var _api$userPreferences2;
125
+ var _api$userPreferences3;
119
126
  if (selectionToolbarHandlers) {
120
127
  __selectionToolbarHandlers.push.apply(__selectionToolbarHandlers, _toConsumableArray(selectionToolbarHandlers));
121
128
  }
122
- 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);
129
+ var initialToolbarDocking = fg('platform_editor_use_preferences_plugin') ? getToolbarDockingV2(contextualFormattingEnabled, 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) : getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
123
130
  return [{
124
131
  name: 'selection-tracker',
125
132
  plugin: function plugin() {
@@ -323,8 +330,8 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
323
330
  }
324
331
  }
325
332
  if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
326
- var _api$userPreferences3;
327
- 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;
333
+ var _api$userPreferences4;
334
+ var toolbarDockingPref = api !== null && api !== void 0 && api.userPreferences && fg('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences4 = api.userPreferences) === null || _api$userPreferences4 === void 0 || (_api$userPreferences4 = _api$userPreferences4.sharedState.currentState()) === null || _api$userPreferences4 === void 0 || (_api$userPreferences4 = _api$userPreferences4.preferences) === null || _api$userPreferences4 === void 0 ? void 0 : _api$userPreferences4.toolbarDockingPosition : toolbarDocking;
328
335
  items.push.apply(items, _toConsumableArray(getPinOptionToolbarConfig({
329
336
  api: api,
330
337
  toolbarDocking: toolbarDockingPref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "7.0.7",
3
+ "version": "7.0.9",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,24 +35,24 @@
35
35
  "@atlaskit/editor-plugin-connectivity": "^6.0.0",
36
36
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
37
37
  "@atlaskit/editor-plugin-primary-toolbar": "^7.0.0",
38
- "@atlaskit/editor-plugin-toolbar": "^3.1.0",
38
+ "@atlaskit/editor-plugin-toolbar": "^3.2.0",
39
39
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
40
40
  "@atlaskit/editor-plugin-user-preferences": "^4.0.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
42
- "@atlaskit/editor-toolbar": "^0.14.0",
42
+ "@atlaskit/editor-toolbar": "^0.15.0",
43
43
  "@atlaskit/editor-toolbar-model": "^0.2.0",
44
- "@atlaskit/icon": "^28.4.0",
45
- "@atlaskit/icon-lab": "^5.9.0",
44
+ "@atlaskit/icon": "^28.5.0",
45
+ "@atlaskit/icon-lab": "^5.10.0",
46
46
  "@atlaskit/menu": "^8.4.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^13.2.0",
49
+ "@atlaskit/tmp-editor-statsig": "^13.8.0",
50
50
  "@atlaskit/tokens": "^6.4.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "bind-event-listener": "^3.0.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@atlaskit/editor-common": "^110.4.0",
55
+ "@atlaskit/editor-common": "^110.10.0",
56
56
  "react": "^18.2.0",
57
57
  "react-dom": "^18.2.0",
58
58
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -104,6 +104,9 @@
104
104
  },
105
105
  "aifc_create_enabled": {
106
106
  "type": "boolean"
107
+ },
108
+ "platform_editor_lcm_toolbar_docking_fix": {
109
+ "type": "boolean"
107
110
  }
108
111
  }
109
112
  }