@atlaskit/editor-plugin-paste 1.5.1 → 1.5.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,23 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#118497](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/118497)
8
+ [`5b4bfa8be2106`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5b4bfa8be2106) -
9
+ Cleanup FF that improves paste behaviour of markdown tables in tables.
10
+ - Updated dependencies
11
+
12
+ ## 1.5.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [#117897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117897)
17
+ [`0856aa2920fe2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0856aa2920fe2) -
18
+ Remove feature flag for bug fix: Copying table content in a multi bodied extension and then
19
+ pasting creates a new table
20
+
3
21
  ## 1.5.1
4
22
 
5
23
  ### Patch Changes
@@ -134,7 +134,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
134
134
  }
135
135
  },
136
136
  handlePaste: function handlePaste(view, rawEvent, slice) {
137
- var _text, _pluginInjectionApi$a2, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m;
137
+ var _text, _pluginInjectionApi$a2, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
138
138
  var event = rawEvent;
139
139
  if (!event.clipboardData) {
140
140
  return false;
@@ -182,7 +182,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
182
182
  * stopImmediatePropagation will run the first event attached to the same element
183
183
  * Which chould have race condition issue
184
184
  */
185
- (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
185
+ (0, _platformFeatureFlags.fg)('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
186
186
  }
187
187
  var state = view.state;
188
188
  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();
@@ -336,12 +336,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
336
336
  return true;
337
337
  }
338
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
- }
339
+
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 = schema.nodes.table) === null || _schema$nodes$table === void 0 ? void 0 : _schema$nodes$table.name));
343
+ slice = isNestedMarkdownTable ? markdownSlice : slice;
345
344
 
346
345
  // If the clipboard only contains plain text, attempt to parse it as Markdown
347
346
  if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
@@ -396,10 +395,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
396
395
  }
397
396
 
398
397
  // handle the case when copy content from a table cell inside bodied extension
399
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.copy-paste-in-bodied-extension')) {
400
- if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
401
- return true;
402
- }
398
+ if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
399
+ return true;
403
400
  }
404
401
  // remove annotation marks from the pasted data if they are not present in the document
405
402
  // for the cases when they are pasted from external pages
@@ -11,7 +11,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
11
11
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
12
12
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
13
13
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
14
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import { PastePluginActionTypes } from '../actions';
16
16
  import { splitParagraphs, upgradeTextToLists } from '../commands';
17
17
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
@@ -98,7 +98,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
98
98
  }
99
99
  },
100
100
  handlePaste(view, rawEvent, slice) {
101
- var _text, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m;
101
+ var _text, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
102
102
  const event = rawEvent;
103
103
  if (!event.clipboardData) {
104
104
  return false;
@@ -146,7 +146,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
146
146
  * stopImmediatePropagation will run the first event attached to the same element
147
147
  * Which chould have race condition issue
148
148
  */
149
- getBooleanFF('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
149
+ fg('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
150
150
  }
151
151
  const {
152
152
  state
@@ -305,12 +305,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
305
305
  return true;
306
306
  }
307
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
- }
308
+
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 = schema.nodes.table) === null || _schema$nodes$table === void 0 ? void 0 : _schema$nodes$table.name));
312
+ slice = isNestedMarkdownTable ? markdownSlice : slice;
314
313
 
315
314
  // If the clipboard only contains plain text, attempt to parse it as Markdown
316
315
  if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
@@ -367,10 +366,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
367
366
  }
368
367
 
369
368
  // handle the case when copy content from a table cell inside bodied extension
370
- if (getBooleanFF('platform.editor.table.copy-paste-in-bodied-extension')) {
371
- if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
372
- return true;
373
- }
369
+ if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
370
+ return true;
374
371
  }
375
372
  // remove annotation marks from the pasted data if they are not present in the document
376
373
  // for the cases when they are pasted from external pages
@@ -13,7 +13,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
13
13
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
14
14
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
15
15
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
16
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
17
17
  import { PastePluginActionTypes } from '../actions';
18
18
  import { splitParagraphs, upgradeTextToLists } from '../commands';
19
19
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
@@ -121,7 +121,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
121
121
  }
122
122
  },
123
123
  handlePaste: function handlePaste(view, rawEvent, slice) {
124
- var _text, _pluginInjectionApi$a2, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m;
124
+ var _text, _pluginInjectionApi$a2, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
125
125
  var event = rawEvent;
126
126
  if (!event.clipboardData) {
127
127
  return false;
@@ -169,7 +169,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
169
169
  * stopImmediatePropagation will run the first event attached to the same element
170
170
  * Which chould have race condition issue
171
171
  */
172
- getBooleanFF('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
172
+ fg('platform.editor.media.fix-copy-paste-excel_62g4s') ? event.stopPropagation() : event.stopImmediatePropagation();
173
173
  }
174
174
  var state = view.state;
175
175
  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();
@@ -323,12 +323,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
323
323
  return true;
324
324
  }
325
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
- }
326
+
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 = schema.nodes.table) === null || _schema$nodes$table === void 0 ? void 0 : _schema$nodes$table.name));
330
+ slice = isNestedMarkdownTable ? markdownSlice : slice;
332
331
 
333
332
  // If the clipboard only contains plain text, attempt to parse it as Markdown
334
333
  if (isPlainText && markdownSlice && !isNestedMarkdownTable) {
@@ -383,10 +382,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
383
382
  }
384
383
 
385
384
  // handle the case when copy content from a table cell inside bodied extension
386
- if (getBooleanFF('platform.editor.table.copy-paste-in-bodied-extension')) {
387
- if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
388
- return true;
389
- }
385
+ if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
386
+ return true;
390
387
  }
391
388
  // remove annotation marks from the pasted data if they are not present in the document
392
389
  // for the cases when they are pasted from external pages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
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": "^84.0.0",
36
+ "@atlaskit/editor-common": "^84.4.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.8.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^1.14.0",
40
40
  "@atlaskit/editor-plugin-better-type-history": "^1.4.0",
41
- "@atlaskit/editor-plugin-card": "^2.3.0",
41
+ "@atlaskit/editor-plugin-card": "^2.5.0",
42
42
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
43
43
  "@atlaskit/editor-plugin-list": "^3.5.0",
44
- "@atlaskit/editor-plugin-media": "^1.22.0",
44
+ "@atlaskit/editor-plugin-media": "^1.23.0",
45
45
  "@atlaskit/editor-prosemirror": "4.0.1",
46
46
  "@atlaskit/editor-tables": "^2.7.0",
47
47
  "@atlaskit/media-client": "^27.3.0",
@@ -128,12 +128,6 @@
128
128
  "platform.editor.multi-bodied-extension_0rygg": {
129
129
  "type": "boolean"
130
130
  },
131
- "platform.editor.table.copy-paste-in-bodied-extension": {
132
- "type": "boolean"
133
- },
134
- "platform.editor.paste-markdown-table-in-a-table": {
135
- "type": "boolean"
136
- },
137
131
  "platform.editor.extractlistfromparagraphv2": {
138
132
  "type": "boolean"
139
133
  },