@atlaskit/editor-plugin-paste 1.0.12 → 1.0.13

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,12 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#86222](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86222) [`0e1dc019f1cd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e1dc019f1cd) - Fix a table content paste issue when copy content from a table cell inside bodied extension
8
+ - [#86724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86724) [`718a9aa2424d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/718a9aa2424d) - [ED-22607] Remove references to maxFrames for multi bodied extensions and bump adf-schema from 35.7.0 to 35.8.0
9
+
3
10
  ## 1.0.12
4
11
 
5
12
  ### Patch Changes
@@ -23,6 +23,7 @@ exports.handlePastePanelOrDecisionContentIntoList = handlePastePanelOrDecisionCo
23
23
  exports.handlePastePreservingMarks = handlePastePreservingMarks;
24
24
  exports.handleRichText = handleRichText;
25
25
  exports.handleSelectedTable = void 0;
26
+ exports.handleTableContentPasteInBodiedExtension = handleTableContentPasteInBodiedExtension;
26
27
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
27
28
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
28
29
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -665,6 +666,26 @@ var checkExpand = function checkExpand(slice) {
665
666
  });
666
667
  return hasExpand;
667
668
  };
669
+ function handleTableContentPasteInBodiedExtension(slice) {
670
+ return function (state, dispatch) {
671
+ var isInsideBodyExtension = (0, _utils2.hasParentNodeOfType)(state.schema.nodes.bodiedExtension)(state.selection);
672
+ if (!(0, _coreUtils.insideTable)(state) || !isInsideBodyExtension) {
673
+ return false;
674
+ }
675
+ var bodiedExtension = state.schema.nodes.bodiedExtension;
676
+ var newSlice = (0, _utils.mapSlice)(slice, function (maybeNode) {
677
+ if (maybeNode.type === bodiedExtension) {
678
+ return bodiedExtension.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
679
+ }
680
+ return maybeNode;
681
+ });
682
+ if (dispatch) {
683
+ dispatch(state.tr.replaceSelection(newSlice));
684
+ return true;
685
+ }
686
+ return false;
687
+ };
688
+ }
668
689
  function handleExpandPasteInTable(slice) {
669
690
  return function (state, dispatch) {
670
691
  // Do not handle expand if it's not being pasted into a table
@@ -388,6 +388,12 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
388
388
  return true;
389
389
  }
390
390
 
391
+ // handle the case when copy content from a table cell inside bodied extension
392
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.copy-paste-in-bodied-extension')) {
393
+ if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
394
+ return true;
395
+ }
396
+ }
391
397
  // remove annotation marks from the pasted data if they are not present in the document
392
398
  // for the cases when they are pasted from external pages
393
399
  if (slice.content.size && (0, _utils.containsAnyAnnotations)(slice, state)) {
@@ -648,6 +648,28 @@ const checkExpand = slice => {
648
648
  });
649
649
  return hasExpand;
650
650
  };
651
+ export function handleTableContentPasteInBodiedExtension(slice) {
652
+ return (state, dispatch) => {
653
+ const isInsideBodyExtension = hasParentNodeOfType(state.schema.nodes.bodiedExtension)(state.selection);
654
+ if (!insideTable(state) || !isInsideBodyExtension) {
655
+ return false;
656
+ }
657
+ const {
658
+ bodiedExtension
659
+ } = state.schema.nodes;
660
+ const newSlice = mapSlice(slice, maybeNode => {
661
+ if (maybeNode.type === bodiedExtension) {
662
+ return bodiedExtension.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
663
+ }
664
+ return maybeNode;
665
+ });
666
+ if (dispatch) {
667
+ dispatch(state.tr.replaceSelection(newSlice));
668
+ return true;
669
+ }
670
+ return false;
671
+ };
672
+ }
651
673
  export function handleExpandPasteInTable(slice) {
652
674
  return (state, dispatch) => {
653
675
  // Do not handle expand if it's not being pasted into a table
@@ -14,7 +14,7 @@ import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
14
14
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
15
  import { PastePluginActionTypes } from '../actions';
16
16
  import { splitParagraphs, upgradeTextToLists } from '../commands';
17
- import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
17
+ import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
18
18
  import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
19
19
  import { escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
20
20
  import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from '../util/tinyMCE';
@@ -359,6 +359,12 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
359
359
  return true;
360
360
  }
361
361
 
362
+ // handle the case when copy content from a table cell inside bodied extension
363
+ if (getBooleanFF('platform.editor.table.copy-paste-in-bodied-extension')) {
364
+ if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
365
+ return true;
366
+ }
367
+ }
362
368
  // remove annotation marks from the pasted data if they are not present in the document
363
369
  // for the cases when they are pasted from external pages
364
370
  if (slice.content.size && containsAnyAnnotations(slice, state)) {
@@ -643,6 +643,26 @@ var checkExpand = function checkExpand(slice) {
643
643
  });
644
644
  return hasExpand;
645
645
  };
