@atlaskit/editor-plugin-selection-toolbar 2.2.0 → 2.3.0

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,13 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128813](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128813)
8
+ [`6ced71640a4ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ced71640a4ba) -
9
+ ED-26877 selection toolbar plugin refreshes with user preferences
10
+
3
11
  ## 2.2.0
4
12
 
5
13
  ### Minor Changes
@@ -53,6 +53,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
53
53
  component: primaryToolbarComponent
54
54
  });
55
55
  }
56
+ var previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
56
57
  return {
57
58
  name: 'selectionToolbar',
58
59
  actions: {
@@ -104,6 +105,22 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
104
105
  if (meta) {
105
106
  return _objectSpread(_objectSpread({}, pluginState), meta);
106
107
  }
108
+
109
+ // if the toolbarDockingInitialPosition preference has changed
110
+ // update the toolbarDocking state
111
+ if (!previousToolbarDocking) {
112
+ // we currently only check for the initial value
113
+ var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
114
+ if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
115
+ previousToolbarDocking = toolbarDockingPreference;
116
+ var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
117
+ if (pluginState.toolbarDocking !== userToolbarDockingPref) {
118
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
119
+ toolbarDocking: userToolbarDockingPref
120
+ });
121
+ }
122
+ }
123
+ }
107
124
  return pluginState;
108
125
  }
109
126
  },
@@ -44,6 +44,7 @@ export const selectionToolbarPlugin = ({
44
44
  component: primaryToolbarComponent
45
45
  });
46
46
  }
47
+ let previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
47
48
  return {
48
49
  name: 'selectionToolbar',
49
50
  actions: {
@@ -98,6 +99,23 @@ export const selectionToolbarPlugin = ({
98
99
  ...meta
99
100
  };
100
101
  }
102
+
103
+ // if the toolbarDockingInitialPosition preference has changed
104
+ // update the toolbarDocking state
105
+ if (!previousToolbarDocking) {
106
+ // we currently only check for the initial value
107
+ const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
108
+ if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
109
+ previousToolbarDocking = toolbarDockingPreference;
110
+ const userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
111
+ if (pluginState.toolbarDocking !== userToolbarDockingPref) {
112
+ return {
113
+ ...pluginState,
114
+ toolbarDocking: userToolbarDockingPref
115
+ };
116
+ }
117
+ }
118
+ }
101
119
  return pluginState;
102
120
  }
103
121
  },
@@ -46,6 +46,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
46
46
  component: primaryToolbarComponent
47
47
  });
48
48
  }
49
+ var previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
49
50
  return {
50
51
  name: 'selectionToolbar',
51
52
  actions: {
@@ -97,6 +98,22 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
97
98
  if (meta) {
98
99
  return _objectSpread(_objectSpread({}, pluginState), meta);
99
100
  }
101
+
102
+ // if the toolbarDockingInitialPosition preference has changed
103
+ // update the toolbarDocking state
104
+ if (!previousToolbarDocking) {
105
+ // we currently only check for the initial value
106
+ var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
107
+ if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
108
+ previousToolbarDocking = toolbarDockingPreference;
109
+ var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
110
+ if (pluginState.toolbarDocking !== userToolbarDockingPref) {
111
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
112
+ toolbarDocking: userToolbarDockingPref
113
+ });
114
+ }
115
+ }
116
+ }
100
117
  return pluginState;
101
118
  }
102
119
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,15 +33,15 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^102.12.0",
36
+ "@atlaskit/editor-common": "^102.13.0",
37
37
  "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
38
38
  "@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
39
39
  "@atlaskit/editor-prosemirror": "7.0.0",
40
40
  "@atlaskit/icon": "^25.0.0",
41
- "@atlaskit/icon-lab": "^4.2.0",
41
+ "@atlaskit/icon-lab": "^4.3.0",
42
42
  "@atlaskit/menu": "^3.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^4.1.0",
44
+ "@atlaskit/tmp-editor-statsig": "^4.3.0",
45
45
  "@atlaskit/tokens": "^4.5.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1",