@atlaskit/editor-plugin-paste 2.0.12 → 2.0.14

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,22 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 2.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [#102083](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102083)
8
+ [`7dfb89f8b8a19`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7dfb89f8b8a19) -
9
+ [ux] ED-26221 Changed order of paste handlers so that nested tables are handled before panels and
10
+ decisions. This prevents incorrect handling of nested tables when pasting a table into a panel
11
+ inside a table
12
+ - Updated dependencies
13
+
14
+ ## 2.0.13
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 2.0.12
4
21
 
5
22
  ### Patch Changes
@@ -328,6 +328,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
328
328
  // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
329
329
  slice.openStart = 1;
330
330
  }
331
+
332
+ // handle paste of nested tables to ensure nesting limits are respected
333
+ if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
334
+ return true;
335
+ }
331
336
  if ((0, _analytics2.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics.PasteTypes.plain : _analytics.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
332
337
  return true;
333
338
  }
@@ -401,11 +406,6 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
401
406
  return true;
402
407
  }
403
408
 
404
- // handle paste of nested tables to ensure nesting limits are respected
405
- if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
406
- return true;
407
- }
408
-
409
409
  // handle the case when copy content from a table cell inside bodied extension
410
410
  if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
411
411
  return true;
@@ -126,6 +126,8 @@ var fillIncompleteRowWithEmptyCells = function fillIncompleteRowWithEmptyCells(d
126
126
  * headers exist.
127
127
  */
128
128
  var tryReconstructTableRows = exports.tryReconstructTableRows = function tryReconstructTableRows(doc) {
129
+ // Ignored via go/ees005
130
+ // eslint-disable-next-line prefer-const
129
131
  var _getTableElementsInfo = getTableElementsInfo(doc),
130
132
  cellCount = _getTableElementsInfo.cellCount,
131
133
  thCount = _getTableElementsInfo.thCount,
@@ -37,7 +37,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
37
37
  const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
38
38
  const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
39
39
  function getMarkdownSlice(text, openStart, openEnd) {
40
- let textInput = escapeBackslashExceptCodeblock(text);
40
+ const textInput = escapeBackslashExceptCodeblock(text);
41
41
  const doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
42
42
  if (doc && doc.content) {
43
43
  return new Slice(doc.content, openStart, openEnd);
@@ -302,6 +302,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
302
302
  // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
303
303
  slice.openStart = 1;
304
304
  }
305
+
306
+ // handle paste of nested tables to ensure nesting limits are respected
307
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
308
+ return true;
309
+ }
305
310
  if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
306
311
  return true;
307
312
  }
@@ -377,11 +382,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
377
382
  return true;
378
383
  }
379
384
 
380
- // handle paste of nested tables to ensure nesting limits are respected
381
- if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
382
- return true;
383
- }
384
-
385
385
  // handle the case when copy content from a table cell inside bodied extension
386
386
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
387
387
  return true;
