@atlaskit/editor-plugin-paste 1.0.14 → 1.0.16

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,18 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#91106](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91106) [`b6ffa30186b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b6ffa30186b9) - Bump ADF-schema package to version 35.0.0
8
+ - Updated dependencies
9
+
10
+ ## 1.0.15
11
+
12
+ ### Patch Changes
13
+
14
+ - [#89978](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89978) [`6e7143622425`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6e7143622425) - fix paste markdown table into a table issue
15
+
3
16
  ## 1.0.14
4
17
 
5
18
  ### Patch Changes
@@ -335,9 +335,16 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
335
335
  if ((0, _analytics2.handleSelectedTableWithAnalytics)(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
336
336
  return true;
337
337
  }
338
+ var isNestedMarkdownTable = false;
339
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.paste-markdown-table-in-a-table')) {
340
+ // if paste a markdown table inside a table cell, we should treat it as a table slice
341
+ var isParentNodeTdOrTh = selectionParentType === schema.nodes.tableCell || selectionParentType === schema.nodes.tableHeader;
342
+ isNestedMarkdownTable = !!(markdownSlice && isPlainText && isParentNodeTdOrTh && (0, _analytics2.getContentNodeTypes)(markdownSlice.content).includes(schema.nodes.table.name));
343
+ slice = isNestedMarkdownTable ? markdownSlice : slice;
344
+ }
338
345
 
339
346
  // If the clipboard only contains plain text, attempt to parse it as Markdown
340
- if (isPlainText && markdownSlice) {
347
+ if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
341
348
  if ((0, _analytics2.handlePastePreservingMarksWithAnalytics)(view, event, markdownSlice, _analytics.PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
342
349
  return true;
343
350
  }
@@ -362,7 +369,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
362
369
  }
363
370
 
364
371
  // finally, handle rich-text copy-paste
365
- if (isRichText) {
372
+ if (isRichText || isNestedMarkdownTable) {
366
373
  var _pluginInjectionApi$c2, _pluginInjectionApi$e2, _pluginInjectionApi$l;
367
374
  // linkify the text where possible
368
375
  slice = (0, _utils.linkifyContent)(state.schema)(slice);
@@ -304,9 +304,16 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
304
304
  if (handleSelectedTableWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
305
305
  return true;
306
306
  }
307
+ let isNestedMarkdownTable = false;
308
+ if (getBooleanFF('platform.editor.paste-markdown-table-in-a-table')) {
309
+ // if paste a markdown table inside a table cell, we should treat it as a table slice
310
+ const isParentNodeTdOrTh = selectionParentType === schema.nodes.tableCell || selectionParentType === schema.nodes.tableHeader;
311
+ isNestedMarkdownTable = !!(markdownSlice && isPlainText && isParentNodeTdOrTh && getContentNodeTypes(markdownSlice.content).includes(schema.nodes.table.name));
312
+ slice = isNestedMarkdownTable ? markdownSlice : slice;
313
+ }
307
314
 
308
315
  // If the clipboard only contains plain text, attempt to parse it as Markdown
309
- if (isPlainText && markdownSlice) {
316
+ if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
310
317
  if (handlePastePreservingMarksWithAnalytics(view, event, markdownSlice, PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
311
318
  return true;
312
319
  }
@@ -333,7 +340,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
333
340
  }
334
341
 
335
342
  // finally, handle rich-text copy-paste
336
- if (isRichText) {
343
+ if (isRichText || isNestedMarkdownTable) {
337
344
  var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$e3, _pluginInjectionApi$e4, _pluginInjectionApi$l;
338
345
  // linkify the text where possible
339
346
  slice = linkifyContent(state.schema)(slice);
@@ -322,9 +322,16 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
322
322
  if (handleSelectedTableWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
323
323
  return true;
324
324
  }
325
+ var isNestedMarkdownTable = false;
326
+ if (getBooleanFF('platform.editor.paste-markdown-table-in-a-table')) {
327
+ // if paste a markdown table inside a table cell, we should treat it as a table slice
328
+ var isParentNodeTdOrTh = selectionParentType === schema.nodes.tableCell || selectionParentType === schema.nodes.tableHeader;
329
+ isNestedMarkdownTable = !!(markdownSlice && isPlainText && isParentNodeTdOrTh && getContentNodeTypes(markdownSlice.content).includes(schema.nodes.table.name));
330
+ slice = isNestedMarkdownTable ? markdownSlice : slice;
331
+ }
325
332
 
326
333
  // If the clipboard only contains plain text, attempt to parse it as Markdown
327
- if (isPlainText && markdownSlice) {
334
+ if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
328
335
  if (handlePastePreservingMarksWithAnalytics(view, event, markdownSlice, PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
329
336
  return true;
330
337
  }
@@ -349,7 +356,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
349
356
  }
350
357
 
351
358
  // finally, handle rich-text copy-paste
352
- if (isRichText) {
359
+ if (isRichText || isNestedMarkdownTable) {
353
360
  var _pluginInjectionApi$c2, _pluginInjectionApi$e2, _pluginInjectionApi$l;
354
361
  // linkify the text where possible
355
362
  slice = linkifyContent(state.schema)(slice);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,15 +33,15 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^78.25.0",
36
+ "@atlaskit/editor-common": "^78.28.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.4.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^1.5.0",
40
40
  "@atlaskit/editor-plugin-better-type-history": "^1.0.0",
41
- "@atlaskit/editor-plugin-card": "^1.5.0",
41
+ "@atlaskit/editor-plugin-card": "^1.8.0",
42
42
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
43
43
  "@atlaskit/editor-plugin-list": "^3.1.0",
44
- "@atlaskit/editor-plugin-media": "^1.14.0",
44
+ "@atlaskit/editor-plugin-media": "^1.15.0",
45
45
  "@atlaskit/editor-prosemirror": "3.0.0",
46
46
  "@atlaskit/editor-tables": "^2.6.0",
47
47
  "@atlaskit/media-client": "^26.3.0",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@af/visual-regression": "*",
59
- "@atlaskit/adf-schema": "^35.8.0",
59
+ "@atlaskit/adf-schema": "^35.9.0",
60
60
  "@atlaskit/editor-plugin-block-type": "^3.0.0",
61
61
  "@atlaskit/editor-plugin-history": "^1.0.0",
62
62
  "@atlaskit/editor-plugin-type-ahead": "^1.0.0",
@@ -136,6 +136,9 @@
136
136
  "platform.editor.table.copy-paste-in-bodied-extension": {
137
137
  "type": "boolean"
138
138
  },
139
+ "platform.editor.paste-markdown-table-in-a-table": {
140
+ "type": "boolean"
141
+ },
139
142
  "platform.editor.extractlistfromparagraphv2": {
140
143
  "type": "boolean"
141
144
  }