@atlaskit/editor-plugin-paste 5.0.1 → 6.0.1

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,19 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 6.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a159cb5368d07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a159cb5368d07) -
8
+ Add insm feature tracking for paste event
9
+ - Updated dependencies
10
+
11
+ ## 6.0.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 5.0.1
4
18
 
5
19
  ### Patch Changes
@@ -23,6 +23,7 @@ var _editorMarkdownTransformer = require("@atlaskit/editor-markdown-transformer"
23
23
  var _model = require("@atlaskit/editor-prosemirror/model");
24
24
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
25
25
  var _utils3 = require("@atlaskit/editor-tables/utils");
26
+ var _insm = require("@atlaskit/insm");
26
27
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
28
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
28
29
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -127,11 +128,16 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
127
128
  // For serialising to plain text
128
129
  clipboardTextSerializer: _clipboardTextSerializer.clipboardTextSerializer,
129
130
  handleDOMEvents: {
131
+ // note
130
132
  paste: function paste(view, event) {
131
133
  mostRecentPasteEvent = event;
134
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true) && event.clipboardData) {
135
+ _insm.insm.startHeavyTask('paste');
136
+ }
132
137
  return false;
133
138
  }
134
139
  },
140
+ // note
135
141
  handlePaste: function handlePaste(view, rawEvent, slice) {
136
142
  var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
137
143
  var event = rawEvent;
@@ -165,6 +171,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
165
171
  // Bail if copied content has files
166
172
  if (isPastedFile) {
167
173
  if (!html) {
174
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
175
+ _insm.insm.endHeavyTask('paste');
176
+ }
168
177
  /**
169
178
  * Microsoft Office, Number, Pages, etc. adds an image to clipboard
170
179
  * with other mime-types so we don't let the event reach media.
@@ -183,6 +192,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
183
192
  * is skipped and handled in handleRichText
184
193
  */
185
194
  if ((0, _util.htmlContainsSingleFile)(html) && !isInsideBlockQuote(view.state)) {
195
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
196
+ _insm.insm.endHeavyTask('paste');
197
+ }
186
198
  return true;
187
199
  }
188
200
 
@@ -209,6 +221,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
209
221
  if (payload) {
210
222
  dispatchAnalyticsEvent(payload);
211
223
  }
224
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
225
+ _insm.insm.endHeavyTask('paste');
226
+ }
212
227
  });
213
228
  var getLastPastedSlice = function getLastPastedSlice(tr) {
214
229
  var slice;
@@ -12,6 +12,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
12
12
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
13
13
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
14
14
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
15
+ import { insm } from '@atlaskit/insm';
15
16
  import { fg } from '@atlaskit/platform-feature-flags';
16
17
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
18
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -92,11 +93,16 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
92
93
  // For serialising to plain text
93
94
  clipboardTextSerializer,
94
95
  handleDOMEvents: {
96
+ // note
95
97
  paste: (view, event) => {
96
98
  mostRecentPasteEvent = event;
99
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true) && event.clipboardData) {
100
+ insm.startHeavyTask('paste');
101
+ }
97
102
  return false;
98
103
  }
99
104
  },
105
+ // note
100
106
  handlePaste(view, rawEvent, slice) {
101
107
  var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
102
108
  const event = rawEvent;
@@ -130,6 +136,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
130
136
  // Bail if copied content has files
131
137
  if (isPastedFile) {
132
138
  if (!html) {
139
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
140
+ insm.endHeavyTask('paste');
141
+ }
133
142
  /**
134
143
  * Microsoft Office, Number, Pages, etc. adds an image to clipboard
135
144
  * with other mime-types so we don't let the event reach media.
@@ -148,6 +157,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
148
157
  * is skipped and handled in handleRichText
149
158
  */
150
159
  if (htmlContainsSingleFile(html) && !isInsideBlockQuote(view.state)) {
160
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
161
+ insm.endHeavyTask('paste');
162
+ }
151
163
  return true;
152
164
  }
153
165
 
@@ -177,6 +189,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
177
189
  if (payload) {
178
190
  dispatchAnalyticsEvent(payload);
179
191
  }
192
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
193
+ insm.endHeavyTask('paste');
194
+ }
180
195
  });
181
196
  const getLastPastedSlice = tr => {
182
197
  let slice;
@@ -17,6 +17,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
17
17
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
18
18
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
19
19
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
20
+ import { insm } from '@atlaskit/insm';
20
21
  import { fg } from '@atlaskit/platform-feature-flags';
21
22
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
22
23
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -118,11 +119,16 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
118
119
  // For serialising to plain text
119
120
  clipboardTextSerializer: clipboardTextSerializer,
120
121
  handleDOMEvents: {
122
+ // note
121
123
  paste: function paste(view, event) {
122
124
  mostRecentPasteEvent = event;
125
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true) && event.clipboardData) {
126
+ insm.startHeavyTask('paste');
127
+ }
123
128
  return false;
124
129
  }