@@ -141,7 +141,7 @@ function canContainImage(element) {
141
141
  */
142
142
  export const unwrapNestedMediaElements = html => {
143
143
  const parser = new DOMParser();
144
- let doc = parser.parseFromString(html, 'text/html');
144
+ const doc = parser.parseFromString(html, 'text/html');
145
145
  const wrapper = doc.body;
146
146
 
147
147
  // Remove Google Doc's wrapper <b> el
@@ -887,8 +887,8 @@ export function handleParagraphBlockMarks(state, slice) {
887
887
  // element around the paragraph node
888
888
  const grandparent = $from.node(Math.max(0, $from.depth - 1));
889
889
  const markTypesInSlice = getTopLevelMarkTypesInSlice(slice);
890
- let forbiddenMarkTypes = [];
891
- for (let markType of markTypesInSlice) {
890
+ const forbiddenMarkTypes = [];
891
+ for (const markType of markTypesInSlice) {
892
892
  if (!grandparent.type.allowsMarkType(markType)) {
893
893
  forbiddenMarkTypes.push(markType);
894
894
  }
@@ -993,7 +993,7 @@ export function handleRichText(slice, queueCardsFromChangedTr, isNestingMediaOrC
993
993
  const textNodes = [heading, paragraph];
994
994
  const selectionParent = selection.$to.node(selection.$to.depth - 1);
995
995
  const noNeedForSafeInsert = selection.$to.node().type.validContent(slice.content) || textNodes.includes(selection.$to.node().type) && selectionParent.type.validContent(slice.content);
996
- let panelParentOverCurrentSelection = findParentNodeOfType(panel)(tr.selection);
996
+ const panelParentOverCurrentSelection = findParentNodeOfType(panel)(tr.selection);
997
997
  const isTargetPanelEmpty = panelParentOverCurrentSelection && ((_panelParentOverCurre = panelParentOverCurrentSelection.node) === null || _panelParentOverCurre === void 0 ? void 0 : _panelParentOverCurre.content.size) === 2;
998
998
  let sliceContainsCodeblockOrMedia = false;
999
999
  const codeBlockAndMediaNodes = ['codeBlock', 'mediaSingle', 'mediaGroup'];
@@ -108,6 +108,8 @@ const fillIncompleteRowWithEmptyCells = (doc, thCount, cellCount) => {
108
108
  * headers exist.
109
109
  */
110
110
  export const tryReconstructTableRows = doc => {
111
+ // Ignored via go/ees005
112
+ // eslint-disable-next-line prefer-const
111
113
  let {
112
114
  cellCount,
113
115
  thCount,
@@ -320,6 +320,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
320
320
  // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
321
321
  slice.openStart = 1;
322
322
  }
323
+
324
+ // handle paste of nested tables to ensure nesting limits are respected
325
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
326
+ return true;
327
+ }
323
328
  if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
324
329
  return true;
325
330
  }
@@ -393,11 +398,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
393
398
  return true;
394
399
  }
395
400
 
396
- // handle paste of nested tables to ensure nesting limits are respected
397
- if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
398
- return true;
399
- }
400
-
401
401
  // handle the case when copy content from a table cell inside bodied extension
402
402
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
403
403
  return true;
@@ -119,6 +119,8 @@ var fillIncompleteRowWithEmptyCells = function fillIncompleteRowWithEmptyCells(d
119
119
  * headers exist.
120
120
  */
121
121
  export var tryReconstructTableRows = function tryReconstructTableRows(doc) {
122
+ // Ignored via go/ees005
123
+ // eslint-disable-next-line prefer-const
122
124
  var _getTableElementsInfo = getTableElementsInfo(doc),
123
125
  cellCount = _getTableElementsInfo.cellCount,
124
126
  thCount = _getTableElementsInfo.thCount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^97.2.0",
34
+ "@atlaskit/editor-common": "^99.0.0",
35
35
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-annotation": "^1.26.0",
@@ -39,14 +39,14 @@
39
39
  "@atlaskit/editor-plugin-card": "^4.5.0",
40
40
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
41
41
  "@atlaskit/editor-plugin-list": "^3.9.0",
42
- "@atlaskit/editor-plugin-media": "^1.43.0",
43
- "@atlaskit/editor-plugin-mentions": "^2.10.0",
42
+ "@atlaskit/editor-plugin-media": "^1.44.0",
43
+ "@atlaskit/editor-plugin-mentions": "^2.11.0",
44
44
  "@atlaskit/editor-prosemirror": "6.2.1",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
46
  "@atlaskit/media-client": "^29.0.0",
47
47
  "@atlaskit/media-common": "^11.7.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^2.29.0",
49
+ "@atlaskit/tmp-editor-statsig": "^2.33.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "lodash": "^4.17.21",
52
52
  "uuid": "^3.1.0"
@@ -58,7 +58,7 @@
58
58
  "devDependencies": {
59
59
  "@af/visual-regression": "*",
60
60
  "@atlaskit/adf-schema": "^46.1.0",
61
- "@atlaskit/editor-plugin-block-type": "^4.0.0",
61
+ "@atlaskit/editor-plugin-block-type": "^4.1.0",
62
62
  "@atlaskit/editor-plugin-history": "^1.3.0",
63
63
  "@atlaskit/editor-plugin-type-ahead": "^1.11.0",
64
64
  "@atlaskit/ssr": "*",