@atlaskit/editor-plugin-paste 8.0.0 → 8.0.2

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,23 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 8.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c4a774ad462fb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4a774ad462fb) -
8
+ EDITOR-2477 Clean up remaining usages of `platform_editor_use_nested_table_pm_nodes` which are no
9
+ longer needed now that `isNestedTablesSupported` is fully rolled out.
10
+ - Updated dependencies
11
+
12
+ ## 8.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [`5812c1aff4a50`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5812c1aff4a50) -
17
+ Clean up platform_editor_pasting_nested_table_fix experiment - Fix nested table pasting by using
18
+ getLastPastedSlice
19
+ - Updated dependencies
20
+
3
21
  ## 8.0.0
4
22
 
5
23
  ### Patch Changes
@@ -290,48 +290,26 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
290
290
  // we make sure to call paste options toolbar
291
291
  // only for a valid paste action
292
292
  if (isDocChanged) {
293
- if ((0, _expValEquals.expValEquals)('platform_editor_pasting_nested_table_fix', 'isEnabled', true)) {
294
- var pastedSlice = getLastPastedSlice(tr);
295
- if (pastedSlice) {
296
- var _input;
297
- var pasteStartPos = state.selection.from;
298
- var pasteEndPos = tr.selection.to;
299
- var contentPasted = {
300
- pasteStartPos: pasteStartPos,
301
- pasteEndPos: pasteEndPos,
302
- text: text,
303
- isShiftPressed: Boolean(
304
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
305
- view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
306
- isPlainText: Boolean(isPlainText),
307
- pastedSlice: pastedSlice,
308
- pastedAt: Date.now(),
309
- pasteSource: (0, _util.getPasteSource)(event)
310
- };
311
- tr.setMeta(_pluginFactory.pluginKey, {
312
- type: _actions.PastePluginActionTypes.ON_PASTE,
313
- contentPasted: contentPasted
314
- });
315
- }
316
- } else {
317
- var _input2;
318
- var _pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
319
- var _pasteEndPos = tr.selection.to;
320
- var _contentPasted = {
321
- pasteStartPos: _pasteStartPos,
322
- pasteEndPos: _pasteEndPos,
293
+ var pastedSlice = getLastPastedSlice(tr);
294
+ if (pastedSlice) {
295
+ var _input;
296
+ var pasteStartPos = state.selection.from;
297
+ var pasteEndPos = tr.selection.to;
298
+ var contentPasted = {
299
+ pasteStartPos: pasteStartPos,
300
+ pasteEndPos: pasteEndPos,
323
301
  text: text,
324
302
  isShiftPressed: Boolean(
325
303
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
- view.shiftKey || ((_input2 = view.input) === null || _input2 === void 0 ? void 0 : _input2.shiftKey)),
304
+ view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
327
305
  isPlainText: Boolean(isPlainText),
328
- pastedSlice: tr.doc.slice(_pasteStartPos, _pasteEndPos),
306
+ pastedSlice: pastedSlice,
329
307
  pastedAt: Date.now(),
330
308
  pasteSource: (0, _util.getPasteSource)(event)
331
309
  };
332
310
  tr.setMeta(_pluginFactory.pluginKey, {
333
311
  type: _actions.PastePluginActionTypes.ON_PASTE,
334
- contentPasted: _contentPasted
312
+ contentPasted: contentPasted
335
313
  });
336
314
  }
337
315
  }
@@ -443,7 +421,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
443
421
  }
444
422
 
445
423
  // handle paste of nested tables to ensure nesting limits are respected
446
- if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _nesting.isNestedTablesSupported)(state.schema) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
424
+ if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _nesting.isNestedTablesSupported)(state.schema))(view, event, slice)(state, dispatch)) {
447
425
  return true;
448
426
  }
