@atlaskit/editor-plugin-floating-toolbar 8.2.12 → 8.2.13

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
+ ## 8.2.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`29d0693bd5373`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/29d0693bd5373) -
8
+ EDITOR-2581 Fire event for suppressAllToolbars api being used
9
+ - Updated dependencies
10
+
3
11
  ## 8.2.12
4
12
 
5
13
  ### Patch Changes
@@ -579,6 +579,20 @@ function floatingToolbarPluginFactory(options) {
579
579
  var relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
580
580
  return relevantConfig;
581
581
  };
582
+ var getIsToolbarSuppressed = function getIsToolbarSuppressed(editorState) {
583
+ var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true));
584
+ if (userIntentEnabled) {
585
+ return false;
586
+ }
587
+ for (var index = 0; index < floatingToolbarHandlers.length; index++) {
588
+ var handler = floatingToolbarHandlers[index];
589
+ var config = handler(editorState, intl, providerFactory);
590
+ if (config !== null && config !== void 0 && config.__suppressAllToolbars) {
591
+ return true;
592
+ }
593
+ }
594
+ return false;
595
+ };
582
596
  var apply = function apply() {
583
597
  var newPluginState = {
584
598
  getConfigWithNodeInfo: getConfigWithNodeInfo
@@ -593,7 +607,31 @@ function floatingToolbarPluginFactory(options) {
593
607
  getConfigWithNodeInfo: getConfigWithNodeInfo
594
608
  };
595
609
  },
596
- apply: apply
597
- }
610
+ apply: (0, _expValEquals.expValEquals)('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function (_tr, _pluginState, __oldEditorState, newEditorState) {
611
+ var suppressedToolbar = getIsToolbarSuppressed(newEditorState);
612
+ var newPluginState = {
613
+ getConfigWithNodeInfo: getConfigWithNodeInfo,
614
+ suppressedToolbar: suppressedToolbar
615
+ };
616
+ return newPluginState;
617
+ } : apply
618
+ },
619
+ view: (0, _expValEquals.expValEquals)('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function () {
620
+ return {
621
+ update: function update(view, prevState) {
622
+ var pluginState = pluginKey.getState(view.state);
623
+ var prevPluginState = pluginKey.getState(prevState);
624
+ if (pluginState !== null && pluginState !== void 0 && pluginState.suppressedToolbar && !(prevPluginState !== null && prevPluginState !== void 0 && prevPluginState.suppressedToolbar)) {
625
+ var _api$analytics2;
626
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
627
+ action: _analytics.ACTION.SUPPRESSED,
628
+ actionSubject: _analytics.ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
629
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.FLOATING_TOOLBAR,
630
+ eventType: _analytics.EVENT_TYPE.TRACK
631
+ });
632
+ }
633
+ }
634
+ };
635
+ } : undefined
598
636
  });
599
637
  }
@@ -564,6 +564,20 @@ export function floatingToolbarPluginFactory(options) {
564
564
  const relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
565
565
  return relevantConfig;
566
566
  };
567
+ const getIsToolbarSuppressed = editorState => {
568
+ const userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
569
+ if (userIntentEnabled) {
570
+ return false;
571
+ }
572
+ for (let index = 0; index < floatingToolbarHandlers.length; index++) {
573
+ const handler = floatingToolbarHandlers[index];
574
+ const config = handler(editorState, intl, providerFactory);
575
+ if (config !== null && config !== void 0 && config.__suppressAllToolbars) {
576
+ return true;
577
+ }
578
+ }
579
+ return false;
580
+ };
567
581
  const apply = () => {
568
582
  const newPluginState = {
569
583
  getConfigWithNodeInfo
@@ -578,7 +592,31 @@ export function floatingToolbarPluginFactory(options) {
578
592
  getConfigWithNodeInfo
579
593
  };
580
594
  },
581
- apply
582
- }
595
+ apply: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? (_tr, _pluginState, __oldEditorState, newEditorState) => {
596
+ const suppressedToolbar = getIsToolbarSuppressed(newEditorState);
597
+ const newPluginState = {
598
+ getConfigWithNodeInfo,
599
+ suppressedToolbar
600
+ };
601
+ return newPluginState;
602
+ } : apply
603
+ },
604
+ view: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? () => {
605
+ return {
606
+ update: (view, prevState) => {
607
+ const pluginState = pluginKey.getState(view.state);
608
+ const prevPluginState = pluginKey.getState(prevState);
609
+ if (pluginState !== null && pluginState !== void 0 && pluginState.suppressedToolbar && !(prevPluginState !== null && prevPluginState !== void 0 && prevPluginState.suppressedToolbar)) {
610
+ var _api$analytics2, _api$analytics2$actio;
611
+ api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : (_api$analytics2$actio = _api$analytics2.actions) === null || _api$analytics2$actio === void 0 ? void 0 : _api$analytics2$actio.fireAnalyticsEvent({
612
+ action: ACTION.SUPPRESSED,
613
+ actionSubject: ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
614
+ actionSubjectId: ACTION_SUBJECT_ID.FLOATING_TOOLBAR,
615
+ eventType: EVENT_TYPE.TRACK
616
+ });
617
+ }
618
+ }
619
+ };
620
+ } : undefined
583
621
  });
584
622
  }
@@ -569,6 +569,20 @@ export function floatingToolbarPluginFactory(options) {
569
569
  var relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
570
570
  return relevantConfig;
571
571
  };
