@atlaskit/editor-plugin-paste 2.0.18 → 2.0.20

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.20
4
+
5
+ ### Patch Changes
6
+
7
+ - [#104508](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104508)
8
+ [`8fb009b2b619c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8fb009b2b619c) -
9
+ [ux] [ED-26221] Fix pasting order for tables, nested tables and tasks and decisions (panels). This
10
+ ensures when pasting a table inside a panel inside a table replaces the panel with the table.
11
+ - Updated dependencies
12
+
13
+ ## 2.0.19
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 2.0.18
4
20
 
5
21
  ### Patch Changes
@@ -340,9 +340,6 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
340
340
  // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
341
341
  slice.openStart = 1;
342
342
  }
343
- if ((0, _analytics2.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics.PasteTypes.plain : _analytics.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
344
- return true;
345
- }
346
343
 
347
344
  // If we're in a code block, append the text contents of clipboard inside it
348
345
  if ((0, _analytics2.handleCodeBlockWithAnalytics)(editorAnalyticsAPI)(view, event, slice, text)(state, dispatch)) {
@@ -361,6 +358,23 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
361
358
  isNestedMarkdownTable = !!(markdownSlice && isPlainText && isParentNodeTdOrTh && (0, _analytics2.getContentNodeTypes)(markdownSlice.content).includes((_schema$nodes$table = schema.nodes.table) === null || _schema$nodes$table === void 0 ? void 0 : _schema$nodes$table.name));
362
359
  slice = isNestedMarkdownTable ? markdownSlice : slice;
363
360
 
361
+ // get editor-tables to handle pasting tables if it can
362
+ // otherwise, just the replace the selection with the content
363
+ if ((0, _utils3.handlePaste)(view, null, slice)) {
364
+ (0, _analytics2.sendPasteAnalyticsEvent)(editorAnalyticsAPI)(view, event, slice, {
365
+ type: _analytics.PasteTypes.richText
366
+ });
367
+ return true;
368
+ }
369
+
370
+ // handle paste of nested tables to ensure nesting limits are respected
371
+ if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
372
+ return true;
373
+ }
374
+ if ((0, _analytics2.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics.PasteTypes.plain : _analytics.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
375
+ return true;
376
+ }
377
+
364
378
  // If the clipboard only contains plain text, attempt to parse it as Markdown
365
379
  if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
366
380
  if ((0, _analytics2.handlePastePreservingMarksWithAnalytics)(view, event, markdownSlice, _analytics.PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
@@ -404,20 +418,6 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
404
418
  return true;
405
419
  }
406
420
 
407
- // get editor-tables to handle pasting tables if it can
408
- // otherwise, just the replace the selection with the content
409
- if ((0, _utils3.handlePaste)(view, null, slice)) {
410
- (0, _analytics2.sendPasteAnalyticsEvent)(editorAnalyticsAPI)(view, event, slice, {
411
- type: _analytics.PasteTypes.richText
412
- });
413
- return true;
414
- }
415
-
416
- // handle paste of nested tables to ensure nesting limits are respected
417
- if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
418
- return true;
419
- }
420
-
421
421
  // handle the case when copy content from a table cell inside bodied extension
422
422
  if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
423
423
  return true;
@@ -314,9 +314,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
314
314
  // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
315
315
  slice.openStart = 1;
316
316
  }
317
- if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
318
- return true;
319
- }
320
317
 
321
318
  // If we're in a code block, append the text contents of clipboard inside it
322
319
  if (handleCodeBlockWithAnalytics(editorAnalyticsAPI)(view, event, slice, text)(state, dispatch)) {
@@ -335,6 +332,23 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
335
332
  isNestedMarkdownTable = !!(markdownSlice && isPlainText && isParentNodeTdOrTh && getContentNodeTypes(markdownSlice.content).includes((_schema$nodes$table = schema.nodes.table) === null || _schema$nodes$table === void 0 ? void 0 : _schema$nodes$table.name));
336
333
  slice = isNestedMarkdownTable ? markdownSlice : slice;
337
334
 
335
+ // get editor-tables to handle pasting tables if it can
336
+ // otherwise, just the replace the selection with the content
337
+ if (handlePasteTable(view, null, slice)) {
338
+ sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
339
+ type: PasteTypes.richText
340
+ });
341
+ return true;
342
+ }
343
+
344
+ // handle paste of nested tables to ensure nesting limits are respected
345
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
346
+ return true;
347
+ }
348
+ if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
349
+ return true;
350
+ }
351
+
338
352
  // If the clipboard only contains plain text, attempt to parse it as Markdown
339
353
  if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
340
354
  if (handlePastePreservingMarksWithAnalytics(view, event, markdownSlice, PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
@@ -380,20 +394,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
380
394
  return true;
381
395
  }
382
396
 
383
- // get editor-tables to handle pasting tables if it can
384
- // otherwise, just the replace the selection with the content
385
- if (handlePasteTable(view, null, slice)) {
386
- sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
387
- type: PasteTypes.richText
388
- });
389
- return true;
390
- }
391
-
392
- // handle paste of nested tables to ensure nesting limits are respected
393
- if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
394
- return true;
395
- }
396
-
397
397
  // handle the case when copy content from a table cell inside bodied extension
398
398
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
399
399
  return true;
@@ -332,9 +332,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
332
332
  // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
333
333
  slice.openStart = 1;
334
334
  }
335
- if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
336
- return true;
337
- }
338
335
 
339
336
  // If we're in a code block, append the text contents of clipboard inside it
340
337
  if (handleCodeBlockWithAnalytics(editorAnalyticsAPI)(view, event, slice, text)(state, dispatch)) {
@@ -353,6 +350,23 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
353
350
  isNestedMarkdownTable = !!(markdownSlice && isPlainText && isParentNodeTdOrTh && getContentNodeTypes(markdownSlice.content).includes((_schema$nodes$table = schema.nodes.table) === null || _schema$nodes$table === void 0 ? void 0 : _schema$nodes$table.name));
354
351
  slice = isNestedMarkdownTable ? markdownSlice : slice;
355
352
 
353
+ // get editor-tables to handle pasting tables if it can
354
+ // otherwise, just the replace the selection with the content
355
+ if (handlePasteTable(view, null, slice)) {
356
+ sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
357
+ type: PasteTypes.richText
358
+ });
359
+ return true;
360
+ }
361
+
362
+ // handle paste of nested tables to ensure nesting limits are respected
363
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
364
+ return true;
365
+ }
366
+ if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
367
+ return true;
368
+ }
369
+
356
370
  // If the clipboard only contains plain text, attempt to parse it as Markdown
357
371
  if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
358
372
  if (handlePastePreservingMarksWithAnalytics(view, event, markdownSlice, PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
@@ -396,20 +410,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
396
410
  return true;
397
411
  }
398
412
 
399
- // get editor-tables to handle pasting tables if it can
400
- // otherwise, just the replace the selection with the content
401
- if (handlePasteTable(view, null, slice)) {
402
- sendPasteAnalyticsEvent(editorAnalyticsAPI)(view, event, slice, {
403
- type: PasteTypes.richText
404
- });
405
- return true;
406
- }
407
-
408
- // handle paste of nested tables to ensure nesting limits are respected
409
- if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
410
- return true;
411
- }
412
-
413
413
  // handle the case when copy content from a table cell inside bodied extension
414
414
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
415
415
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,9 +32,9 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^99.3.0",
35
+ "@atlaskit/editor-common": "^99.5.0",
36
36
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.11.0",
38
38
  "@atlaskit/editor-plugin-annotation": "^1.26.0",
39
39
  "@atlaskit/editor-plugin-better-type-history": "^1.9.0",
40
40
  "@atlaskit/editor-plugin-card": "^4.5.0",
@@ -44,10 +44,10 @@
44
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.1.0",
47
+ "@atlaskit/media-client": "^31.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.37.0",
50
+ "@atlaskit/tmp-editor-statsig": "^2.39.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "lodash": "^4.17.21",
53
53
  "uuid": "^3.1.0"