@atlaskit/editor-plugin-paste 2.0.17 → 2.0.19

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,21 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 2.0.19
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.0.18
10
+
11
+ ### Patch Changes
12
+
13
+ - [#102971](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102971)
14
+ [`a87c6952a44b1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a87c6952a44b1) -
15
+ ED-25451 Support copy of media caption and fix range error when pasting a caption into another
16
+ caption
17
+ - Updated dependencies
18
+
3
19
  ## 2.0.17
4
20
 
5
21
  ### Patch Changes
@@ -282,6 +282,18 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
282
282
  if ((0, _analytics2.handlePasteAsPlainTextWithAnalytics)(editorAnalyticsAPI)(view, event, plainTextPasteSlice)(state, dispatch, view)) {
283
283
  return true;
284
284
  }
285
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_captions_on_copy')) {
286
+ if ((0, _analytics2.handlePasteIntoCaptionWithAnalytics)(editorAnalyticsAPI)(view, event, slice, _analytics.PasteTypes.richText)(state, dispatch)) {
287
+ // Create a custom handler to avoid handling with handleRichText method
288
+ // As SafeInsert is used inside handleRichText which caused some bad UX like this:
289
+ // https://product-fabric.atlassian.net/browse/MEX-1520
290
+
291
+ // Converting caption to plain text needs to be handled before transformSliceForMedia
292
+ // as createChecked will fail when trying to create a mediaSingle node with a caption
293
+ // that is not plain text.
294
+ return true;
295
+ }
296
+ }
285
297
 
286
298
  // transform slices based on destination
287
299
  slice = (0, _media.transformSliceForMedia)(slice, schema)(state.selection);
@@ -445,12 +457,13 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
445
457
  if (!(0, _coreUtils.insideTable)(state)) {
446
458
  slice = (0, _transforms.transformSliceNestedExpandToExpand)(slice, state.schema);
447
459
  }
448
-
449
- // Create a custom handler to avoid handling with handleRichText method
450
- // As SafeInsert is used inside handleRichText which caused some bad UX like this:
451
- // https://product-fabric.atlassian.net/browse/MEX-1520
452
- if ((0, _analytics2.handlePasteIntoCaptionWithAnalytics)(editorAnalyticsAPI)(view, event, slice, _analytics.PasteTypes.richText)(state, dispatch)) {
453
- return true;
460
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_captions_on_copy')) {
461
+ if ((0, _analytics2.handlePasteIntoCaptionWithAnalytics)(editorAnalyticsAPI)(view, event, slice, _analytics.PasteTypes.richText)(state, dispatch)) {
462
+ // Create a custom handler to avoid handling with handleRichText method
463
+ // As SafeInsert is used inside handleRichText which caused some bad UX like this:
464
+ // https://product-fabric.atlassian.net/browse/MEX-1520
465
+ return true;
466
+ }
454
467
  }
455
468
  if ((0, _analytics2.handlePastePanelOrDecisionIntoListWithAnalytics)(editorAnalyticsAPI)(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
456
469
  return true;
@@ -256,6 +256,18 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
256
256
  if (handlePasteAsPlainTextWithAnalytics(editorAnalyticsAPI)(view, event, plainTextPasteSlice)(state, dispatch, view)) {
257
257
  return true;
258
258
  }
259
+ if (fg('platform_editor_fix_captions_on_copy')) {
260
+ if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
261
+ // Create a custom handler to avoid handling with handleRichText method
262
+ // As SafeInsert is used inside handleRichText which caused some bad UX like this:
263
+ // https://product-fabric.atlassian.net/browse/MEX-1520
264
+
265
+ // Converting caption to plain text needs to be handled before transformSliceForMedia
266
+ // as createChecked will fail when trying to create a mediaSingle node with a caption
267
+ // that is not plain text.
268
+ return true;
269
+ }
270
+ }
259
271
 
260
272
  // transform slices based on destination
261
273
  slice = transformSliceForMedia(slice, schema)(state.selection);
@@ -419,12 +431,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
419
431
  if (!insideTable(state)) {
420
432
  slice = transformSliceNestedExpandToExpand(slice, state.schema);
421
433
  }
422
-
423
- // Create a custom handler to avoid handling with handleRichText method
424
- // As SafeInsert is used inside handleRichText which caused some bad UX like this:
425
- // https://product-fabric.atlassian.net/browse/MEX-1520
426
- if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
427
- return true;
434
+ if (!fg('platform_editor_fix_captions_on_copy')) {
435
+ if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
436
+ // Create a custom handler to avoid handling with handleRichText method
437
+ // As SafeInsert is used inside handleRichText which caused some bad UX like this:
438
+ // https://product-fabric.atlassian.net/browse/MEX-1520
439
+ return true;
440
+ }
428
441
  }
429
442
  if (handlePastePanelOrDecisionIntoListWithAnalytics(editorAnalyticsAPI)(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
430
443
  return true;
@@ -274,6 +274,18 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
274
274
  if (handlePasteAsPlainTextWithAnalytics(editorAnalyticsAPI)(view, event, plainTextPasteSlice)(state, dispatch, view)) {
275
275
  return true;
276
276
  }
277
+ if (fg('platform_editor_fix_captions_on_copy')) {
278
+ if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
279
+ // Create a custom handler to avoid handling with handleRichText method
280
+ // As SafeInsert is used inside handleRichText which caused some bad UX like this:
281
+ // https://product-fabric.atlassian.net/browse/MEX-1520
282
+
283
+ // Converting caption to plain text needs to be handled before transformSliceForMedia
284
+ // as createChecked will fail when trying to create a mediaSingle node with a caption
285
+ // that is not plain text.
286
+ return true;
287
+ }
288
+ }
277
289
 
278
290
  // transform slices based on destination
279
291
  slice = transformSliceForMedia(slice, schema)(state.selection);
@@ -437,12 +449,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
437
449
  if (!insideTable(state)) {
438
450
  slice = transformSliceNestedExpandToExpand(slice, state.schema);
439
451
  }
440
-
441
- // Create a custom handler to avoid handling with handleRichText method
442
- // As SafeInsert is used inside handleRichText which caused some bad UX like this:
443
- // https://product-fabric.atlassian.net/browse/MEX-1520
444
- if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
445
- return true;
452
+ if (!fg('platform_editor_fix_captions_on_copy')) {
453
+ if (handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
454
+ // Create a custom handler to avoid handling with handleRichText method
455
+ // As SafeInsert is used inside handleRichText which caused some bad UX like this:
456
+ // https://product-fabric.atlassian.net/browse/MEX-1520
457
+ return true;
458
+ }
446
459
  }
447
460
  if (handlePastePanelOrDecisionIntoListWithAnalytics(editorAnalyticsAPI)(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
448
461
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "2.0.17",
3
+ "version": "2.0.19",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^99.2.0",
35
+ "@atlaskit/editor-common": "^99.4.0",
36
36
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
38
38
  "@atlaskit/editor-plugin-annotation": "^1.26.0",
@@ -41,13 +41,13 @@
41
41
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
42
42
  "@atlaskit/editor-plugin-list": "^3.9.0",
43
43
  "@atlaskit/editor-plugin-media": "^1.44.0",
44
- "@atlaskit/editor-plugin-mentions": "^2.12.0",
44
+ "@atlaskit/editor-plugin-mentions": "^2.13.0",
45
45
  "@atlaskit/editor-prosemirror": "6.2.1",
46
46
  "@atlaskit/editor-tables": "^2.8.0",
47
- "@atlaskit/media-client": "^29.0.0",
47
+ "@atlaskit/media-client": "^30.0.0",
48
48
  "@atlaskit/media-common": "^11.7.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.3.0",
50
- "@atlaskit/tmp-editor-statsig": "^2.35.0",
50
+ "@atlaskit/tmp-editor-statsig": "^2.38.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "lodash": "^4.17.21",
53
53
  "uuid": "^3.1.0"
@@ -121,6 +121,9 @@
121
121
  },
122
122
  "platform_editor_advanced_layouts_post_fix_patch_2": {
123
123
  "type": "boolean"
124
+ },
125
+ "platform_editor_fix_captions_on_copy": {
126
+ "type": "boolean"
124
127
  }
125
128
  }
126
129
  }