@atlaskit/editor-plugin-selection-toolbar 2.1.0 → 2.1.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,15 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#127441](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127441)
8
+ [`f2f4b5971e0b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2f4b5971e0b2) -
9
+ [ux] Updates Text Formatting toolbar separators, active option style and removes range selection
10
+ when the toolbar is docked to top.
11
+ - Updated dependencies
12
+
3
13
  ## 2.1.0
4
14
 
5
15
  ### Minor Changes
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.toggleToolbar = exports.setToolbarDocking = void 0;
7
+ var _state = require("@atlaskit/editor-prosemirror/state");
7
8
  var _pluginKey = require("./plugin-key");
8
9
  var toggleToolbar = exports.toggleToolbar = function toggleToolbar(_ref) {
9
10
  var hide = _ref.hide;
@@ -25,6 +26,10 @@ var setToolbarDocking = exports.setToolbarDocking = function setToolbarDocking(_
25
26
  tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
26
27
  toolbarDocking: toolbarDocking
27
28
  });
29
+ if (toolbarDocking === 'top') {
30
+ // Remove the selection if the toolbar is docked to the top
31
+ tr.setSelection(_state.TextSelection.create(tr.doc, tr.selection.head));
32
+ }
28
33
  return tr;
29
34
  };
30
35
  };
@@ -194,15 +194,22 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
194
194
  items.push.apply(items, (0, _toConsumableArray2.default)(resolved[i].items));
195
195
  }
196
196
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
197
- var shouldNotAddSeparator = false;
198
197
  if (resolved[i] && resolved[i + 1]) {
199
- var _resolved$i2, _resolved, _resolved$i3, _resolved2;
200
- shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
201
- }
202
- if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
203
- items.push({
204
- type: 'separator'
205
- });
198
+ var _resolved$i2, _resolved, _resolved$i3, _resolved2, _resolved3;
199
+ var shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
200
+ if (((_resolved3 = resolved[i + 1]) === null || _resolved3 === void 0 ? void 0 : _resolved3.pluginName) === 'annotation') {
201
+ items.push({
202
+ type: 'separator',
203
+ fullHeight: true
204
+ });
205
+ } else {
206
+ if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
207
+ items.push({
208
+ type: 'separator',
209
+ fullHeight: false
210
+ });
211
+ }
212
+ }
206
213
  }
207
214
  } else {
208
215
  if (i !== resolved.length - 1) {
@@ -75,7 +75,8 @@ var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig
75
75
  });
76
76
  }
77
77
  return [{
78
- type: 'separator'
78
+ type: 'separator',
79
+ fullHeight: true
79
80
  }, {
80
81
  type: 'overflow-dropdown',
81
82
  dropdownWidth: 240,
@@ -1,3 +1,4 @@
1
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
1
2
  import { selectionToolbarPluginKey } from './plugin-key';
2
3
  export const toggleToolbar = ({
3
4
  hide
@@ -20,5 +21,9 @@ export const setToolbarDocking = ({
20
21
  tr.setMeta(selectionToolbarPluginKey, {
21
22
  toolbarDocking
22
23
  });
24
+ if (toolbarDocking === 'top') {
25
+ // Remove the selection if the toolbar is docked to the top
26
+ tr.setSelection(TextSelection.create(tr.doc, tr.selection.head));
27
+ }
23
28
  return tr;
24
29
  };
@@ -185,15 +185,22 @@ export const selectionToolbarPlugin = ({
185
185
  items.push(...resolved[i].items);
186
186
  }
187
187
  if (editorExperiment('platform_editor_controls', 'variant1')) {
188
- let shouldNotAddSeparator = false;
189
188
  if (resolved[i] && resolved[i + 1]) {
190
- var _resolved$i2, _resolved, _resolved$i3, _resolved2;
191
- shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
192
- }
193
- if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
194
- items.push({
195
- type: 'separator'
196
- });
189
+ var _resolved$i2, _resolved, _resolved$i3, _resolved2, _resolved3;
190
+ const shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
191
+ if (((_resolved3 = resolved[i + 1]) === null || _resolved3 === void 0 ? void 0 : _resolved3.pluginName) === 'annotation') {
192
+ items.push({
193
+ type: 'separator',
194
+ fullHeight: true
195
+ });
196
+ } else {
197
+ if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
198
+ items.push({
199
+ type: 'separator',
200
+ fullHeight: false
201
+ });
202
+ }
203
+ }
197
204
  }
198
205
  } else {
199
206
  if (i !== resolved.length - 1) {
@@ -68,7 +68,8 @@ export const getOverflowFloatingToolbarConfig = ({
68
68
  });
69
69
  }
70
70
  return [{
71
- type: 'separator'
71
+ type: 'separator',
72
+ fullHeight: true
72
73
  }, {
73
74
  type: 'overflow-dropdown',
74
75
  dropdownWidth: 240,
@@ -1,3 +1,4 @@
1
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
1
2
  import { selectionToolbarPluginKey } from './plugin-key';
2
3
  export var toggleToolbar = function toggleToolbar(_ref) {
3
4
  var hide = _ref.hide;
@@ -19,6 +20,10 @@ export var setToolbarDocking = function setToolbarDocking(_ref3) {
19
20
  tr.setMeta(selectionToolbarPluginKey, {
20
21
  toolbarDocking: toolbarDocking
21
22
  });
23
+ if (toolbarDocking === 'top') {
24
+ // Remove the selection if the toolbar is docked to the top
25
+ tr.setSelection(TextSelection.create(tr.doc, tr.selection.head));
26
+ }
22
27
  return tr;
23
28
  };
24
29
  };
@@ -187,15 +187,22 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
187
187
  items.push.apply(items, _toConsumableArray(resolved[i].items));
188
188
  }
189
189
  if (editorExperiment('platform_editor_controls', 'variant1')) {
190
- var shouldNotAddSeparator = false;
191
190
  if (resolved[i] && resolved[i + 1]) {
192
- var _resolved$i2, _resolved, _resolved$i3, _resolved2;
193
- shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
194
- }
195
- if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
196
- items.push({
197
- type: 'separator'
198
- });
191
+ var _resolved$i2, _resolved, _resolved$i3, _resolved2, _resolved3;
192
+ var shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
193
+ if (((_resolved3 = resolved[i + 1]) === null || _resolved3 === void 0 ? void 0 : _resolved3.pluginName) === 'annotation') {
194
+ items.push({
195
+ type: 'separator',
196
+ fullHeight: true
197
+ });
198
+ } else {
199
+ if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
200
+ items.push({
201
+ type: 'separator',
202
+ fullHeight: false
203
+ });
204
+ }
205
+ }
199
206
  }
200
207
  } else {
201
208
  if (i !== resolved.length - 1) {
@@ -67,7 +67,8 @@ export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolba
67
67
  });
68
68
  }
69
69
  return [{
70
- type: 'separator'
70
+ type: 'separator',
71
+ fullHeight: true
71
72
  }, {
72
73
  type: 'overflow-dropdown',
73
74
  dropdownWidth: 240,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "2.1.0",
3
+ "version": "2.1.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",