125
130
  },
131
+ // note
126
132
  handlePaste: function handlePaste(view, rawEvent, slice) {
127
133
  var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
128
134
  var event = rawEvent;
@@ -156,6 +162,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
156
162
  // Bail if copied content has files
157
163
  if (isPastedFile) {
158
164
  if (!html) {
165
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
166
+ insm.endHeavyTask('paste');
167
+ }
159
168
  /**
160
169
  * Microsoft Office, Number, Pages, etc. adds an image to clipboard
161
170
  * with other mime-types so we don't let the event reach media.
@@ -174,6 +183,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
174
183
  * is skipped and handled in handleRichText
175
184
  */
176
185
  if (htmlContainsSingleFile(html) && !isInsideBlockQuote(view.state)) {
186
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
187
+ insm.endHeavyTask('paste');
188
+ }
177
189
  return true;
178
190
  }
179
191
 
@@ -200,6 +212,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
200
212
  if (payload) {
201
213
  dispatchAnalyticsEvent(payload);
202
214
  }
215
+ if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
216
+ insm.endHeavyTask('paste');
217
+ }
203
218
  });
204
219
  var getLastPastedSlice = function getLastPastedSlice(tr) {
205
220
  var slice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "5.0.1",
3
+ "version": "6.0.1",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,37 +27,38 @@
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
- "@atlaskit/adf-schema": "^50.2.3",
30
+ "@atlaskit/adf-schema": "^51.0.0",
31
31
  "@atlaskit/code": "^17.2.0",
32
32
  "@atlaskit/editor-markdown-transformer": "^5.16.0",
33
- "@atlaskit/editor-plugin-analytics": "^4.0.0",
34
- "@atlaskit/editor-plugin-annotation": "^4.0.0",
35
- "@atlaskit/editor-plugin-better-type-history": "^4.0.0",
36
- "@atlaskit/editor-plugin-card": "^8.0.0",
37
- "@atlaskit/editor-plugin-feature-flags": "^3.0.0",
38
- "@atlaskit/editor-plugin-list": "^6.0.0",
39
- "@atlaskit/editor-plugin-media": "^6.0.0",
40
- "@atlaskit/editor-plugin-mentions": "^6.0.0",
33
+ "@atlaskit/editor-plugin-analytics": "^5.0.0",
34
+ "@atlaskit/editor-plugin-annotation": "^5.0.0",
35
+ "@atlaskit/editor-plugin-better-type-history": "^5.0.0",
36
+ "@atlaskit/editor-plugin-card": "^9.0.0",
37
+ "@atlaskit/editor-plugin-feature-flags": "^4.0.0",
38
+ "@atlaskit/editor-plugin-list": "^7.0.0",
39
+ "@atlaskit/editor-plugin-media": "^7.0.0",
40
+ "@atlaskit/editor-plugin-mentions": "^7.0.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
42
42
  "@atlaskit/editor-tables": "^2.9.0",
43
+ "@atlaskit/insm": "^0.1.0",
43
44
  "@atlaskit/media-client": "^35.3.0",
44
45
  "@atlaskit/media-common": "^12.3.0",
45
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^12.1.0",
47
+ "@atlaskit/tmp-editor-statsig": "^12.12.0",
47
48
  "@babel/runtime": "^7.0.0",
48
49
  "lodash": "^4.17.21",
49
50
  "uuid": "^3.1.0"
50
51
  },
51
52
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^108.0.0",
53
+ "@atlaskit/editor-common": "^109.1.0",
53
54
  "react": "^18.2.0",
54
55
  "react-dom": "^18.2.0"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@af/visual-regression": "workspace:^",
58
- "@atlaskit/editor-plugin-block-type": "^7.0.0",
59
- "@atlaskit/editor-plugin-history": "^4.0.0",
60
- "@atlaskit/editor-plugin-type-ahead": "^4.0.0",
59
+ "@atlaskit/editor-plugin-block-type": "^8.0.0",
60
+ "@atlaskit/editor-plugin-history": "^5.0.0",
61
+ "@atlaskit/editor-plugin-type-ahead": "^5.0.0",
61
62
  "@atlaskit/ssr": "workspace:^",
62
63
  "@testing-library/react": "^13.4.0",
63
64
  "wait-for-expect": "^1.2.0"