@atlaskit/editor-plugin-paste 2.0.2 → 2.0.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
2
2
 
3
+ ## 2.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#162388](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162388)
8
+ [`2ec86d6f98873`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2ec86d6f98873) -
9
+ hard-code pasteTracking to always be enabled :)
10
+ - Updated dependencies
11
+
3
12
  ## 2.0.2
4
13
 
5
14
  ### Patch Changes
@@ -135,7 +135,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
135
135
  }
136
136
  },
137
137
  handlePaste: function handlePaste(view, rawEvent, slice) {
138
- var _text, _pluginInjectionApi$a2, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
138
+ var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
139
139
  var event = rawEvent;
140
140
  if (!event.clipboardData) {
141
141
  return false;
@@ -189,26 +189,22 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
189
189
  event.stopPropagation();
190
190
  }
191
191
  var state = view.state;
192
- var analyticsPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 || (_pluginInjectionApi$a2 = _pluginInjectionApi$a2.sharedState) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.currentState();
193
- var pasteTrackingEnabled = analyticsPlugin === null || analyticsPlugin === void 0 || (_analyticsPlugin$perf = analyticsPlugin.performanceTracking) === null || _analyticsPlugin$perf === void 0 || (_analyticsPlugin$perf = _analyticsPlugin$perf.pasteTracking) === null || _analyticsPlugin$perf === void 0 ? void 0 : _analyticsPlugin$perf.enabled;
194
- if (pasteTrackingEnabled) {
195
- var content = (0, _analytics2.getContentNodeTypes)(slice.content);
196
- var pasteId = (0, _uuid.default)();
197
- var measureName = "".concat(PASTE, "_").concat(pasteId);
198
- (0, _measureRender.measureRender)(measureName, function (_ref) {
199
- var duration = _ref.duration,
200
- distortedDuration = _ref.distortedDuration;
201
- var payload = (0, _analytics2.createPasteMeasurePayload)({
202
- view: view,
203
- duration: duration,
204
- content: content,
205
- distortedDuration: distortedDuration
206
- });
207
- if (payload) {
208
- dispatchAnalyticsEvent(payload);
209
- }
192
+ var content = (0, _analytics2.getContentNodeTypes)(slice.content);
193
+ var pasteId = (0, _uuid.default)();
194
+ var measureName = "".concat(PASTE, "_").concat(pasteId);
195
+ (0, _measureRender.measureRender)(measureName, function (_ref) {
196
+ var duration = _ref.duration,
197
+ distortedDuration = _ref.distortedDuration;
198
+ var payload = (0, _analytics2.createPasteMeasurePayload)({
199
+ view: view,
200
+ duration: duration,
201
+ content: content,
202
+ distortedDuration: distortedDuration
210
203
  });
211
- }
204
+ if (payload) {
205
+ dispatchAnalyticsEvent(payload);
206
+ }
207
+ });
212
208
  // creating a custom dispatch because we want to add a meta whenever we do a paste.
213
209
  var dispatch = function dispatch(tr) {
214
210
  var _state$doc$resolve$no;
@@ -405,8 +401,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
405
401
  // remove annotation marks from the pasted data if they are not present in the document
406
402
  // for the cases when they are pasted from external pages
407
403
  if (slice.content.size && (0, _utils.containsAnyAnnotations)(slice, state)) {
408
- var _pluginInjectionApi$a3;
409
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a3 === void 0 || _pluginInjectionApi$a3.actions.stripNonExistingAnnotations(slice, state);
404
+ var _pluginInjectionApi$a2;
405
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
410
406
  }
411
407
 
412
408
  // ED-4732
@@ -99,7 +99,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
99
99
  }
100
100
  },
101
101
  handlePaste(view, rawEvent, slice) {
102
- var _text, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
102
+ var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
103
103
  const event = rawEvent;
104
104
  if (!event.clipboardData) {
105
105
  return false;
@@ -155,27 +155,23 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
155
155
  const {
156
156
  state
157
157
  } = view;
158
- const analyticsPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : (_pluginInjectionApi$a3 = _pluginInjectionApi$a2.sharedState) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.currentState();
159
- const pasteTrackingEnabled = analyticsPlugin === null || analyticsPlugin === void 0 ? void 0 : (_analyticsPlugin$perf = analyticsPlugin.performanceTracking) === null || _analyticsPlugin$perf === void 0 ? void 0 : (_analyticsPlugin$perf2 = _analyticsPlugin$perf.pasteTracking) === null || _analyticsPlugin$perf2 === void 0 ? void 0 : _analyticsPlugin$perf2.enabled;
160
- if (pasteTrackingEnabled) {
161
- const content = getContentNodeTypes(slice.content);
162
- const pasteId = uuid();
163
- const measureName = `${PASTE}_${pasteId}`;
164
- measureRender(measureName, ({
158
+ const content = getContentNodeTypes(slice.content);
159
+ const pasteId = uuid();
160
+ const measureName = `${PASTE}_${pasteId}`;
161
+ measureRender(measureName, ({
162
+ duration,
163
+ distortedDuration
164
+ }) => {
165
+ const payload = createPasteMeasurePayload({
166
+ view,
165
167
  duration,
168
+ content,
166
169
  distortedDuration
167
- }) => {
168
- const payload = createPasteMeasurePayload({
169
- view,
170
- duration,
171
- content,
172
- distortedDuration
173
- });
174
- if (payload) {
175
- dispatchAnalyticsEvent(payload);
176
- }
177
170
  });
178
- }
171
+ if (payload) {
172
+ dispatchAnalyticsEvent(payload);
173
+ }
174
+ });
179
175
  // creating a custom dispatch because we want to add a meta whenever we do a paste.
180
176
  const dispatch = tr => {
181
177
  var _state$doc$resolve$no;
@@ -376,8 +372,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
376
372
  // remove annotation marks from the pasted data if they are not present in the document
377
373
  // for the cases when they are pasted from external pages
378
374
  if (slice.content.size && containsAnyAnnotations(slice, state)) {
379
- var _pluginInjectionApi$a4;
380
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions.stripNonExistingAnnotations(slice, state);
375
+ var _pluginInjectionApi$a2;
376
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
381
377
  }
382
378
 
383
379
  // ED-4732
@@ -122,7 +122,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
122
122
  }
123
123
  },
124
124
  handlePaste: function handlePaste(view, rawEvent, slice) {
125
- var _text, _pluginInjectionApi$a2, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
125
+ var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
126
126
  var event = rawEvent;
127
127
  if (!event.clipboardData) {
128
128
  return false;
@@ -176,26 +176,22 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
176
176
  event.stopPropagation();
177
177
  }
178
178
  var state = view.state;
179
- var analyticsPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 || (_pluginInjectionApi$a2 = _pluginInjectionApi$a2.sharedState) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.currentState();
180
- var pasteTrackingEnabled = analyticsPlugin === null || analyticsPlugin === void 0 || (_analyticsPlugin$perf = analyticsPlugin.performanceTracking) === null || _analyticsPlugin$perf === void 0 || (_analyticsPlugin$perf = _analyticsPlugin$perf.pasteTracking) === null || _analyticsPlugin$perf === void 0 ? void 0 : _analyticsPlugin$perf.enabled;
181
- if (pasteTrackingEnabled) {
182
- var content = getContentNodeTypes(slice.content);
183
- var pasteId = uuid();
184
- var measureName = "".concat(PASTE, "_").concat(pasteId);
185
- measureRender(measureName, function (_ref) {
186
- var duration = _ref.duration,
187
- distortedDuration = _ref.distortedDuration;
188
- var payload = createPasteMeasurePayload({
189
- view: view,
190
- duration: duration,
191
- content: content,
192
- distortedDuration: distortedDuration
193
- });
194
- if (payload) {
195
- dispatchAnalyticsEvent(payload);
196
- }
179
+ var content = getContentNodeTypes(slice.content);
180
+ var pasteId = uuid();
181
+ var measureName = "".concat(PASTE, "_").concat(pasteId);
182
+ measureRender(measureName, function (_ref) {
183
+ var duration = _ref.duration,
184
+ distortedDuration = _ref.distortedDuration;
185
+ var payload = createPasteMeasurePayload({
186
+ view: view,
187
+ duration: duration,
188
+ content: content,
189
+ distortedDuration: distortedDuration
197
190
  });
198
- }
191
+ if (payload) {
192
+ dispatchAnalyticsEvent(payload);
193
+ }
194
+ });
199
195
  // creating a custom dispatch because we want to add a meta whenever we do a paste.
200
196
  var dispatch = function dispatch(tr) {
201
197
  var _state$doc$resolve$no;
@@ -392,8 +388,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
392
388
  // remove annotation marks from the pasted data if they are not present in the document
393
389
  // for the cases when they are pasted from external pages
394
390
  if (slice.content.size && containsAnyAnnotations(slice, state)) {
395
- var _pluginInjectionApi$a3;
396
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a3 === void 0 || _pluginInjectionApi$a3.actions.stripNonExistingAnnotations(slice, state);
391
+ var _pluginInjectionApi$a2;
392
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
397
393
  }
398
394
 
399
395
  // ED-4732
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,22 +31,22 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^94.12.0",
34
+ "@atlaskit/editor-common": "^94.17.0",
35
35
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-annotation": "^1.23.0",
38
38
  "@atlaskit/editor-plugin-better-type-history": "^1.9.0",
39
- "@atlaskit/editor-plugin-card": "^4.3.0",
39
+ "@atlaskit/editor-plugin-card": "^4.4.0",
40
40
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
41
41
  "@atlaskit/editor-plugin-list": "^3.9.0",
42
42
  "@atlaskit/editor-plugin-media": "^1.39.0",
43
43
  "@atlaskit/editor-plugin-mentions": "^2.10.0",
44
44
  "@atlaskit/editor-prosemirror": "6.0.0",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
- "@atlaskit/media-client": "^28.0.0",
46
+ "@atlaskit/media-client": "^28.2.0",
47
47
  "@atlaskit/media-common": "^11.7.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^2.11.0",
49
+ "@atlaskit/tmp-editor-statsig": "^2.12.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "lodash": "^4.17.21",
52
52
  "uuid": "^3.1.0"