@atlaskit/editor-plugin-selection-toolbar 3.7.5 → 3.8.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,23 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#177157](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/177157)
8
+ [`6bcf8912217df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6bcf8912217df) -
9
+ ED-27284 additional integration with user preference plugin
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 3.7.6
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 3.7.5
4
22
 
5
23
  ### Patch Changes
@@ -158,7 +158,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
158
158
 
159
159
  // if the toolbarDockingInitialPosition preference has changed
160
160
  // update the toolbarDocking state
161
- if (!previousToolbarDocking && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4')) {
161
+ if (!previousToolbarDocking) {
162
162
  // we currently only check for the initial value
163
163
  var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
164
164
  if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
@@ -216,11 +216,6 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
216
216
  isPreferenceInitialized = true;
217
217
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
218
218
  var tr = newState.tr;
219
- if (!(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4')) {
220
- tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
221
- toolbarDocking: userToolbarDockingPref
222
- });
223
- }
224
219
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
225
220
  action: _analytics.ACTION.INITIALISED,
226
221
  actionSubject: _analytics.ACTION_SUBJECT.USER_PREFERENCES,
@@ -57,15 +57,13 @@ function PrimaryToolbarComponent(_ref) {
57
57
  item === null || item === void 0 || (_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item);
58
58
  }, []);
59
59
  (0, _react.useEffect)(function () {
60
- if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4')) {
61
- var _api$analytics;
62
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
63
- action: _analytics.ACTION.RENDERED,
64
- actionSubject: _analytics.ACTION_SUBJECT.TOOLBAR,
65
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
66
- eventType: _analytics.EVENT_TYPE.UI
67
- });
68
- }
60
+ var _api$analytics;
61
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
62
+ action: _analytics.ACTION.RENDERED,
63
+ actionSubject: _analytics.ACTION_SUBJECT.TOOLBAR,
64
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
65
+ eventType: _analytics.EVENT_TYPE.UI
66
+ });
69
67
  // eslint-disable-next-line react-hooks/exhaustive-deps
70
68
  }, []);
71
69
  return /*#__PURE__*/React.createElement(_uiMenu.DropdownMenu, {
@@ -104,13 +102,13 @@ function PrimaryToolbarComponent(_ref) {
104
102
  * button to the toolbar to the or make it in-line.
105
103
  */
106
104
  var PrimaryToolbarComponentNew = exports.PrimaryToolbarComponentNew = function PrimaryToolbarComponentNew(_ref3) {
107
- var _api$selectionToolbar;
105
+ var _api$userPreferences, _api$selectionToolbar;
108
106
  var api = _ref3.api,
109
107
  disabled = _ref3.disabled;
110
108
  var intl = (0, _reactIntlNext.useIntl)();
111
109
  var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
112
110
  var isOffline = mode === 'offline' || false;
113
- var isDockedToTop = (api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar.sharedState.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top';
111
+ var isDockedToTop = (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? (api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.preferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.toolbarDockingPosition) === 'top' : (api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar.sharedState.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top';
114
112
  if (isDockedToTop) {
115
113
  return /*#__PURE__*/React.createElement(_uiMenu.ToolbarButton, {
116
114
  "aria-label": intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionPinedAtTop)
@@ -153,7 +153,7 @@ export const selectionToolbarPlugin = ({
153
153
 
154
154
  // if the toolbarDockingInitialPosition preference has changed
155
155
  // update the toolbarDocking state
156
- if (!previousToolbarDocking && fg('platform_editor_controls_patch_4')) {
156
+ if (!previousToolbarDocking) {
157
157
  // we currently only check for the initial value
158
158
  const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
159
159
  if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
@@ -212,11 +212,6 @@ export const selectionToolbarPlugin = ({
212
212
  isPreferenceInitialized = true;
213
213
  const userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
214
214
  const tr = newState.tr;
215
- if (!fg('platform_editor_controls_patch_4')) {
216
- tr.setMeta(selectionToolbarPluginKey, {
217
- toolbarDocking: userToolbarDockingPref
218
- });
219
- }
220
215
  api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
221
216
  action: ACTION.INITIALISED,
222
217
  actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
@@ -43,15 +43,13 @@ export function PrimaryToolbarComponent({
43
43
  item === null || item === void 0 ? void 0 : (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item);
44
44
  }, []);
45
45
  useEffect(() => {
46
- if (fg('platform_editor_controls_patch_4')) {
47
- var _api$analytics;
48
- api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
49
- action: ACTION.RENDERED,
50
- actionSubject: ACTION_SUBJECT.TOOLBAR,
51
- actionSubjectId: ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
52
- eventType: EVENT_TYPE.UI
53
- });
54
- }
46
+ var _api$analytics;
47
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
48
+ action: ACTION.RENDERED,
49
+ actionSubject: ACTION_SUBJECT.TOOLBAR,
50
+ actionSubjectId: ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
51
+ eventType: EVENT_TYPE.UI
52
+ });
55
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
54
  }, []);
57
55
  return /*#__PURE__*/React.createElement(DropdownMenu, {
@@ -91,11 +89,11 @@ export const PrimaryToolbarComponentNew = ({
91
89
  api,
92
90
  disabled
93
91
  }) => {
94
- var _api$selectionToolbar;
92
+ var _api$userPreferences, _api$userPreferences$, _api$userPreferences$2, _api$selectionToolbar;
95
93
  const intl = useIntl();
96
94
  const mode = useSharedPluginStateSelector(api, 'connectivity.mode');
97
95
  const isOffline = mode === 'offline' || false;
98
- const isDockedToTop = (api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar.sharedState.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top';
96
+ const isDockedToTop = fg('platform_editor_use_preferences_plugin') ? (api === null || api === void 0 ? void 0 : (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : (_api$userPreferences$ = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences$ === void 0 ? void 0 : (_api$userPreferences$2 = _api$userPreferences$.preferences) === null || _api$userPreferences$2 === void 0 ? void 0 : _api$userPreferences$2.toolbarDockingPosition) === 'top' : (api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar.sharedState.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top';
99
97
  if (isDockedToTop) {
100
98
  return /*#__PURE__*/React.createElement(ToolbarButton, {
101
99
  "aria-label": intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop)
@@ -151,7 +151,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
151
151
 
152
152
  // if the toolbarDockingInitialPosition preference has changed
153
153
  // update the toolbarDocking state
154
- if (!previousToolbarDocking && fg('platform_editor_controls_patch_4')) {
154
+ if (!previousToolbarDocking) {
155
155
  // we currently only check for the initial value
156
156
  var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
157
157
  if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
@@ -209,11 +209,6 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
209
209
  isPreferenceInitialized = true;
210
210
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
211
211
  var tr = newState.tr;
212
- if (!fg('platform_editor_controls_patch_4')) {
213
- tr.setMeta(selectionToolbarPluginKey, {
214
- toolbarDocking: userToolbarDockingPref
215
- });
216
- }
217
212
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
218
213
  action: ACTION.INITIALISED,
219
214
  actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
@@ -47,15 +47,13 @@ export function PrimaryToolbarComponent(_ref) {
47
47
  item === null || item === void 0 || (_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item);
48
48
  }, []);
49
49
  useEffect(function () {
50
- if (fg('platform_editor_controls_patch_4')) {
51
- var _api$analytics;
52
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
53
- action: ACTION.RENDERED,
54
- actionSubject: ACTION_SUBJECT.TOOLBAR,
55
- actionSubjectId: ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
56
- eventType: EVENT_TYPE.UI
57
- });
58
- }
50
+ var _api$analytics;
51
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
52
+ action: ACTION.RENDERED,
53
+ actionSubject: ACTION_SUBJECT.TOOLBAR,
54
+ actionSubjectId: ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
55
+ eventType: EVENT_TYPE.UI
56
+ });
59
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
60
58
  }, []);
61
59
  return /*#__PURE__*/React.createElement(DropdownMenu, {
@@ -94,13 +92,13 @@ export function PrimaryToolbarComponent(_ref) {
94
92
  * button to the toolbar to the or make it in-line.
95
93
  */
96
94
  export var PrimaryToolbarComponentNew = function PrimaryToolbarComponentNew(_ref3) {
97
- var _api$selectionToolbar;
95
+ var _api$userPreferences, _api$selectionToolbar;
98
96
  var api = _ref3.api,
99
97
  disabled = _ref3.disabled;
100
98
  var intl = useIntl();
101
99
  var mode = useSharedPluginStateSelector(api, 'connectivity.mode');
102
100
  var isOffline = mode === 'offline' || false;
103
- var isDockedToTop = (api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar.sharedState.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top';
101
+ var isDockedToTop = fg('platform_editor_use_preferences_plugin') ? (api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.preferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.toolbarDockingPosition) === 'top' : (api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar.sharedState.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top';
104
102
  if (isDockedToTop) {
105
103
  return /*#__PURE__*/React.createElement(ToolbarButton, {
106
104
  "aria-label": intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "3.7.5",
3
+ "version": "3.8.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",
@@ -9,8 +9,7 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor: AI",
12
- "singleton": true,
13
- "runReact18": true
12
+ "singleton": true
14
13
  },
15
14
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
16
15
  "main": "dist/cjs/index.js",
@@ -33,21 +32,21 @@
33
32
  ".": "./src/index.ts"
34
33
  },
35
34
  "dependencies": {
36
- "@atlaskit/css": "^0.11.0",
37
- "@atlaskit/editor-common": "^107.0.0",
35
+ "@atlaskit/css": "^0.12.0",
36
+ "@atlaskit/editor-common": "^107.4.0",
38
37
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
39
38
  "@atlaskit/editor-plugin-block-controls": "^3.19.0",
40
39
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
41
40
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
42
41
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
43
- "@atlaskit/editor-plugin-user-preferences": "^0.2.0",
42
+ "@atlaskit/editor-plugin-user-preferences": "^0.3.0",
44
43
  "@atlaskit/editor-prosemirror": "7.0.0",
45
- "@atlaskit/icon": "^27.0.0",
46
- "@atlaskit/icon-lab": "^5.0.0",
44
+ "@atlaskit/icon": "^27.2.0",
45
+ "@atlaskit/icon-lab": "^5.1.0",
47
46
  "@atlaskit/menu": "^8.0.0",
48
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
50
- "@atlaskit/tokens": "^5.3.0",
48
+ "@atlaskit/tmp-editor-statsig": "^8.5.0",
49
+ "@atlaskit/tokens": "^5.4.0",
51
50
  "@babel/runtime": "^7.0.0",
52
51
  "bind-event-listener": "^3.0.0"
53
52
  },
@@ -100,9 +99,6 @@
100
99
  "platform_editor_user_preferences_provider_update": {
101
100
  "type": "boolean"
102
101
  },
103
- "platform_editor_controls_patch_4": {
104
- "type": "boolean"
105
- },
106
102
  "platform_editor_use_preferences_plugin": {
107
103
  "type": "boolean"
108
104
  }