@atlaskit/editor-plugin-floating-toolbar 4.0.8 → 4.1.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,17 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#149482](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149482)
8
+ [`1f1f73876c3c8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1f1f73876c3c8) -
9
+ ED-27860 Add analytics for copy and delete button in floating toolbars
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 4.0.8
4
16
 
5
17
  ### Patch Changes
@@ -169,8 +169,9 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
169
169
  forceFocusSelector: _forceFocus.forceFocusSelector
170
170
  },
171
171
  commands: {
172
- copyNode: function copyNode(nodeType) {
173
- return (0, _commands.copyNode)(nodeType);
172
+ copyNode: function copyNode(nodeType, inputMethod) {
173
+ var _api$analytics;
174
+ return (0, _commands.copyNode)(nodeType, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, inputMethod);
174
175
  }
175
176
  },
176
177
  getSharedState: function getSharedState(editorState) {
@@ -8,7 +8,8 @@ var _browser = require("@atlaskit/editor-common/browser");
8
8
  var _clipboard = require("@atlaskit/editor-common/clipboard");
9
9
  var _copyButton = require("@atlaskit/editor-common/copy-button");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
- var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsAp) {
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
12
13
  return function (_ref) {
13
14
  var tr = _ref.tr;
14
15
  // const { tr, schema } = state;
@@ -53,6 +54,10 @@ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsAp)
53
54
  (0, _clipboard.copyHTMLToClipboard)(div);
54
55
  }
55
56
  }
57
+ if (editorAnalyticsApi && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics_2')) {
58
+ var analyticsPayload = (0, _clipboard.getNodeCopiedAnalyticsPayload)(contentNodeWithPos.node, inputMethod);
59
+ editorAnalyticsApi.attachAnalyticsEvent(analyticsPayload)(copyToClipboardTr);
60
+ }
56
61
  copyToClipboardTr.setMeta('scrollIntoView', false);
57
62
  return copyToClipboardTr;
58
63
  };
@@ -151,7 +151,10 @@ export const floatingToolbarPlugin = ({
151
151
  forceFocusSelector
152
152
  },
153
153
  commands: {
154
- copyNode: nodeType => copyNode(nodeType)
154
+ copyNode: (nodeType, inputMethod) => {
155
+ var _api$analytics;
156
+ return copyNode(nodeType, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, inputMethod);
157
+ }
155
158
  },
156
159
  getSharedState(editorState) {
157
160
  var _api$interaction, _api$interaction$shar;
@@ -1,8 +1,9 @@
1
1
  import { browser } from '@atlaskit/editor-common/browser';
2
- import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill } from '@atlaskit/editor-common/clipboard';
2
+ import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
3
  import { getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
- export const copyNode = (nodeType, editorAnalyticsAp) => ({
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
6
7
  tr
7
8
  }) => {
8
9
  // const { tr, schema } = state;
@@ -47,6 +48,10 @@ export const copyNode = (nodeType, editorAnalyticsAp) => ({
47
48
  copyHTMLToClipboard(div);
48
49
  }
49
50
  }
51
+ if (editorAnalyticsApi && fg('platform_editor_controls_patch_analytics_2')) {
52
+ const analyticsPayload = getNodeCopiedAnalyticsPayload(contentNodeWithPos.node, inputMethod);
53
+ editorAnalyticsApi.attachAnalyticsEvent(analyticsPayload)(copyToClipboardTr);
54
+ }
50
55
  copyToClipboardTr.setMeta('scrollIntoView', false);
51
56
  return copyToClipboardTr;
52
57
  };
@@ -157,8 +157,9 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
157
157
  forceFocusSelector: forceFocusSelector
158
158
  },
159
159
  commands: {
160
- copyNode: function copyNode(nodeType) {
161
- return _copyNode(nodeType);
160
+ copyNode: function copyNode(nodeType, inputMethod) {
161
+ var _api$analytics;
162
+ return _copyNode(nodeType, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, inputMethod);
162
163
  }
163
164
  },
164
165
  getSharedState: function getSharedState(editorState) {
@@ -1,8 +1,9 @@
1
1
  import { browser } from '@atlaskit/editor-common/browser';
2
- import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill } from '@atlaskit/editor-common/clipboard';
2
+ import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
3
  import { getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
- export var copyNode = function copyNode(nodeType, editorAnalyticsAp) {
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
6
7
  return function (_ref) {
7
8
  var tr = _ref.tr;
8
9
  // const { tr, schema } = state;
@@ -47,6 +48,10 @@ export var copyNode = function copyNode(nodeType, editorAnalyticsAp) {
47
48
  copyHTMLToClipboard(div);
48
49
  }
49
50
  }
51
+ if (editorAnalyticsApi && fg('platform_editor_controls_patch_analytics_2')) {
52
+ var analyticsPayload = getNodeCopiedAnalyticsPayload(contentNodeWithPos.node, inputMethod);
53
+ editorAnalyticsApi.attachAnalyticsEvent(analyticsPayload)(copyToClipboardTr);
54
+ }
50
55
  copyToClipboardTr.setMeta('scrollIntoView', false);
51
56
  return copyToClipboardTr;
52
57
  };
@@ -1,4 +1,5 @@
1
1
  import type { FloatingToolbarConfig, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
3
  import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
3
4
  import type { CopyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
4
5
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
@@ -37,7 +38,8 @@ export type FloatingToolbarPluginDependencies = [
37
38
  OptionalPlugin<FeatureFlagsPlugin>,
38
39
  OptionalPlugin<EmojiPlugin>,
39
40
  OptionalPlugin<UserIntentPlugin>,
40
- OptionalPlugin<InteractionPlugin>
41
+ OptionalPlugin<InteractionPlugin>,
42
+ OptionalPlugin<AnalyticsPlugin>
41
43
  ];
42
44
  export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
43
45
  dependencies: FloatingToolbarPluginDependencies;
@@ -1,6 +1,6 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
+ import { INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
- export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsAp?: EditorAnalyticsAPI | undefined) => ({ tr }: {
4
+ export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi?: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD) => ({ tr }: {
5
5
  tr: Transaction;
6
6
  }) => Transaction;
@@ -1,4 +1,5 @@
1
1
  import type { FloatingToolbarConfig, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
3
  import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
3
4
  import type { CopyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
4
5
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
@@ -37,7 +38,8 @@ export type FloatingToolbarPluginDependencies = [
37
38
  OptionalPlugin<FeatureFlagsPlugin>,
38
39
  OptionalPlugin<EmojiPlugin>,
39
40
  OptionalPlugin<UserIntentPlugin>,
40
- OptionalPlugin<InteractionPlugin>
41
+ OptionalPlugin<InteractionPlugin>,
42
+ OptionalPlugin<AnalyticsPlugin>
41
43
  ];
42
44
  export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
43
45
  dependencies: FloatingToolbarPluginDependencies;
@@ -1,6 +1,6 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
+ import { INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
- export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsAp?: EditorAnalyticsAPI | undefined) => ({ tr }: {
4
+ export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi?: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD) => ({ tr }: {
5
5
  tr: Transaction;
6
6
  }) => Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "4.0.8",
3
+ "version": "4.1.0",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,9 +28,10 @@
28
28
  "@atlaskit/adf-utils": "^19.19.0",
29
29
  "@atlaskit/button": "^23.0.0",
30
30
  "@atlaskit/checkbox": "^17.1.0",
31
- "@atlaskit/editor-common": "^103.22.0",
31
+ "@atlaskit/editor-common": "^104.0.0",
32
32
  "@atlaskit/editor-palette": "^2.1.0",
33
- "@atlaskit/editor-plugin-context-panel": "^4.0.0",
33
+ "@atlaskit/editor-plugin-analytics": "^2.2.0",
34
+ "@atlaskit/editor-plugin-context-panel": "^4.1.0",
34
35
  "@atlaskit/editor-plugin-copy-button": "^2.0.0",
35
36
  "@atlaskit/editor-plugin-decorations": "^2.0.0",
36
37
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
@@ -49,7 +50,7 @@
49
50
  "@atlaskit/primitives": "^14.7.0",
50
51
  "@atlaskit/select": "^20.4.0",
51
52
  "@atlaskit/theme": "^18.0.0",
52
- "@atlaskit/tmp-editor-statsig": "^4.15.0",
53
+ "@atlaskit/tmp-editor-statsig": "^4.16.0",
53
54
  "@atlaskit/tokens": "^4.8.0",
54
55
  "@atlaskit/tooltip": "^20.0.0",
55
56
  "@babel/runtime": "^7.0.0",
@@ -141,6 +142,9 @@
141
142
  },
142
143
  "platform_editor_controls_patch_6": {
143
144
  "type": "boolean"
145
+ },
146
+ "platform_editor_controls_patch_analytics_2": {
147
+ "type": "boolean"
144
148
  }
145
149
  }
146
150
  }