@atlaskit/editor-plugin-floating-toolbar 5.1.12 → 5.2.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,16 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 5.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e73faa5a52300`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e73faa5a52300) -
8
+ [ux] ED-28735 Fix selection toolbar opening and closing state
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 5.1.12
4
15
 
5
16
  ### Patch Changes
@@ -23,6 +23,7 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
23
23
  var _ui = require("@atlaskit/editor-common/ui");
24
24
  var _state = require("@atlaskit/editor-prosemirror/state");
25
25
  var _utils = require("@atlaskit/editor-prosemirror/utils");
26
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
26
27
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
27
28
  var _commands = require("./pm-plugins/commands");
28
29
  var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
@@ -241,6 +242,16 @@ function ContentComponent(_ref5) {
241
242
 
242
243
  var config = configWithNodeInfo.config,
243
244
  node = configWithNodeInfo.node;
245
+
246
+ // When the new inline editor-toolbar is enabled, suppress floating toolbar for text selections.
247
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)) {
248
+ var selection = editorView.state.selection;
249
+ var isCellSelection = '$anchorCell' in selection && !selection.empty;
250
+ var isTextSelected = selection instanceof _state.TextSelection && !selection.empty;
251
+ if (isTextSelected || isCellSelection) {
252
+ return null;
253
+ }
254
+ }
244
255
  var items = config.items;
245
256
  var groupLabel = config.groupLabel;
246
257
  var title = config.title,
@@ -10,8 +10,9 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
10
10
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
11
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
12
12
  import { Popup } from '@atlaskit/editor-common/ui';
13
- import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
13
+ import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
14
14
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
15
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
17
  import { copyNode } from './pm-plugins/commands';
17
18
  import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
@@ -233,6 +234,16 @@ export function ContentComponent({
233
234
  config,
234
235
  node
235
236
  } = configWithNodeInfo;
237
+
238
+ // When the new inline editor-toolbar is enabled, suppress floating toolbar for text selections.
239
+ if (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)) {
240
+ const selection = editorView.state.selection;
241
+ const isCellSelection = '$anchorCell' in selection && !selection.empty;
242
+ const isTextSelected = selection instanceof TextSelection && !selection.empty;
243
+ if (isTextSelected || isCellSelection) {
244
+ return null;
245
+ }
246
+ }
236
247
  let {
237
248
  items
238
249
  } = config;
@@ -14,8 +14,9 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
14
14
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
15
15
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
16
16
  import { Popup } from '@atlaskit/editor-common/ui';
17
- import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
17
+ import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
18
18
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
19
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
20
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
21
  import { copyNode as _copyNode } from './pm-plugins/commands';
21
22
  import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
@@ -232,6 +233,16 @@ export function ContentComponent(_ref5) {
232
233
 
233
234
  var config = configWithNodeInfo.config,
234
235
  node = configWithNodeInfo.node;
236
+
237
+ // When the new inline editor-toolbar is enabled, suppress floating toolbar for text selections.
238
+ if (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)) {
239
+ var selection = editorView.state.selection;
240
+ var isCellSelection = '$anchorCell' in selection && !selection.empty;
241
+ var isTextSelected = selection instanceof TextSelection && !selection.empty;
242
+ if (isTextSelected || isCellSelection) {
243
+ return null;
244
+ }
245
+ }
235
246
  var items = config.items;
236
247
  var groupLabel = config.groupLabel;
237
248
  var title = config.title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "5.1.12",
3
+ "version": "5.2.0",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/primitives": "^14.11.0",
49
49
  "@atlaskit/select": "^21.2.0",
50
50
  "@atlaskit/theme": "^19.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^11.3.0",
51
+ "@atlaskit/tmp-editor-statsig": "^11.5.0",
52
52
  "@atlaskit/tokens": "^6.0.0",
53
53
  "@atlaskit/tooltip": "^20.4.0",
54
54
  "@babel/runtime": "^7.0.0",
@@ -60,7 +60,7 @@
60
60
  "react-loadable": "^5.1.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@atlaskit/editor-common": "^107.26.0",
63
+ "@atlaskit/editor-common": "^107.28.0",
64
64
  "react": "^18.2.0",
65
65
  "react-dom": "^18.2.0"
66
66
  },