@atlaskit/editor-plugin-paste-options-toolbar 13.1.2 → 13.1.3

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,14 @@
1
1
  # @atlaskit/editor-plugin-paste-options-toolbar
2
2
 
3
+ ## 13.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1e91a4b881a3e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1e91a4b881a3e) -
8
+ Fire the `confluence_editor_paste_3p_link_actions_menu` exposure only for single-link pastes
9
+ instead of during menu setup. Experiment checks now use `expValEqualsNoExposure`, and the exposure
10
+ is fired separately when a single link is pasted.
11
+
3
12
  ## 13.1.2
4
13
 
5
14
  ### Patch Changes
@@ -14,6 +14,7 @@ var _commands = require("./editor-commands/commands");
14
14
  var _main = require("./pm-plugins/main");
15
15
  var _types = require("./types/types");
16
16
  var _exposure = require("./ui/on-paste-actions-menu/exposure");
17
+ var _exposure3pLink = require("./ui/on-paste-actions-menu/exposure-3p-link");
17
18
  var _exposureV = require("./ui/on-paste-actions-menu/exposure-v2");
18
19
  var _PasteActionsMenu = require("./ui/on-paste-actions-menu/PasteActionsMenu");
19
20
  var _PasteMenuComponents = require("./ui/on-paste-actions-menu/PasteMenuComponents");
@@ -211,6 +212,11 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
211
212
  var _lastContentPasted$te3, _lastContentPasted$te4;
212
213
  (0, _exposureV.firePasteActionsMenuV2ExperimentExposure)((_lastContentPasted$te3 = lastContentPasted === null || lastContentPasted === void 0 || (_lastContentPasted$te4 = lastContentPasted.text) === null || _lastContentPasted$te4 === void 0 ? void 0 : _lastContentPasted$te4.length) !== null && _lastContentPasted$te3 !== void 0 ? _lastContentPasted$te3 : 0, editorView.state, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pasteStartPos, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pasteEndPos, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.text, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pastedSlice);
213
214
  }
215
+
216
+ // Fires only for single-link pastes, matching when the 3p link menu shows.
217
+ if (config !== null && config !== void 0 && config.usePopupBasedPasteActionsMenu) {
218
+ (0, _exposure3pLink.firePaste3pLinkActionsMenuExperimentExposure)(lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pastedSlice);
219
+ }
214
220
  if (config !== null && config !== void 0 && config.usePopupBasedPasteActionsMenu && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_paste_actions_menu', 'isEnabled', true)) {
215
221
  return;
216
222
  }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.firePaste3pLinkActionsMenuExperimentExposure = void 0;
7
+ var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
8
+ var _isNotSingleLink = require("../utils/paste-menu-rules/isNotSingleLink");
9
+ // Remove this file when experiment `confluence_editor_paste_3p_link_actions_menu` is cleaned up.
10
+
11
+ // Manual exposure for `confluence_editor_paste_3p_link_actions_menu`. The menu only
12
+ // appears for single-link pastes, so fire the exposure in that case alone to avoid
13
+ // exposing users who would never see the experiment.
14
+ var firePaste3pLinkActionsMenuExperimentExposure = exports.firePaste3pLinkActionsMenuExperimentExposure = function firePaste3pLinkActionsMenuExperimentExposure(pastedSlice) {
15
+ if ((0, _isNotSingleLink.isNotSingleLink)(pastedSlice)) {
16
+ return;
17
+ }
18
+ (0, _expVal.expVal)('confluence_editor_paste_3p_link_actions_menu', 'isEnabled', false);
19
+ };
@@ -7,6 +7,7 @@ import { hideToolbar, showToolbar } from './editor-commands/commands';
7
7
  import { createPlugin } from './pm-plugins/main';
8
8
  import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
9
9
  import { firePasteActionsMenuExperimentExposure } from './ui/on-paste-actions-menu/exposure';
10
+ import { firePaste3pLinkActionsMenuExperimentExposure } from './ui/on-paste-actions-menu/exposure-3p-link';
10
11
  import { firePasteActionsMenuV2ExperimentExposure } from './ui/on-paste-actions-menu/exposure-v2';
11
12
  import { PasteActionsMenu } from './ui/on-paste-actions-menu/PasteActionsMenu';
12
13
  import { getPasteMenuComponents } from './ui/on-paste-actions-menu/PasteMenuComponents';