646
+ export function handleTableContentPasteInBodiedExtension(slice) {
647
+ return function (state, dispatch) {
648
+ var isInsideBodyExtension = hasParentNodeOfType(state.schema.nodes.bodiedExtension)(state.selection);
649
+ if (!insideTable(state) || !isInsideBodyExtension) {
650
+ return false;
651
+ }
652
+ var bodiedExtension = state.schema.nodes.bodiedExtension;
653
+ var newSlice = mapSlice(slice, function (maybeNode) {
654
+ if (maybeNode.type === bodiedExtension) {
655
+ return bodiedExtension.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
656
+ }
657
+ return maybeNode;
658
+ });
659
+ if (dispatch) {
660
+ dispatch(state.tr.replaceSelection(newSlice));
661
+ return true;
662
+ }
663
+ return false;
664
+ };
665
+ }
646
666
  export function handleExpandPasteInTable(slice) {
647
667
  return function (state, dispatch) {
648
668
  // Do not handle expand if it's not being pasted into a table
@@ -16,7 +16,7 @@ import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
16
16
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
17
  import { PastePluginActionTypes } from '../actions';
18
18
  import { splitParagraphs, upgradeTextToLists } from '../commands';
19
- import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
19
+ import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
20
20
  import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
21
21
  import { escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
22
22
  import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from '../util/tinyMCE';
@@ -375,6 +375,12 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
375
375
  return true;
376
376
  }
377
377
 
378
+ // handle the case when copy content from a table cell inside bodied extension
379
+ if (getBooleanFF('platform.editor.table.copy-paste-in-bodied-extension')) {
380
+ if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
381
+ return true;
382
+ }
383
+ }
378
384
  // remove annotation marks from the pasted data if they are not present in the document
379
385
  // for the cases when they are pasted from external pages
380
386
  if (slice.content.size && containsAnyAnnotations(slice, state)) {
@@ -19,6 +19,7 @@ export declare function handlePastePreservingMarks(slice: Slice, queueCardsFromC
19
19
  export declare function handleMacroAutoConvert(text: string, slice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, runMacroAutoConvert: RunMacroAutoConvert | undefined, cardsOptions?: CardOptions, extensionAutoConverter?: ExtensionAutoConvertHandler): Command;
20
20
  export declare function handleCodeBlock(text: string): Command;
21
21
  export declare function handleMediaSingle(inputMethod: InputMethodInsertMedia, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined): (slice: Slice) => Command;
22
+ export declare function handleTableContentPasteInBodiedExtension(slice: Slice): Command;
22
23
  export declare function handleExpandPasteInTable(slice: Slice): Command;
23
24
  export declare function handleMarkdown(markdownSlice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, from?: number, to?: number): Command;
24
25
  export declare function handleParagraphBlockMarks(state: EditorState, slice: Slice): Slice;
@@ -19,6 +19,7 @@ export declare function handlePastePreservingMarks(slice: Slice, queueCardsFromC
19
19
  export declare function handleMacroAutoConvert(text: string, slice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, runMacroAutoConvert: RunMacroAutoConvert | undefined, cardsOptions?: CardOptions, extensionAutoConverter?: ExtensionAutoConvertHandler): Command;
20
20
  export declare function handleCodeBlock(text: string): Command;
21
21
  export declare function handleMediaSingle(inputMethod: InputMethodInsertMedia, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined): (slice: Slice) => Command;
22
+ export declare function handleTableContentPasteInBodiedExtension(slice: Slice): Command;
22
23
  export declare function handleExpandPasteInTable(slice: Slice): Command;
23
24
  export declare function handleMarkdown(markdownSlice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, from?: number, to?: number): Command;
24
25
  export declare function handleParagraphBlockMarks(state: EditorState, slice: Slice): Slice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,17 +33,17 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^78.18.0",
36
+ "@atlaskit/editor-common": "^78.22.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.2.0",
41
+ "@atlaskit/editor-plugin-card": "^1.4.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.12.0",
44
+ "@atlaskit/editor-plugin-media": "^1.13.0",
45
45
  "@atlaskit/editor-prosemirror": "3.0.0",
46
- "@atlaskit/editor-tables": "^2.5.0",
46
+ "@atlaskit/editor-tables": "^2.6.0",
47
47
  "@atlaskit/media-client": "^26.2.0",
48
48
  "@atlaskit/media-common": "^11.1.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@af/visual-regression": "*",
59
- "@atlaskit/adf-schema": "^35.7.0",
59
+ "@atlaskit/adf-schema": "^35.8.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",
@@ -132,6 +132,9 @@
132
132
  },
133
133
  "platform.editor.multi-bodied-extension_0rygg": {
134
134
  "type": "boolean"
135
+ },
136
+ "platform.editor.table.copy-paste-in-bodied-extension": {
137
+ "type": "boolean"
135
138
  }
136
139
  }
137
140
  }