449
427
  if ((0, _analytics2.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics.PasteTypes.plain : _analytics.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
@@ -252,32 +252,10 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
252
252
  // we make sure to call paste options toolbar
253
253
  // only for a valid paste action
254
254
  if (isDocChanged) {
255
- if (expValEquals('platform_editor_pasting_nested_table_fix', 'isEnabled', true)) {
256
- const pastedSlice = getLastPastedSlice(tr);
257
- if (pastedSlice) {
258
- var _input;
259
- const pasteStartPos = state.selection.from;
260
- const pasteEndPos = tr.selection.to;
261
- const contentPasted = {
262
- pasteStartPos,
263
- pasteEndPos,
264
- text,
265
- isShiftPressed: Boolean(
266
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
- view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
268
- isPlainText: Boolean(isPlainText),
269
- pastedSlice,
270
- pastedAt: Date.now(),
271
- pasteSource: getPasteSource(event)
272
- };
273
- tr.setMeta(stateKey, {
274
- type: PastePluginActionTypes.ON_PASTE,
275
- contentPasted
276
- });
277
- }
278
- } else {
279
- var _input2;
280
- const pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
255
+ const pastedSlice = getLastPastedSlice(tr);
256
+ if (pastedSlice) {
257
+ var _input;
258
+ const pasteStartPos = state.selection.from;
281
259
  const pasteEndPos = tr.selection.to;
282
260
  const contentPasted = {
283
261
  pasteStartPos,
@@ -285,9 +263,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
285
263
  text,
286
264
  isShiftPressed: Boolean(
287
265
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
288
- view.shiftKey || ((_input2 = view.input) === null || _input2 === void 0 ? void 0 : _input2.shiftKey)),
266
+ view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
289
267
  isPlainText: Boolean(isPlainText),
290
- pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
268
+ pastedSlice,
291
269
  pastedAt: Date.now(),
292
270
  pasteSource: getPasteSource(event)
293
271
  };
@@ -405,7 +383,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
405
383
  }
406
384
 
407
385
  // handle paste of nested tables to ensure nesting limits are respected
408
- if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, isNestedTablesSupported(state.schema) && fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
386
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, isNestedTablesSupported(state.schema))(view, event, slice)(state, dispatch)) {
409
387
  return true;
410
388
  }
411
389
  if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
@@ -282,48 +282,26 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
282
282
  // we make sure to call paste options toolbar
283
283
  // only for a valid paste action
284
284
  if (isDocChanged) {
285
- if (expValEquals('platform_editor_pasting_nested_table_fix', 'isEnabled', true)) {
286
- var pastedSlice = getLastPastedSlice(tr);
287
- if (pastedSlice) {
288
- var _input;
289
- var pasteStartPos = state.selection.from;
290
- var pasteEndPos = tr.selection.to;
291
- var contentPasted = {
292
- pasteStartPos: pasteStartPos,
293
- pasteEndPos: pasteEndPos,
294
- text: text,
295
- isShiftPressed: Boolean(
296
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
297
- view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
298
- isPlainText: Boolean(isPlainText),
299
- pastedSlice: pastedSlice,
300
- pastedAt: Date.now(),
301
- pasteSource: getPasteSource(event)
302
- };
303
- tr.setMeta(stateKey, {
304
- type: PastePluginActionTypes.ON_PASTE,
305
- contentPasted: contentPasted
306
- });
307
- }
308
- } else {
309
- var _input2;
310
- var _pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
311
- var _pasteEndPos = tr.selection.to;
312
- var _contentPasted = {
313
- pasteStartPos: _pasteStartPos,
314
- pasteEndPos: _pasteEndPos,
285
+ var pastedSlice = getLastPastedSlice(tr);
286
+ if (pastedSlice) {
287
+ var _input;
288
+ var pasteStartPos = state.selection.from;
289
+ var pasteEndPos = tr.selection.to;
290
+ var contentPasted = {
291
+ pasteStartPos: pasteStartPos,
292
+ pasteEndPos: pasteEndPos,
315
293
  text: text,
316
294
  isShiftPressed: Boolean(
317
295
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
- view.shiftKey || ((_input2 = view.input) === null || _input2 === void 0 ? void 0 : _input2.shiftKey)),
296
+ view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
319
297
  isPlainText: Boolean(isPlainText),
320
- pastedSlice: tr.doc.slice(_pasteStartPos, _pasteEndPos),
298
+ pastedSlice: pastedSlice,
321
299
  pastedAt: Date.now(),
322
300
  pasteSource: getPasteSource(event)
323
301
  };
324
302
  tr.setMeta(stateKey, {
325
303
  type: PastePluginActionTypes.ON_PASTE,
326
- contentPasted: _contentPasted
304
+ contentPasted: contentPasted
327
305
  });
328
306
  }
329
307
  }
@@ -435,7 +413,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
435
413
  }
436
414
 
437
415
  // handle paste of nested tables to ensure nesting limits are respected
438
- if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, isNestedTablesSupported(state.schema) && fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
416
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, isNestedTablesSupported(state.schema))(view, event, slice)(state, dispatch)) {
439
417
  return true;
440
418
  }
441
419
  if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/editor-plugin-card": "^12.0.0",
37
37
  "@atlaskit/editor-plugin-feature-flags": "^6.0.0",
38
38
  "@atlaskit/editor-plugin-list": "^9.0.0",
39
- "@atlaskit/editor-plugin-media": "^9.0.0",
39
+ "@atlaskit/editor-plugin-media": "^9.1.0",
40
40
  "@atlaskit/editor-plugin-mentions": "^9.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^7.2.0",
42
42
  "@atlaskit/editor-tables": "^2.9.0",
@@ -45,14 +45,14 @@
45
45
  "@atlaskit/media-common": "^12.3.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/prosemirror-history": "^0.2.0",
48
- "@atlaskit/tmp-editor-statsig": "^16.3.0",
48
+ "@atlaskit/tmp-editor-statsig": "^16.4.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "lodash": "^4.17.21",
51
51
  "react-intl-next": "npm:react-intl@^5.18.1",
52
52
  "uuid": "^3.1.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@atlaskit/editor-common": "^111.0.0",
55
+ "@atlaskit/editor-common": "^111.2.0",
56
56
  "react": "^18.2.0",
57
57
  "react-dom": "^18.2.0"
58
58
  },
@@ -97,9 +97,6 @@
97
97
  }
98
98
  },
99
99
  "platform-feature-flags": {
100
- "platform_editor_use_nested_table_pm_nodes": {
101
- "type": "boolean"
102
- },
103
100
  "platform_editor_fix_captions_on_copy": {
104
101
  "type": "boolean"
105
102
  },