@@ -200,6 +201,11 @@ export const pasteOptionsToolbarPlugin = ({
200
201
  var _lastContentPasted$te3, _lastContentPasted$te4;
201
202
  firePasteActionsMenuV2ExperimentExposure((_lastContentPasted$te3 = lastContentPasted === null || lastContentPasted === void 0 ? void 0 : (_lastContentPasted$te4 = lastContentPasted.text) === null || _lastContentPasted$te4 === void 0 ? void 0 : _lastContentPasted$te4.length) !== null && _lastContentPasted$te3 !== void 0 ? _lastContentPasted$te3 : 0, editorView.state, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pasteStartPos, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pasteEndPos, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.text, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pastedSlice);
202
203
  }
204
+
205
+ // Fires only for single-link pastes, matching when the 3p link menu shows.
206
+ if (config !== null && config !== void 0 && config.usePopupBasedPasteActionsMenu) {
207
+ firePaste3pLinkActionsMenuExperimentExposure(lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pastedSlice);
208
+ }
203
209
  if (config !== null && config !== void 0 && config.usePopupBasedPasteActionsMenu && expValEqualsNoExposure('platform_editor_paste_actions_menu', 'isEnabled', true)) {
204
210
  return;
205
211
  }
@@ -0,0 +1,14 @@
1
+ // Remove this file when experiment `confluence_editor_paste_3p_link_actions_menu` is cleaned up.
2
+
3
+ import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
4
+ import { isNotSingleLink } from '../utils/paste-menu-rules/isNotSingleLink';
5
+
6
+ // Manual exposure for `confluence_editor_paste_3p_link_actions_menu`. The menu only
7
+ // appears for single-link pastes, so fire the exposure in that case alone to avoid
8
+ // exposing users who would never see the experiment.
9
+ export const firePaste3pLinkActionsMenuExperimentExposure = pastedSlice => {
10
+ if (isNotSingleLink(pastedSlice)) {
11
+ return;
12
+ }
13
+ expVal('confluence_editor_paste_3p_link_actions_menu', 'isEnabled', false);
14
+ };
@@ -7,6 +7,7 @@ import { hideToolbar, showToolbar } from './editor-commands/commands';
7
7
  import { createPlugin } from './pm-plugins/main';
8
8
  import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
9
9
  import { firePasteActionsMenuExperimentExposure } from './ui/on-paste-actions-menu/exposure';
10
+ import { firePaste3pLinkActionsMenuExperimentExposure } from './ui/on-paste-actions-menu/exposure-3p-link';
10
11
  import { firePasteActionsMenuV2ExperimentExposure } from './ui/on-paste-actions-menu/exposure-v2';
11
12
  import { PasteActionsMenu } from './ui/on-paste-actions-menu/PasteActionsMenu';
12
13
  import { getPasteMenuComponents } from './ui/on-paste-actions-menu/PasteMenuComponents';
@@ -203,6 +204,11 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
203
204
  var _lastContentPasted$te3, _lastContentPasted$te4;
204
205
  firePasteActionsMenuV2ExperimentExposure((_lastContentPasted$te3 = lastContentPasted === null || lastContentPasted === void 0 || (_lastContentPasted$te4 = lastContentPasted.text) === null || _lastContentPasted$te4 === void 0 ? void 0 : _lastContentPasted$te4.length) !== null && _lastContentPasted$te3 !== void 0 ? _lastContentPasted$te3 : 0, editorView.state, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pasteStartPos, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pasteEndPos, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.text, lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pastedSlice);
205
206
  }
207
+
208
+ // Fires only for single-link pastes, matching when the 3p link menu shows.
209
+ if (config !== null && config !== void 0 && config.usePopupBasedPasteActionsMenu) {
210
+ firePaste3pLinkActionsMenuExperimentExposure(lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.pastedSlice);
211
+ }
206
212
  if (config !== null && config !== void 0 && config.usePopupBasedPasteActionsMenu && expValEqualsNoExposure('platform_editor_paste_actions_menu', 'isEnabled', true)) {
207
213
  return;
208
214
  }
@@ -0,0 +1,14 @@
1
+ // Remove this file when experiment `confluence_editor_paste_3p_link_actions_menu` is cleaned up.
2
+
3
+ import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
4
+ import { isNotSingleLink } from '../utils/paste-menu-rules/isNotSingleLink';
5
+
6
+ // Manual exposure for `confluence_editor_paste_3p_link_actions_menu`. The menu only
7
+ // appears for single-link pastes, so fire the exposure in that case alone to avoid
8
+ // exposing users who would never see the experiment.
9
+ export var firePaste3pLinkActionsMenuExperimentExposure = function firePaste3pLinkActionsMenuExperimentExposure(pastedSlice) {
10
+ if (isNotSingleLink(pastedSlice)) {
11
+ return;
12
+ }
13
+ expVal('confluence_editor_paste_3p_link_actions_menu', 'isEnabled', false);
14
+ };
@@ -0,0 +1,2 @@
1
+ import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
+ export declare const firePaste3pLinkActionsMenuExperimentExposure: (pastedSlice?: Slice) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste-options-toolbar",
3
- "version": "13.1.2",
3
+ "version": "13.1.3",
4
4
  "description": "Paste options toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,14 +34,14 @@
34
34
  "@atlaskit/icon": "^36.2.0",
35
35
  "@atlaskit/platform-feature-flags": "^2.0.0",
36
36
  "@atlaskit/primitives": "^20.5.0",
37
- "@atlaskit/tmp-editor-statsig": "^124.0.0",
37
+ "@atlaskit/tmp-editor-statsig": "^124.1.0",
38
38
  "@atlaskit/tokens": "^15.5.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "@compiled/react": "^0.20.0",
41
41
  "@emotion/react": "^11.7.1"
42
42
  },
43
43
  "peerDependencies": {
44
- "@atlaskit/editor-common": "^116.24.0",
44
+ "@atlaskit/editor-common": "^116.25.0",
45
45
  "react": "^18.2.0",
46
46
  "react-dom": "^18.2.0",
47
47
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"