@atlaskit/editor-plugin-floating-toolbar 9.1.15 → 9.1.16

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-floating-toolbar
2
2
 
3
+ ## 9.1.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7ef3027df8198`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ef3027df8198) -
8
+ remove platform_editor_lovability_user_intent experiment
9
+ - Updated dependencies
10
+
3
11
  ## 9.1.15
4
12
 
5
13
  ### Patch Changes
@@ -25,8 +25,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
25
25
  var _utils = require("@atlaskit/editor-prosemirror/utils");
26
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
27
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
28
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
29
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
30
28
  var _commands = require("./pm-plugins/commands");
31
29
  var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
32
30
  var _commands2 = require("./pm-plugins/toolbar-data/commands");
@@ -240,14 +238,11 @@ function ContentComponent(_ref5) {
240
238
  popupsScrollableElement = _ref5.popupsScrollableElement,
241
239
  providerFactory = _ref5.providerFactory,
242
240
  dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
243
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
244
- // @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
245
- 'blockControls']),
241
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent']),
246
242
  floatingToolbarState = _useSharedPluginState.floatingToolbarState,
247
243
  editorDisabledState = _useSharedPluginState.editorDisabledState,
248
244
  editorViewModeState = _useSharedPluginState.editorViewModeState,
249
- userIntentState = _useSharedPluginState.userIntentState,
250
- blockControlsState = _useSharedPluginState.blockControlsState;
245
+ userIntentState = _useSharedPluginState.userIntentState;
251
246
  var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
252
247
  configWithNodeInfo = _ref6.configWithNodeInfo,
253
248
  floatingToolbarData = _ref6.floatingToolbarData;
@@ -257,11 +252,7 @@ function ContentComponent(_ref5) {
257
252
  if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
258
253
  return null;
259
254
  }
260
- var userIntentEnabled = Boolean((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.userIntent) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true));
261
- if (((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging' || (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true)) && !userIntentEnabled) {
262
- return null;
263
- }
264
- if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && SUPPRESS_TOOLBAR_USER_INTENTS.includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) && userIntentEnabled) {
255
+ if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && SUPPRESS_TOOLBAR_USER_INTENTS.includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent)) {
265
256
  return null;
266
257
  }
267
258
  var config = configWithNodeInfo.config,
@@ -549,12 +540,7 @@ function floatingToolbarPluginFactory(options) {
549
540
  var config = handler(editorState, intl, providerFactory, activeConfigs);
550
541
  if (config) {
551
542
  var _api$userIntent;
552
- var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true));
553
- if (config.__suppressAllToolbars && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !userIntentEnabled) {
554
- activeConfigs = undefined;
555
- break;
556
- }
557
- if (userIntentEnabled && SUPPRESS_TOOLBAR_USER_INTENTS.includes((api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) || '')) {
543
+ if (SUPPRESS_TOOLBAR_USER_INTENTS.includes((api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) || '')) {
558
544
  activeConfigs = undefined;
559
545
  break;
560
546
  }
@@ -564,18 +550,7 @@ function floatingToolbarPluginFactory(options) {
564
550
  var relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
565
551
  return relevantConfig;
566
552
  };
567
- var getIsToolbarSuppressed = function getIsToolbarSuppressed(editorState) {
568
- var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true));
569
- if (userIntentEnabled) {
570
- return false;
571
- }
572
- for (var index = 0; index < floatingToolbarHandlers.length; index++) {
573
- var handler = floatingToolbarHandlers[index];
574
- var config = handler(editorState, intl, providerFactory);
575
- if (config !== null && config !== void 0 && config.__suppressAllToolbars) {
576
- return true;
577
- }
578
- }
553
+ var getIsToolbarSuppressed = function getIsToolbarSuppressed() {
579
554
  return false;
580
555
  };
581
556
  var apply = function apply() {
@@ -592,8 +567,8 @@ function floatingToolbarPluginFactory(options) {
592
567
  getConfigWithNodeInfo: getConfigWithNodeInfo
593
568
  };
594
569
  },
