@atlaskit/editor-plugin-selection-toolbar 3.0.0 → 3.1.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,28 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#135115](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/135115)
8
+ [`599ab2e1d386c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/599ab2e1d386c) -
9
+ ED-27314 add user preferece analytics for toolbar docking
10
+
11
+ ### Patch Changes
12
+
13
+ - [#135586](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/135586)
14
+ [`3aeba66081612`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3aeba66081612) -
15
+ ED-26593 Add missing i18n for editor control
16
+ - Updated dependencies
17
+
18
+ ## 3.0.1
19
+
20
+ ### Patch Changes
21
+
22
+ - [#134885](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134885)
23
+ [`0d61709802162`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d61709802162) -
24
+ [ux] [ED-27312] Implement new scroll left/right buttons for scrollable floating toolbars
25
+
3
26
  ## 3.0.0
4
27
 
5
28
  ### Major Changes
@@ -9,9 +9,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _bindEventListener = require("bind-event-listener");
12
+ var _analytics = require("@atlaskit/editor-common/analytics");
12
13
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
14
  var _utils = require("@atlaskit/editor-common/utils");
14
15
  var _state = require("@atlaskit/editor-prosemirror/state");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
18
  var _commands = require("./pm-plugins/commands");
17
19
  var _pluginKey = require("./pm-plugins/plugin-key");
@@ -54,6 +56,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
54
56
  });
55
57
  }
56
58
  var previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
59
+ var isPreferenceInitialized = false;
57
60
  return {
58
61
  name: 'selectionToolbar',
59
62
  actions: {
@@ -108,7 +111,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
108
111
 
109
112
  // if the toolbarDockingInitialPosition preference has changed
110
113
  // update the toolbarDocking state
111
- if (!previousToolbarDocking) {
114
+ if (!previousToolbarDocking && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2')) {
112
115
  // we currently only check for the initial value
113
116
  var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
114
117
  if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
@@ -155,6 +158,30 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
155
158
  }
156
159
  };
157
160
  },
161
+ appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
162
+ if (!isPreferenceInitialized && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2')) {
163
+ var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
164
+ if (toolbarDockingPreference !== undefined) {
165
+ var _api$analytics;
166
+ isPreferenceInitialized = true;
167
+ var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
168
+ var tr = newState.tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
169
+ toolbarDocking: userToolbarDockingPref
170
+ });
171
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
172
+ action: _analytics.ACTION.INITIALISED,
173
+ actionSubject: _analytics.ACTION_SUBJECT.USER_PREFERENCES,
174
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
175
+ attributes: {
176
+ toolbarDocking: userToolbarDockingPref
177
+ },
178
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
179
+ })(tr);
180
+ return tr;
181
+ }
182
+ }
183
+ return null;
184
+ },
158
185
  props: {
159
186
  handleDOMEvents: {
160
187
  mousedown: function mousedown(view) {
@@ -176,10 +203,11 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
176
203
  hide = _ref3.hide,
177
204
  toolbarDocking = _ref3.toolbarDocking;
178
205
  var isCellSelection = ('$anchorCell' in state.selection);
206
+ var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
179
207
  if (state.selection.empty || !selectionStable || hide || state.selection instanceof _state.NodeSelection ||
180
208
  // $anchorCell is only available in CellSelection, this check is to
181
209
  // avoid importing CellSelection from @atlaskit/editor-tables
182
- isCellSelection && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') // for Editor Controls we want to show the toolbar on CellSelection
210
+ isCellSelection && !isEditorControlsEnabled // for Editor Controls we want to show the toolbar on CellSelection
183
211
  ) {
184
212
  // If there is no active selection, or the selection is not stable, or the selection is a node selection,
185
213
  // do not show the toolbar.
@@ -242,27 +270,31 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
242
270
  }
243
271
  }
244
272
  }
245
- if (items.length > 0 && contextualFormattingEnabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
273
+ if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
246
274
  items.push.apply(items, (0, _toConsumableArray2.default)((0, _overflowToolbarConfig.getOverflowFloatingToolbarConfig)({
247
275
  api: api,
248
- toolbarDocking: toolbarDocking
276
+ toolbarDocking: toolbarDocking,
277
+ intl: intl
249
278
  })));
250
279
  }
251
280
  var onPositionCalculated;
252
281
  var toolbarTitle = 'Selection toolbar';
253
- if (isCellSelection && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
282
+ if (isCellSelection && isEditorControlsEnabled) {
254
283
  onPositionCalculated = (0, _utils.calculateToolbarPositionOnCellSelection)(toolbarTitle);
255
284
  } else {
256
285
  var calcToolbarPosition = config.preferenceToolbarAboveSelection ? _utils.calculateToolbarPositionAboveSelection : _utils.calculateToolbarPositionTrackHead;
257
286
  onPositionCalculated = calcToolbarPosition(toolbarTitle);
258
287
  }
259
288
  var nodeType = getSelectionNodeTypes(state);
260
- return {
289
+ return _objectSpread(_objectSpread({
261
290
  title: 'Selection toolbar',
262
291
  nodeType: nodeType,
263
- items: items,
292
+ items: items
293
+ }, isEditorControlsEnabled && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2') && {
294
+ scrollable: true
295
+ }), {}, {
264
296
  onPositionCalculated: onPositionCalculated
265
- };
297
+ });
266
298
  }
267
299
  },
268
300
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
@@ -12,7 +12,9 @@ var _react = _interopRequireWildcard(require("react"));
12
12
  var React = _react;
13
13
  var _runtime = require("@compiled/react/runtime");
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+ var _reactIntlNext = require("react-intl-next");
15
16
  var _keymaps = require("@atlaskit/editor-common/keymaps");
17
+ var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
16
18
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
17
19
  var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
18
20
  var _overflowToolbarConfig = require("./overflow-toolbar-config");
@@ -25,16 +27,18 @@ function PrimaryToolbarComponent(_ref) {
25
27
  popupsBoundariesElement = _ref.popupsBoundariesElement,
26
28
  popupsMountPoint = _ref.popupsMountPoint,
27
29
  popupsScrollableElement = _ref.popupsScrollableElement;
30
+ var intl = (0, _reactIntlNext.useIntl)();
28
31
  var _useState = (0, _react.useState)(false),
29
32
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
33
  isOpen = _useState2[0],
31
34
  setIsOpen = _useState2[1];
32
35
  var items = (0, _react.useMemo)(function () {
33
36
  return (0, _overflowToolbarConfig.getOverflowPrimaryToolbarConfig)({
34
- api: api
37
+ api: api,
38
+ intl: intl
35
39
  });
36
- }, [api]);
37
- var content = 'Show more items';
40
+ }, [api, intl]);
41
+ var content = intl.formatMessage(_messages.default.viewMore);
38
42
  var onClick = (0, _react.useCallback)(function () {
39
43
  setIsOpen(!isOpen);
40
44
  }, [isOpen]);
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.getOverflowPrimaryToolbarConfig = exports.getOverflowFloatingToolbarConfig = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _runtime = require("@compiled/react/runtime");
12
+ var _messages = require("@atlaskit/editor-common/messages");
12
13
  var _dockToolbarTop = _interopRequireDefault(require("@atlaskit/icon-lab/core/dock-toolbar-top"));
13
14
  var _minus = _interopRequireDefault(require("@atlaskit/icon/core/minus"));
14
15
  var _checkMark = _interopRequireDefault(require("@atlaskit/icon/utility/check-mark"));
@@ -18,32 +19,33 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
18
19
  // New editor controls
19
20
  var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig = function getOverflowFloatingToolbarConfig(_ref) {
20
21
  var api = _ref.api,
21
- toolbarDocking = _ref.toolbarDocking;
22
+ toolbarDocking = _ref.toolbarDocking,
23
+ intl = _ref.intl;
22
24
  var isDockedToTop = toolbarDocking === 'top';
23
25
  var dropdownOptions = [{
24
26
  type: 'overflow-dropdown-heading',
25
- title: 'Toolbar appears'
27
+ title: intl.formatMessage(_messages.selectionToolbarMessages.toolbarAppears)
26
28
  }, {
27
- title: 'In-line with text',
29
+ title: intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionInline),
28
30
  onClick: function onClick() {
29
31
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
30
32
  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;
31
33
  },
32
34
  icon: (0, _minus.default)({
33
- label: 'Contextual toolbar'
35
+ label: ''
34
36
  }),
35
37
  selected: !isDockedToTop,
36
38
  elemAfter: !isDockedToTop ? /*#__PURE__*/React.createElement(_checkMark.default, {
37
39
  label: ""
38
40
  }) : undefined
39
41
  }, {
40
- title: 'Fixed at top',
42
+ title: intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionFixedAtTop),
41
43
  onClick: function onClick() {
42
44
  var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
43
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;
44
46
  },
45
47
  icon: (0, _dockToolbarTop.default)({
46
- label: 'Fixed toolbar'
48
+ label: ''
47
49
  }),
48
50
  selected: isDockedToTop,
49
51
  elemAfter: isDockedToTop ? /*#__PURE__*/React.createElement(_checkMark.default, {
@@ -60,16 +62,17 @@ var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig
60
62
  }];
61
63
  };
62
64
  var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig = function getOverflowPrimaryToolbarConfig(_ref2) {
63
- var api = _ref2.api;
65
+ var api = _ref2.api,
66
+ intl = _ref2.intl;
64
67
  return [{
65
68
  items: [{
66
- content: /*#__PURE__*/React.createElement(_menu.HeadingItem, null, "Toolbar appears"),
69
+ content: /*#__PURE__*/React.createElement(_menu.HeadingItem, null, intl.formatMessage(_messages.selectionToolbarMessages.toolbarAppears)),
67
70
  value: {
68
71
  name: ''
69
72
  },
70
73
  isDisabled: true
71
74
  }, {
72
- content: 'In-line with text',
75
+ content: intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionInline),
73
76
  value: {
74
77
  name: 'contextual'
75
78
  },
@@ -78,10 +81,10 @@ var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig =
78
81
  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;
79
82
  },
80
83
  elemBefore: (0, _minus.default)({
81
- label: 'Contextual toolbar'
84
+ label: ''
82
85
  })
83
86
  }, {
84
- content: 'Fixed at top',
87
+ content: intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionFixedAtTop),
85
88
  value: {
86
89
  name: 'fixed'
87
90
  },
@@ -91,7 +94,7 @@ var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig =
91
94
  },
92
95
  isActive: true,
93
96
  elemBefore: (0, _dockToolbarTop.default)({
94
- label: 'Fixed toolbar'
97
+ label: ''
95
98
  }),
96
99
  elemAfter: /*#__PURE__*/React.createElement(_checkMark.default, {
97
100
  label: ""
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { bind } from 'bind-event-listener';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
5
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
6
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
9
  import { setToolbarDocking, toggleToolbar } from './pm-plugins/commands';
8
10
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
@@ -45,6 +47,7 @@ export const selectionToolbarPlugin = ({
45
47
  });
46
48
  }
47
49
  let previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
50
+ let isPreferenceInitialized = false;
48
51
  return {
49
52
  name: 'selectionToolbar',
50
53
  actions: {
@@ -102,7 +105,7 @@ export const selectionToolbarPlugin = ({
102
105
 
103
106
  // if the toolbarDockingInitialPosition preference has changed
104
107
  // update the toolbarDocking state
105
- if (!previousToolbarDocking) {
108
+ if (!previousToolbarDocking && !fg('platform_editor_controls_patch_2')) {
106
109
  // we currently only check for the initial value
107
110
  const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
108
111
  if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
@@ -150,6 +153,30 @@ export const selectionToolbarPlugin = ({
150
153
  }
151
154
  };
152
155
  },
156
+ appendTransaction(_transactions, _oldState, newState) {
157
+ if (!isPreferenceInitialized && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2')) {
158
+ const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
159
+ if (toolbarDockingPreference !== undefined) {
160
+ var _api$analytics;
161
+ isPreferenceInitialized = true;
162
+ const userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
163
+ const tr = newState.tr.setMeta(selectionToolbarPluginKey, {
164
+ toolbarDocking: userToolbarDockingPref
165
+ });
166
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
167
+ action: ACTION.INITIALISED,
168
+ actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
169
+ actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
170
+ attributes: {
171
+ toolbarDocking: userToolbarDockingPref
172
+ },
173
+ eventType: EVENT_TYPE.OPERATIONAL
174
+ })(tr);
175
+ return tr;
176
+ }
177
+ }
178
+ return null;
179
+ },
153
180
  props: {
154
181
  handleDOMEvents: {
155
182
  mousedown: view => {
@@ -172,10 +199,11 @@ export const selectionToolbarPlugin = ({
172
199
  toolbarDocking
173
200
  } = selectionToolbarPluginKey.getState(state);
174
201
  const isCellSelection = ('$anchorCell' in state.selection);
202
+ const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
175
203
  if (state.selection.empty || !selectionStable || hide || state.selection instanceof NodeSelection ||
176
204
  // $anchorCell is only available in CellSelection, this check is to
177
205
  // avoid importing CellSelection from @atlaskit/editor-tables
178
- isCellSelection && editorExperiment('platform_editor_controls', 'control') // for Editor Controls we want to show the toolbar on CellSelection
206
+ isCellSelection && !isEditorControlsEnabled // for Editor Controls we want to show the toolbar on CellSelection
179
207
  ) {
180
208
  // If there is no active selection, or the selection is not stable, or the selection is a node selection,
181
209
  // do not show the toolbar.
@@ -234,15 +262,16 @@ export const selectionToolbarPlugin = ({
234
262
  }
235
263
  }
236
264
  }
237
- if (items.length > 0 && contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1')) {
265
+ if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
238
266
  items.push(...getOverflowFloatingToolbarConfig({
239
267
  api,
240
- toolbarDocking
268
+ toolbarDocking,
269
+ intl
241
270
  }));
242
271
  }
243
272
  let onPositionCalculated;
244
273
  const toolbarTitle = 'Selection toolbar';
245
- if (isCellSelection && editorExperiment('platform_editor_controls', 'variant1')) {
274
+ if (isCellSelection && isEditorControlsEnabled) {
246
275
  onPositionCalculated = calculateToolbarPositionOnCellSelection(toolbarTitle);
247
276
  } else {
248
277
  const calcToolbarPosition = config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
@@ -253,6 +282,9 @@ export const selectionToolbarPlugin = ({
253
282
  title: 'Selection toolbar',
254
283
  nodeType: nodeType,
255
284
  items: items,
285
+ ...(isEditorControlsEnabled && fg('platform_editor_controls_patch_2') && {
286
+ scrollable: true
287
+ }),
256
288
  onPositionCalculated
257
289
  };
258
290
  }
@@ -3,7 +3,9 @@ import "./PrimaryToolbarComponent.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useCallback, useMemo, useState } from 'react';
6
+ import { useIntl } from 'react-intl-next';
6
7
  import { addLink, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
8
+ import messages from '@atlaskit/editor-common/messages';
7
9
  import { ArrowKeyNavigationType, DropdownMenu, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
8
10
  import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
9
11
  import { getOverflowPrimaryToolbarConfig } from './overflow-toolbar-config';
@@ -15,11 +17,13 @@ export function PrimaryToolbarComponent({
15
17
  popupsMountPoint,
16
18
  popupsScrollableElement
17
19
  }) {
20
+ const intl = useIntl();
18
21
  const [isOpen, setIsOpen] = useState(false);
19
22
  const items = useMemo(() => getOverflowPrimaryToolbarConfig({
20
- api
21
- }), [api]);
22
- const content = 'Show more items';
23
+ api,
24
+ intl
25
+ }), [api, intl]);
26
+ const content = intl.formatMessage(messages.viewMore);
23
27
  const onClick = useCallback(() => {
24
28
  setIsOpen(!isOpen);
25
29
  }, [isOpen]);
@@ -1,6 +1,7 @@
1
1
  /* overflow-toolbar-config.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
+ import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
4
5
  import DockToolbarTopIcon from '@atlaskit/icon-lab/core/dock-toolbar-top';
5
6
  import MinusIcon from '@atlaskit/icon/core/minus';
6
7
  import CheckMarkIcon from '@atlaskit/icon/utility/check-mark';
@@ -8,33 +9,34 @@ import { HeadingItem } from '@atlaskit/menu';
8
9
  // New editor controls
9
10
  export const getOverflowFloatingToolbarConfig = ({
10
11
  api,
11
- toolbarDocking
12
+ toolbarDocking,
13
+ intl
12
14
  }) => {
13
15
  const isDockedToTop = toolbarDocking === 'top';
14
16
  const dropdownOptions = [{
15
17
  type: 'overflow-dropdown-heading',
16
- title: 'Toolbar appears'
18
+ title: intl.formatMessage(selectionToolbarMessages.toolbarAppears)
17
19
  }, {
18
- title: 'In-line with text',
20
+ title: intl.formatMessage(selectionToolbarMessages.toolbarPositionInline),
19
21
  onClick: () => {
20
22
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
21
23
  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;
22
24
  },
23
25
  icon: MinusIcon({
24
- label: 'Contextual toolbar'
26
+ label: ''
25
27
  }),
26
28
  selected: !isDockedToTop,
27
29
  elemAfter: !isDockedToTop ? /*#__PURE__*/React.createElement(CheckMarkIcon, {
28
30
  label: ""
29
31
  }) : undefined
30
32
  }, {
31
- title: 'Fixed at top',
33
+ title: intl.formatMessage(selectionToolbarMessages.toolbarPositionFixedAtTop),
32
34
  onClick: () => {
33
35
  var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
34
36
  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;
35
37
  },
36
38
  icon: DockToolbarTopIcon({
37
- label: 'Fixed toolbar'
39
+ label: ''
38
40
  }),
39
41
  selected: isDockedToTop,
40
42
  elemAfter: isDockedToTop ? /*#__PURE__*/React.createElement(CheckMarkIcon, {
@@ -51,16 +53,17 @@ export const getOverflowFloatingToolbarConfig = ({
51
53
  }];
52
54
  };
53
55
  export const getOverflowPrimaryToolbarConfig = ({
54
- api
56
+ api,
57
+ intl
55
58
  }) => [{
56
59
  items: [{
57
- content: /*#__PURE__*/React.createElement(HeadingItem, null, "Toolbar appears"),
60
+ content: /*#__PURE__*/React.createElement(HeadingItem, null, intl.formatMessage(selectionToolbarMessages.toolbarAppears)),
58
61
  value: {
59
62
  name: ''
60
63
  },
61
64
  isDisabled: true
62
65
  }, {
63
- content: 'In-line with text',
66
+ content: intl.formatMessage(selectionToolbarMessages.toolbarPositionInline),
64
67
  value: {
65
68
  name: 'contextual'
66
69
  },
@@ -69,10 +72,10 @@ export const getOverflowPrimaryToolbarConfig = ({
69
72
  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;
70
73
  },
71
74
  elemBefore: MinusIcon({
72
- label: 'Contextual toolbar'
75
+ label: ''
73
76
  })
74
77
  }, {
75
- content: 'Fixed at top',
78
+ content: intl.formatMessage(selectionToolbarMessages.toolbarPositionFixedAtTop),
76
79
  value: {
77
80
  name: 'fixed'
78
81
  },
@@ -82,7 +85,7 @@ export const getOverflowPrimaryToolbarConfig = ({
82
85
  },
83
86
  isActive: true,
84
87
  elemBefore: DockToolbarTopIcon({
85
- label: 'Fixed toolbar'
88
+ label: ''
86
89
  }),
87
90
  elemAfter: /*#__PURE__*/React.createElement(CheckMarkIcon, {
88
91
  label: ""
@@ -4,9 +4,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import React from 'react';
6
6
  import { bind } from 'bind-event-listener';
7
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
9
  import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
9
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
10
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
13
  import { setToolbarDocking as _setToolbarDocking, toggleToolbar } from './pm-plugins/commands';
12
14
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
@@ -47,6 +49,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
47
49
  });
48
50
  }
49
51
  var previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
52
+ var isPreferenceInitialized = false;
50
53
  return {
51
54
  name: 'selectionToolbar',
52
55
  actions: {
@@ -101,7 +104,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
101
104
 
102
105
  // if the toolbarDockingInitialPosition preference has changed
103
106
  // update the toolbarDocking state
104
- if (!previousToolbarDocking) {
107
+ if (!previousToolbarDocking && !fg('platform_editor_controls_patch_2')) {
105
108
  // we currently only check for the initial value
106
109
  var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
107
110
  if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
@@ -148,6 +151,30 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
148
151
  }
149
152
  };
150
153
  },
154
+ appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
155
+ if (!isPreferenceInitialized && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2')) {
156
+ var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
157
+ if (toolbarDockingPreference !== undefined) {
158
+ var _api$analytics;
159
+ isPreferenceInitialized = true;
160
+ var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
161
+ var tr = newState.tr.setMeta(selectionToolbarPluginKey, {
162
+ toolbarDocking: userToolbarDockingPref
163
+ });
164
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
165
+ action: ACTION.INITIALISED,
166
+ actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
167
+ actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
168
+ attributes: {
169
+ toolbarDocking: userToolbarDockingPref
170
+ },
171
+ eventType: EVENT_TYPE.OPERATIONAL
172
+ })(tr);
173
+ return tr;
174
+ }
175
+ }
176
+ return null;
177
+ },
151
178
  props: {
152
179
  handleDOMEvents: {
153
180
  mousedown: function mousedown(view) {
@@ -169,10 +196,11 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
169
196
  hide = _ref3.hide,
170
197
  toolbarDocking = _ref3.toolbarDocking;
171
198
  var isCellSelection = ('$anchorCell' in state.selection);
199
+ var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
172
200
  if (state.selection.empty || !selectionStable || hide || state.selection instanceof NodeSelection ||
173
201
  // $anchorCell is only available in CellSelection, this check is to
174
202
  // avoid importing CellSelection from @atlaskit/editor-tables
175
- isCellSelection && editorExperiment('platform_editor_controls', 'control') // for Editor Controls we want to show the toolbar on CellSelection
203
+ isCellSelection && !isEditorControlsEnabled // for Editor Controls we want to show the toolbar on CellSelection
176
204
  ) {
177
205
  // If there is no active selection, or the selection is not stable, or the selection is a node selection,
178
206
  // do not show the toolbar.
@@ -235,27 +263,31 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
235
263
  }
236
264
  }
237
265
  }
238
- if (items.length > 0 && contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1')) {
266
+ if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
239
267
  items.push.apply(items, _toConsumableArray(getOverflowFloatingToolbarConfig({
240
268
  api: api,
241
- toolbarDocking: toolbarDocking
269
+ toolbarDocking: toolbarDocking,
270
+ intl: intl
242
271
  })));
243
272
  }
244
273
  var onPositionCalculated;
245
274
  var toolbarTitle = 'Selection toolbar';
246
- if (isCellSelection && editorExperiment('platform_editor_controls', 'variant1')) {
275
+ if (isCellSelection && isEditorControlsEnabled) {
247
276
  onPositionCalculated = calculateToolbarPositionOnCellSelection(toolbarTitle);
248
277
  } else {
249
278
  var calcToolbarPosition = config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
250
279
  onPositionCalculated = calcToolbarPosition(toolbarTitle);
251
280
  }
252
281
  var nodeType = getSelectionNodeTypes(state);
253
- return {
282
+ return _objectSpread(_objectSpread({
254
283
  title: 'Selection toolbar',
255
284
  nodeType: nodeType,
256
- items: items,
285
+ items: items
286
+ }, isEditorControlsEnabled && fg('platform_editor_controls_patch_2') && {
287
+ scrollable: true
288
+ }), {}, {
257
289
  onPositionCalculated: onPositionCalculated
258
- };
290
+ });
259
291
  }
260
292
  },
261
293
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && editorExperiment('platform_editor_controls', 'variant1', {
@@ -4,7 +4,9 @@ import "./PrimaryToolbarComponent.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useCallback, useMemo, useState } from 'react';
7
+ import { useIntl } from 'react-intl-next';
7
8
  import { addLink, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
9
+ import messages from '@atlaskit/editor-common/messages';
8
10
  import { ArrowKeyNavigationType, DropdownMenu, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
9
11
  import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
10
12
  import { getOverflowPrimaryToolbarConfig } from './overflow-toolbar-config';
@@ -15,16 +17,18 @@ export function PrimaryToolbarComponent(_ref) {
15
17
  popupsBoundariesElement = _ref.popupsBoundariesElement,
16
18
  popupsMountPoint = _ref.popupsMountPoint,
17
19
  popupsScrollableElement = _ref.popupsScrollableElement;
20
+ var intl = useIntl();
18
21
  var _useState = useState(false),
19
22
  _useState2 = _slicedToArray(_useState, 2),
20
23
  isOpen = _useState2[0],
21
24
  setIsOpen = _useState2[1];
22
25
  var items = useMemo(function () {
23
26
  return getOverflowPrimaryToolbarConfig({
24
- api: api
27
+ api: api,
28
+ intl: intl
25
29
  });
26
- }, [api]);
27
- var content = 'Show more items';
30
+ }, [api, intl]);
31
+ var content = intl.formatMessage(messages.viewMore);
28
32
  var onClick = useCallback(function () {
29
33
  setIsOpen(!isOpen);
30
34
  }, [isOpen]);
@@ -1,6 +1,7 @@
1
1
  /* overflow-toolbar-config.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
+ import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
4
5
  import DockToolbarTopIcon from '@atlaskit/icon-lab/core/dock-toolbar-top';
5
6
  import MinusIcon from '@atlaskit/icon/core/minus';
6
7
  import CheckMarkIcon from '@atlaskit/icon/utility/check-mark';
@@ -8,32 +9,33 @@ import { HeadingItem } from '@atlaskit/menu';
8
9
  // New editor controls
9
10
  export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolbarConfig(_ref) {
10
11
  var api = _ref.api,
11
- toolbarDocking = _ref.toolbarDocking;
12
+ toolbarDocking = _ref.toolbarDocking,
13
+ intl = _ref.intl;
12
14
  var isDockedToTop = toolbarDocking === 'top';
13
15
  var dropdownOptions = [{
14
16
  type: 'overflow-dropdown-heading',
15
- title: 'Toolbar appears'
17
+ title: intl.formatMessage(selectionToolbarMessages.toolbarAppears)
16
18
  }, {
17
- title: 'In-line with text',
19
+ title: intl.formatMessage(selectionToolbarMessages.toolbarPositionInline),
18
20
  onClick: function onClick() {
19
21
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
20
22
  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;
21
23
  },
22
24
  icon: MinusIcon({
23
- label: 'Contextual toolbar'
25
+ label: ''
24
26
  }),
25
27
  selected: !isDockedToTop,
26
28
  elemAfter: !isDockedToTop ? /*#__PURE__*/React.createElement(CheckMarkIcon, {
27
29
  label: ""
28
30
  }) : undefined
29
31
  }, {
30
- title: 'Fixed at top',
32
+ title: intl.formatMessage(selectionToolbarMessages.toolbarPositionFixedAtTop),
31
33
  onClick: function onClick() {
32
34
  var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
33
35
  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;
34
36
  },
35
37
  icon: DockToolbarTopIcon({
36
- label: 'Fixed toolbar'
38
+ label: ''
37
39
  }),
38
40
  selected: isDockedToTop,
39
41
  elemAfter: isDockedToTop ? /*#__PURE__*/React.createElement(CheckMarkIcon, {
@@ -50,16 +52,17 @@ export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolba
50
52
  }];
51
53
  };
52
54
  export var getOverflowPrimaryToolbarConfig = function getOverflowPrimaryToolbarConfig(_ref2) {
53
- var api = _ref2.api;
55
+ var api = _ref2.api,
56
+ intl = _ref2.intl;
54
57
  return [{
55
58
  items: [{
56
- content: /*#__PURE__*/React.createElement(HeadingItem, null, "Toolbar appears"),
59
+ content: /*#__PURE__*/React.createElement(HeadingItem, null, intl.formatMessage(selectionToolbarMessages.toolbarAppears)),
57
60
  value: {
58
61
  name: ''
59
62
  },
60
63
  isDisabled: true
61
64
  }, {
62
- content: 'In-line with text',
65
+ content: intl.formatMessage(selectionToolbarMessages.toolbarPositionInline),
63
66
  value: {
64
67
  name: 'contextual'
65
68
  },
@@ -68,10 +71,10 @@ export var getOverflowPrimaryToolbarConfig = function getOverflowPrimaryToolbarC
68
71
  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;
69
72
  },
70
73
  elemBefore: MinusIcon({
71
- label: 'Contextual toolbar'
74
+ label: ''
72
75
  })
73
76
  }, {
74
- content: 'Fixed at top',
77
+ content: intl.formatMessage(selectionToolbarMessages.toolbarPositionFixedAtTop),
75
78
  value: {
76
79
  name: 'fixed'
77
80
  },
@@ -81,7 +84,7 @@ export var getOverflowPrimaryToolbarConfig = function getOverflowPrimaryToolbarC
81
84
  },
82
85
  isActive: true,
83
86
  elemBefore: DockToolbarTopIcon({
84
- label: 'Fixed toolbar'
87
+ label: ''
85
88
  }),
86
89
  elemAfter: /*#__PURE__*/React.createElement(CheckMarkIcon, {
87
90
  label: ""
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin, UserPreferencesProvider } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
3
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
3
4
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
4
5
  import type { ToolbarDocking } from './types';
@@ -14,7 +15,11 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
14
15
  userPreferencesProvider?: UserPreferencesProvider;
15
16
  contextualFormattingEnabled?: boolean;
16
17
  };
17
- dependencies: [OptionalPlugin<EditorViewModePlugin>, OptionalPlugin<PrimaryToolbarPlugin>];
18
+ dependencies: [
19
+ OptionalPlugin<EditorViewModePlugin>,
20
+ OptionalPlugin<PrimaryToolbarPlugin>,
21
+ OptionalPlugin<AnalyticsPlugin>
22
+ ];
18
23
  actions?: {
19
24
  suppressToolbar?: () => boolean;
20
25
  unsuppressToolbar?: () => boolean;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ * @jsxFrag
5
+ */
6
+ import { IntlShape } from 'react-intl-next';
1
7
  import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
2
8
  import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
9
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
@@ -5,9 +11,10 @@ import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
5
11
  type OverflowToobarConfigOptions = {
6
12
  api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
7
13
  toolbarDocking?: 'top' | 'none';
14
+ intl: IntlShape;
8
15
  };
9
- export declare const getOverflowFloatingToolbarConfig: ({ api, toolbarDocking, }: OverflowToobarConfigOptions) => FloatingToolbarItem<Command>[];
10
- export declare const getOverflowPrimaryToolbarConfig: ({ api, }: OverflowToobarConfigOptions) => {
16
+ export declare const getOverflowFloatingToolbarConfig: ({ api, toolbarDocking, intl, }: OverflowToobarConfigOptions) => FloatingToolbarItem<Command>[];
17
+ export declare const getOverflowPrimaryToolbarConfig: ({ api, intl, }: OverflowToobarConfigOptions) => {
11
18
  items: MenuItem[];
12
19
  }[];
13
20
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin, UserPreferencesProvider } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
3
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
3
4
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
4
5
  import type { ToolbarDocking } from './types';
@@ -16,7 +17,8 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
16
17
  };
17
18
  dependencies: [
18
19
  OptionalPlugin<EditorViewModePlugin>,
19
- OptionalPlugin<PrimaryToolbarPlugin>
20
+ OptionalPlugin<PrimaryToolbarPlugin>,
21
+ OptionalPlugin<AnalyticsPlugin>
20
22
  ];
21
23
  actions?: {
22
24
  suppressToolbar?: () => boolean;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ * @jsxFrag
5
+ */
6
+ import { IntlShape } from 'react-intl-next';
1
7
  import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
2
8
  import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
9
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
@@ -5,9 +11,10 @@ import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
5
11
  type OverflowToobarConfigOptions = {
6
12
  api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
7
13
  toolbarDocking?: 'top' | 'none';
14
+ intl: IntlShape;
8
15
  };
9
- export declare const getOverflowFloatingToolbarConfig: ({ api, toolbarDocking, }: OverflowToobarConfigOptions) => FloatingToolbarItem<Command>[];
10
- export declare const getOverflowPrimaryToolbarConfig: ({ api, }: OverflowToobarConfigOptions) => {
16
+ export declare const getOverflowFloatingToolbarConfig: ({ api, toolbarDocking, intl, }: OverflowToobarConfigOptions) => FloatingToolbarItem<Command>[];
17
+ export declare const getOverflowPrimaryToolbarConfig: ({ api, intl, }: OverflowToobarConfigOptions) => {
11
18
  items: MenuItem[];
12
19
  }[];
13
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "3.0.0",
3
+ "version": "3.1.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",
@@ -34,22 +34,24 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/css": "^0.10.0",
37
- "@atlaskit/editor-common": "^102.13.0",
37
+ "@atlaskit/editor-common": "^102.18.0",
38
+ "@atlaskit/editor-plugin-analytics": "^2.2.0",
38
39
  "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
39
40
  "@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
40
41
  "@atlaskit/editor-prosemirror": "7.0.0",
41
- "@atlaskit/icon": "^25.2.0",
42
- "@atlaskit/icon-lab": "^4.5.0",
43
- "@atlaskit/menu": "^3.1.0",
42
+ "@atlaskit/icon": "^25.5.0",
43
+ "@atlaskit/icon-lab": "^4.6.0",
44
+ "@atlaskit/menu": "^3.2.0",
44
45
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^4.4.0",
46
- "@atlaskit/tokens": "^4.5.0",
46
+ "@atlaskit/tmp-editor-statsig": "^4.6.0",
47
+ "@atlaskit/tokens": "^4.6.0",
47
48
  "@babel/runtime": "^7.0.0",
48
49
  "bind-event-listener": "^3.0.0"
49
50
  },
50
51
  "peerDependencies": {
51
52
  "react": "^18.2.0",
52
- "react-dom": "^18.2.0"
53
+ "react-dom": "^18.2.0",
54
+ "react-intl-next": "npm:react-intl@^5.18.1"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@af/visual-regression": "^1.3.0",
@@ -90,5 +92,10 @@
90
92
  "compiled"
91
93
  ]
92
94
  }
95
+ },
96
+ "platform-feature-flags": {
97
+ "platform_editor_controls_patch_2": {
98
+ "type": "boolean"
99
+ }
93
100
  }
94
101
  }