@atlaskit/editor-plugin-selection-toolbar 3.0.0 → 3.0.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,13 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#134885](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134885)
8
+ [`0d61709802162`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d61709802162) -
9
+ [ux] [ED-27312] Implement new scroll left/right buttons for scrollable floating toolbars
10
+
3
11
  ## 3.0.0
4
12
 
5
13
  ### Major Changes
@@ -12,6 +12,7 @@ var _bindEventListener = require("bind-event-listener");
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
13
  var _utils = require("@atlaskit/editor-common/utils");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
17
  var _commands = require("./pm-plugins/commands");
17
18
  var _pluginKey = require("./pm-plugins/plugin-key");
@@ -176,10 +177,11 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
176
177
  hide = _ref3.hide,
177
178
  toolbarDocking = _ref3.toolbarDocking;
178
179
  var isCellSelection = ('$anchorCell' in state.selection);
180
+ var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
179
181
  if (state.selection.empty || !selectionStable || hide || state.selection instanceof _state.NodeSelection ||
180
182
  // $anchorCell is only available in CellSelection, this check is to
181
183
  // 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
184
+ isCellSelection && !isEditorControlsEnabled // for Editor Controls we want to show the toolbar on CellSelection
183
185
  ) {
184
186
  // If there is no active selection, or the selection is not stable, or the selection is a node selection,
185
187
  // do not show the toolbar.
@@ -242,7 +244,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
242
244
  }
243
245
  }
244
246
  }