595
- apply: (0, _expValEquals.expValEquals)('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function (_tr, _pluginState, __oldEditorState, newEditorState) {
596
- var suppressedToolbar = getIsToolbarSuppressed(newEditorState);
570
+ apply: (0, _expValEquals.expValEquals)('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function (_tr, _pluginState, __oldEditorState) {
571
+ var suppressedToolbar = getIsToolbarSuppressed();
597
572
  var newPluginState = {
598
573
  getConfigWithNodeInfo: getConfigWithNodeInfo,
599
574
  suppressedToolbar: suppressedToolbar
@@ -14,8 +14,6 @@ import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemi
14
14
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
15
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
18
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
17
  import { copyNode } from './pm-plugins/commands';
20
18
  import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
21
19
  import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
@@ -230,12 +228,8 @@ export function ContentComponent({
230
228
  floatingToolbarState,
231
229
  editorDisabledState,
232
230
  editorViewModeState,
233
- userIntentState,
234
- // @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
235
- blockControlsState
236
- } = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
237
- // @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
238
- 'blockControls']);
231
+ userIntentState
232
+ } = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent']);
239
233
  const {
240
234
  configWithNodeInfo,
241
235
  floatingToolbarData
@@ -246,11 +240,7 @@ export function ContentComponent({
246
240
  if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
247
241
  return null;
248
242
  }
249
- const userIntentEnabled = Boolean((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
250
- if (((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging' || (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEquals('platform_editor_block_menu', 'isEnabled', true)) && !userIntentEnabled) {
251
- return null;
252
- }
253
- if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && SUPPRESS_TOOLBAR_USER_INTENTS.includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) && userIntentEnabled) {
243
+ if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && SUPPRESS_TOOLBAR_USER_INTENTS.includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent)) {
254
244
  return null;
255
245
  }
256
246
  const {
@@ -533,12 +523,7 @@ export function floatingToolbarPluginFactory(options) {
533
523
  const config = handler(editorState, intl, providerFactory, activeConfigs);
534
524
  if (config) {
535
525
  var _api$userIntent, _api$userIntent$share;
536
- const userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
537
- if (config.__suppressAllToolbars && editorExperiment('platform_editor_controls', 'variant1') && !userIntentEnabled) {
538
- activeConfigs = undefined;
539
- break;
540
- }
541
- if (userIntentEnabled && SUPPRESS_TOOLBAR_USER_INTENTS.includes((api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) || '')) {
526
+ if (SUPPRESS_TOOLBAR_USER_INTENTS.includes((api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) || '')) {
542
527
  activeConfigs = undefined;
543
528
  break;
544
529
  }
@@ -548,18 +533,7 @@ export function floatingToolbarPluginFactory(options) {
548
533
  const relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
549
534
  return relevantConfig;
550
535
  };
551
- const getIsToolbarSuppressed = editorState => {
552
- const userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
553
- if (userIntentEnabled) {
554
- return false;
555
- }
556
- for (let index = 0; index < floatingToolbarHandlers.length; index++) {
557
- const handler = floatingToolbarHandlers[index];
558
- const config = handler(editorState, intl, providerFactory);
559
- if (config !== null && config !== void 0 && config.__suppressAllToolbars) {
560
- return true;
561
- }
562
- }
536
+ const getIsToolbarSuppressed = () => {
563
537
  return false;
564
538
  };
565
539
  const apply = () => {
@@ -576,8 +550,8 @@ export function floatingToolbarPluginFactory(options) {
576
550
  getConfigWithNodeInfo
577
551
  };
578
552
  },
579
- apply: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? (_tr, _pluginState, __oldEditorState, newEditorState) => {
580
- const suppressedToolbar = getIsToolbarSuppressed(newEditorState);
553
+ apply: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? (_tr, _pluginState, __oldEditorState) => {
554
+ const suppressedToolbar = getIsToolbarSuppressed();
581
555
  const newPluginState = {
582
556
  getConfigWithNodeInfo,
583
557
  suppressedToolbar
@@ -18,8 +18,6 @@ import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemi
18
18
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
20
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
22
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
23
21
  import { copyNode as _copyNode } from './pm-plugins/commands';
24
22
  import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
25
23
  import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
@@ -230,14 +228,11 @@ export function ContentComponent(_ref5) {
230
228
  popupsScrollableElement = _ref5.popupsScrollableElement,
231
229
  providerFactory = _ref5.providerFactory,
232
230
  dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
233
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
234
- // @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
235
- 'blockControls']),
231
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent']),
236
232
  floatingToolbarState = _useSharedPluginState.floatingToolbarState,
237
233
  editorDisabledState = _useSharedPluginState.editorDisabledState,
238
234
  editorViewModeState = _useSharedPluginState.editorViewModeState,
239
- userIntentState = _useSharedPluginState.userIntentState,
240
- blockControlsState = _useSharedPluginState.blockControlsState;
235
+ userIntentState = _useSharedPluginState.userIntentState;
241
236
  var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
242
237
  configWithNodeInfo = _ref6.configWithNodeInfo,
243
238
  floatingToolbarData = _ref6.floatingToolbarData;
@@ -247,11 +242,7 @@ export function ContentComponent(_ref5) {
247
242
  if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
248
243
  return null;
249
244
  }
250
- var userIntentEnabled = Boolean((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
251
- if (((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging' || (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEquals('platform_editor_block_menu', 'isEnabled', true)) && !userIntentEnabled) {
252
- return null;
253
- }
254
- if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && SUPPRESS_TOOLBAR_USER_INTENTS.includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) && userIntentEnabled) {
245
+ if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && SUPPRESS_TOOLBAR_USER_INTENTS.includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent)) {
255
246
  return null;
256
247
  }
257
248
  var config = configWithNodeInfo.config,
@@ -539,12 +530,7 @@ export function floatingToolbarPluginFactory(options) {
539
530
  var config = handler(editorState, intl, providerFactory, activeConfigs);
540
531
  if (config) {
541
532
  var _api$userIntent;
542
- var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
543
- if (config.__suppressAllToolbars && editorExperiment('platform_editor_controls', 'variant1') && !userIntentEnabled) {
544
- activeConfigs = undefined;
545
- break;
546
- }
547
- if (userIntentEnabled && SUPPRESS_TOOLBAR_USER_INTENTS.includes((api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) || '')) {
533
+ if (SUPPRESS_TOOLBAR_USER_INTENTS.includes((api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) || '')) {
548
534
  activeConfigs = undefined;
549
535
  break;
550
536
  }
@@ -554,18 +540,7 @@ export function floatingToolbarPluginFactory(options) {
554
540
  var relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
555
541
  return relevantConfig;
556
542
  };
557
- var getIsToolbarSuppressed = function getIsToolbarSuppressed(editorState) {
558
- var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
559
- if (userIntentEnabled) {
560
- return false;
561
- }
562
- for (var index = 0; index < floatingToolbarHandlers.length; index++) {
563
- var handler = floatingToolbarHandlers[index];
564
- var config = handler(editorState, intl, providerFactory);
565
- if (config !== null && config !== void 0 && config.__suppressAllToolbars) {
566
- return true;
567
- }
568
- }
543
+ var getIsToolbarSuppressed = function getIsToolbarSuppressed() {
569
544
  return false;
570
545
  };
571
546
  var apply = function apply() {
@@ -582,8 +557,8 @@ export function floatingToolbarPluginFactory(options) {
582
557
  getConfigWithNodeInfo: getConfigWithNodeInfo
583
558
  };
584
559
  },
585
- apply: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function (_tr, _pluginState, __oldEditorState, newEditorState) {
586
- var suppressedToolbar = getIsToolbarSuppressed(newEditorState);
560
+ apply: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function (_tr, _pluginState, __oldEditorState) {
561
+ var suppressedToolbar = getIsToolbarSuppressed();
587
562
  var newPluginState = {
588
563
  getConfigWithNodeInfo: getConfigWithNodeInfo,
589
564
  suppressedToolbar: suppressedToolbar
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "9.1.15",
3
+ "version": "9.1.16",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/primitives": "^18.0.0",
45
45
  "@atlaskit/select": "^21.7.0",
46
46
  "@atlaskit/theme": "^21.0.0",
47
- "@atlaskit/tmp-editor-statsig": "^25.2.0",
47
+ "@atlaskit/tmp-editor-statsig": "^25.6.0",
48
48
  "@atlaskit/tokens": "^11.0.0",
49
49
  "@atlaskit/tooltip": "^20.14.0",
50
50
  "@babel/runtime": "^7.0.0",
@@ -56,7 +56,7 @@
56
56
  "react-loadable": "^5.1.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^111.13.0",
59
+ "@atlaskit/editor-common": "^111.15.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0"
62
62
  },