572
+ var getIsToolbarSuppressed = function getIsToolbarSuppressed(editorState) {
573
+ var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
574
+ if (userIntentEnabled) {
575
+ return false;
576
+ }
577
+ for (var index = 0; index < floatingToolbarHandlers.length; index++) {
578
+ var handler = floatingToolbarHandlers[index];
579
+ var config = handler(editorState, intl, providerFactory);
580
+ if (config !== null && config !== void 0 && config.__suppressAllToolbars) {
581
+ return true;
582
+ }
583
+ }
584
+ return false;
585
+ };
572
586
  var apply = function apply() {
573
587
  var newPluginState = {
574
588
  getConfigWithNodeInfo: getConfigWithNodeInfo
@@ -583,7 +597,31 @@ export function floatingToolbarPluginFactory(options) {
583
597
  getConfigWithNodeInfo: getConfigWithNodeInfo
584
598
  };
585
599
  },
586
- apply: apply
587
- }
600
+ apply: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function (_tr, _pluginState, __oldEditorState, newEditorState) {
601
+ var suppressedToolbar = getIsToolbarSuppressed(newEditorState);
602
+ var newPluginState = {
603
+ getConfigWithNodeInfo: getConfigWithNodeInfo,
604
+ suppressedToolbar: suppressedToolbar
605
+ };
606
+ return newPluginState;
607
+ } : apply
608
+ },
609
+ view: expValEquals('platform_editor_lovability_suppress_toolbar_event', 'isEnabled', true) ? function () {
610
+ return {
611
+ update: function update(view, prevState) {
612
+ var pluginState = pluginKey.getState(view.state);
613
+ var prevPluginState = pluginKey.getState(prevState);
614
+ if (pluginState !== null && pluginState !== void 0 && pluginState.suppressedToolbar && !(prevPluginState !== null && prevPluginState !== void 0 && prevPluginState.suppressedToolbar)) {
615
+ var _api$analytics2;
616
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
617
+ action: ACTION.SUPPRESSED,
618
+ actionSubject: ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
619
+ actionSubjectId: ACTION_SUBJECT_ID.FLOATING_TOOLBAR,
620
+ eventType: EVENT_TYPE.TRACK
621
+ });
622
+ }
623
+ }
624
+ };
625
+ } : undefined
588
626
  });
589
627
  }
@@ -3,7 +3,7 @@ import type { IntlShape } from 'react-intl-next';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarHandler, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
6
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
6
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './floatingToolbarPluginType';
@@ -55,4 +55,6 @@ export declare function floatingToolbarPluginFactory(options: {
55
55
  floatingToolbarHandlers: Array<FloatingToolbarHandler>;
56
56
  getIntl: () => IntlShape;
57
57
  providerFactory: ProviderFactory;
58
- }): SafePlugin<FloatingToolbarPluginState>;
58
+ }): SafePlugin<{
59
+ getConfigWithNodeInfo: (editorState: EditorState) => ConfigWithNodeInfo | null | undefined;
60
+ }>;
@@ -21,6 +21,7 @@ export type ConfigWithNodeInfo = {
21
21
  };
22
22
  export type FloatingToolbarPluginState = {
23
23
  getConfigWithNodeInfo: (state: EditorState) => ConfigWithNodeInfo | null | undefined;
24
+ suppressedToolbar?: boolean;
24
25
  };
25
26
  export type FloatingToolbarPluginData = {
26
27
  confirmDialogForItem?: number;
@@ -3,7 +3,7 @@ import type { IntlShape } from 'react-intl-next';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarHandler, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
6
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
6
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './floatingToolbarPluginType';
@@ -55,4 +55,6 @@ export declare function floatingToolbarPluginFactory(options: {
55
55
  floatingToolbarHandlers: Array<FloatingToolbarHandler>;
56
56
  getIntl: () => IntlShape;
57
57
  providerFactory: ProviderFactory;
58
- }): SafePlugin<FloatingToolbarPluginState>;
58
+ }): SafePlugin<{
59
+ getConfigWithNodeInfo: (editorState: EditorState) => ConfigWithNodeInfo | null | undefined;
60
+ }>;
@@ -21,6 +21,7 @@ export type ConfigWithNodeInfo = {
21
21
  };
22
22
  export type FloatingToolbarPluginState = {
23
23
  getConfigWithNodeInfo: (state: EditorState) => ConfigWithNodeInfo | null | undefined;
24
+ suppressedToolbar?: boolean;
24
25
  };
25
26
  export type FloatingToolbarPluginData = {
26
27
  confirmDialogForItem?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "8.2.12",
3
+ "version": "8.2.13",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
32
32
  "@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
33
33
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
34
- "@atlaskit/editor-plugin-emoji": "^7.5.0",
34
+ "@atlaskit/editor-plugin-emoji": "^7.6.0",
35
35
  "@atlaskit/editor-plugin-extension": "^9.2.0",
36
36
  "@atlaskit/editor-plugin-interaction": "^9.0.0",
37
37
  "@atlaskit/editor-plugin-table": "^15.3.0",
@@ -45,8 +45,8 @@
45
45
  "@atlaskit/primitives": "^16.1.0",
46
46
  "@atlaskit/select": "^21.3.0",
47
47
  "@atlaskit/theme": "^21.0.0",
48
- "@atlaskit/tmp-editor-statsig": "^13.22.0",
49
- "@atlaskit/tokens": "^7.0.0",
48
+ "@atlaskit/tmp-editor-statsig": "^13.26.0",
49
+ "@atlaskit/tokens": "^7.1.0",
50
50
  "@atlaskit/tooltip": "^20.7.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@emotion/react": "^11.7.1",
@@ -57,7 +57,7 @@
57
57
  "react-loadable": "^5.1.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "@atlaskit/editor-common": "^110.19.0",
60
+ "@atlaskit/editor-common": "^110.21.0",
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0"
63
63
  },