245
- if (items.length > 0 && contextualFormattingEnabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
247
+ if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
246
248
  items.push.apply(items, (0, _toConsumableArray2.default)((0, _overflowToolbarConfig.getOverflowFloatingToolbarConfig)({
247
249
  api: api,
248
250
  toolbarDocking: toolbarDocking
@@ -250,19 +252,22 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
250
252
  }
251
253
  var onPositionCalculated;
252
254
  var toolbarTitle = 'Selection toolbar';
253
- if (isCellSelection && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
255
+ if (isCellSelection && isEditorControlsEnabled) {
254
256
  onPositionCalculated = (0, _utils.calculateToolbarPositionOnCellSelection)(toolbarTitle);
255
257
  } else {
256
258
  var calcToolbarPosition = config.preferenceToolbarAboveSelection ? _utils.calculateToolbarPositionAboveSelection : _utils.calculateToolbarPositionTrackHead;
257
259
  onPositionCalculated = calcToolbarPosition(toolbarTitle);
258
260
  }
259
261
  var nodeType = getSelectionNodeTypes(state);
260
- return {
262
+ return _objectSpread(_objectSpread({
261
263
  title: 'Selection toolbar',
262
264
  nodeType: nodeType,
263
- items: items,
265
+ items: items
266
+ }, isEditorControlsEnabled && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2') && {
267
+ scrollable: true
268
+ }), {}, {
264
269
  onPositionCalculated: onPositionCalculated
265
- };
270
+ });
266
271
  }
267
272
  },
268
273
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
@@ -3,6 +3,7 @@ import { bind } from 'bind-event-listener';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
  import { setToolbarDocking, toggleToolbar } from './pm-plugins/commands';
8
9
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
@@ -172,10 +173,11 @@ export const selectionToolbarPlugin = ({
172
173
  toolbarDocking
173
174
  } = selectionToolbarPluginKey.getState(state);
174
175
  const isCellSelection = ('$anchorCell' in state.selection);
176
+ const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
175
177
  if (state.selection.empty || !selectionStable || hide || state.selection instanceof NodeSelection ||
176
178
  // $anchorCell is only available in CellSelection, this check is to
177
179
  // 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
180
+ isCellSelection && !isEditorControlsEnabled // for Editor Controls we want to show the toolbar on CellSelection
179
181
  ) {
180
182
  // If there is no active selection, or the selection is not stable, or the selection is a node selection,
181
183
  // do not show the toolbar.
@@ -234,7 +236,7 @@ export const selectionToolbarPlugin = ({
234
236
  }
235
237
  }
236
238
  }
237
- if (items.length > 0 && contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1')) {
239
+ if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
238
240
  items.push(...getOverflowFloatingToolbarConfig({
239
241
  api,
240
242
  toolbarDocking
@@ -242,7 +244,7 @@ export const selectionToolbarPlugin = ({
242
244
  }
243
245
  let onPositionCalculated;
244
246
  const toolbarTitle = 'Selection toolbar';
245
- if (isCellSelection && editorExperiment('platform_editor_controls', 'variant1')) {
247
+ if (isCellSelection && isEditorControlsEnabled) {
246
248
  onPositionCalculated = calculateToolbarPositionOnCellSelection(toolbarTitle);
247
249
  } else {
248
250
  const calcToolbarPosition = config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
@@ -253,6 +255,9 @@ export const selectionToolbarPlugin = ({
253
255
  title: 'Selection toolbar',
254
256
  nodeType: nodeType,
255
257
  items: items,
258
+ ...(isEditorControlsEnabled && fg('platform_editor_controls_patch_2') && {
259
+ scrollable: true
260
+ }),
256
261
  onPositionCalculated
257
262
  };
258
263
  }
@@ -7,6 +7,7 @@ import { bind } from 'bind-event-listener';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
12
  import { setToolbarDocking as _setToolbarDocking, toggleToolbar } from './pm-plugins/commands';
12
13
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
@@ -169,10 +170,11 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
169
170
  hide = _ref3.hide,
170
171
  toolbarDocking = _ref3.toolbarDocking;
171
172
  var isCellSelection = ('$anchorCell' in state.selection);
173
+ var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
172
174
  if (state.selection.empty || !selectionStable || hide || state.selection instanceof NodeSelection ||
173
175
  // $anchorCell is only available in CellSelection, this check is to
174
176
  // 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
177
+ isCellSelection && !isEditorControlsEnabled // for Editor Controls we want to show the toolbar on CellSelection
176
178
  ) {
177
179
  // If there is no active selection, or the selection is not stable, or the selection is a node selection,
178
180
  // do not show the toolbar.
@@ -235,7 +237,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
235
237
  }
236
238
  }
237
239
  }
238
- if (items.length > 0 && contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1')) {
240
+ if (items.length > 0 && contextualFormattingEnabled && isEditorControlsEnabled) {
239
241
  items.push.apply(items, _toConsumableArray(getOverflowFloatingToolbarConfig({
240
242
  api: api,
241
243
  toolbarDocking: toolbarDocking
@@ -243,19 +245,22 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
243
245
  }
244
246
  var onPositionCalculated;
245
247
  var toolbarTitle = 'Selection toolbar';
246
- if (isCellSelection && editorExperiment('platform_editor_controls', 'variant1')) {
248
+ if (isCellSelection && isEditorControlsEnabled) {
247
249
  onPositionCalculated = calculateToolbarPositionOnCellSelection(toolbarTitle);
248
250
  } else {
249
251
  var calcToolbarPosition = config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
250
252
  onPositionCalculated = calcToolbarPosition(toolbarTitle);
251
253
  }
252
254
  var nodeType = getSelectionNodeTypes(state);
253
- return {
255
+ return _objectSpread(_objectSpread({
254
256
  title: 'Selection toolbar',
255
257
  nodeType: nodeType,
256
- items: items,
258
+ items: items
259
+ }, isEditorControlsEnabled && fg('platform_editor_controls_patch_2') && {
260
+ scrollable: true
261
+ }), {}, {
257
262
  onPositionCalculated: onPositionCalculated
258
- };
263
+ });
259
264
  }
260
265
  },
261
266
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && editorExperiment('platform_editor_controls', 'variant1', {
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.0.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,15 +34,15 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/css": "^0.10.0",
37
- "@atlaskit/editor-common": "^102.13.0",
37
+ "@atlaskit/editor-common": "^102.16.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
39
39
  "@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
- "@atlaskit/icon": "^25.2.0",
41
+ "@atlaskit/icon": "^25.4.0",
42
42
  "@atlaskit/icon-lab": "^4.5.0",
43
- "@atlaskit/menu": "^3.1.0",
43
+ "@atlaskit/menu": "^3.2.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^4.4.0",
45
+ "@atlaskit/tmp-editor-statsig": "^4.6.0",
46
46
  "@atlaskit/tokens": "^4.5.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "bind-event-listener": "^3.0.0"
@@ -90,5 +90,10 @@
90
90
  "compiled"
91
91
  ]
92
92
  }
93
+ },
94
+ "platform-feature-flags": {
95
+ "platform_editor_controls_patch_2": {
96
+ "type": "boolean"
97
+ }
93
98
  }
94
99
  }