@atlaskit/editor-plugin-paste 1.10.1 → 1.11.1

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,26 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#130811](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130811)
8
+ [`541a703405a7d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/541a703405a7d) -
9
+ [ux] [ED-24431] Ability to paste an expand into another expand
10
+ - Updated dependencies
11
+
12
+ ## 1.11.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#133315](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/133315)
17
+ [`5c94ca338de14`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c94ca338de14) -
18
+ Updating mentions plugin config for handling deleted mentions and refactor
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 1.10.1
4
25
 
5
26
  ### Patch Changes
@@ -8,7 +8,7 @@ exports.checkTaskListInList = checkTaskListInList;
8
8
  exports.doesSelectionWhichStartsOrEndsInListContainEntireList = void 0;
9
9
  exports.flattenNestedListInSlice = flattenNestedListInSlice;
10
10
  exports.handleCodeBlock = handleCodeBlock;
11
- exports.handleExpandPasteInTable = handleExpandPasteInTable;
11
+ exports.handleExpandPaste = handleExpandPaste;
12
12
  exports.handleMacroAutoConvert = handleMacroAutoConvert;
13
13
  exports.handleMarkdown = handleMarkdown;
14
14
  exports.handleMediaSingle = handleMediaSingle;
@@ -48,6 +48,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
48
48
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
49
49
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
50
50
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // TODO: ED-20519 Needs Macro extraction
51
+ var insideExpand = function insideExpand(state) {
52
+ var _state$schema$nodes = state.schema.nodes,
53
+ expand = _state$schema$nodes.expand,
54
+ nestedExpand = _state$schema$nodes.nestedExpand;
55
+ return (0, _utils2.hasParentNodeOfType)([expand, nestedExpand])(state.selection);
56
+ };
57
+
51
58
  /** Helper type for single arg function */
52
59
 
53
60
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -219,10 +226,10 @@ function handlePasteNonNestableBlockNodesIntoList(slice) {
219
226
  $to = selection.$to,
220
227
  from = selection.from,
221
228
  to = selection.to;
222
- var _state$schema$nodes = state.schema.nodes,
223
- orderedList = _state$schema$nodes.orderedList,
224
- bulletList = _state$schema$nodes.bulletList,
225
- listItem = _state$schema$nodes.listItem;
229
+ var _state$schema$nodes2 = state.schema.nodes,
230
+ orderedList = _state$schema$nodes2.orderedList,
231
+ bulletList = _state$schema$nodes2.bulletList,
232
+ listItem = _state$schema$nodes2.listItem;
226
233
 
227
234
  // Selected nodes
228
235
  var selectionParentListItemNode = (0, _utils2.findParentNodeOfType)(listItem)(selection);
@@ -660,7 +667,7 @@ function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
660
667
  };
661
668
  };
662
669
  }
663
- var checkExpand = function checkExpand(slice) {
670
+ var hasTopLevelExpand = function hasTopLevelExpand(slice) {
664
671
  var hasExpand = false;
665
672
  slice.content.forEach(function (node) {
666
673
  if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
@@ -689,16 +696,18 @@ function handleTableContentPasteInBodiedExtension(slice) {
689
696
  return false;
690
697
  };
691
698
  }
692
- function handleExpandPasteInTable(slice) {
699
+ function handleExpandPaste(slice, isNestingExpandsSupported) {
693
700
  return function (state, dispatch) {
694
- // Do not handle expand if it's not being pasted into a table
695
- // OR if it's nested within another node when being pasted into a table
696
- if (!(0, _coreUtils.insideTable)(state) || !checkExpand(slice)) {
701
+ var isInsideNestableExpand = isNestingExpandsSupported && !!insideExpand(state);
702
+
703
+ // Do not handle expand if it's not being pasted into a table or expand
704
+ // OR if it's nested within another node when being pasted into a table/expand
705
+ if (!(0, _coreUtils.insideTable)(state) && !isInsideNestableExpand || !hasTopLevelExpand(slice)) {
697
706
  return false;
698
707
  }
699
- var _state$schema$nodes2 = state.schema.nodes,
700
- expand = _state$schema$nodes2.expand,
701
- nestedExpand = _state$schema$nodes2.nestedExpand;
708
+ var _state$schema$nodes3 = state.schema.nodes,
709
+ expand = _state$schema$nodes3.expand,
710
+ nestedExpand = _state$schema$nodes3.nestedExpand;
702
711
  var tr = state.tr;
703
712
  var hasExpand = false;
704
713
  var newSlice = (0, _utils.mapSlice)(slice, function (maybeNode) {
@@ -899,11 +908,11 @@ function flattenNestedListInSlice(slice) {
899
908
  function handleRichText(slice, queueCardsFromChangedTr) {
900
909
  return function (state, dispatch) {
901
910
  var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
902
- var _state$schema$nodes3 = state.schema.nodes,
903
- codeBlock = _state$schema$nodes3.codeBlock,
904
- heading = _state$schema$nodes3.heading,
905
- paragraph = _state$schema$nodes3.paragraph,
906
- panel = _state$schema$nodes3.panel;
911
+ var _state$schema$nodes4 = state.schema.nodes,
912
+ codeBlock = _state$schema$nodes4.codeBlock,
913
+ heading = _state$schema$nodes4.heading,
914
+ paragraph = _state$schema$nodes4.paragraph,
915
+ panel = _state$schema$nodes4.panel;
907
916
  var selection = state.selection,
908
917
  schema = state.schema;
909
918
  var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
@@ -197,6 +197,7 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
197
197
  mentionIds.push(node.attrs.id);
198
198
  mentionLocalIds.push(node.attrs.localId);
199
199
  mentionsInserted.push({
200
+ type: 'added',
200
201
  id: node.attrs.id,
201
202
  localId: node.attrs.localId
202
203
  });
@@ -337,12 +338,12 @@ var handlePasteNonNestableBlockNodesIntoListWithAnalytics = exports.handlePasteN
337
338
  }))((0, _handlers.handlePasteNonNestableBlockNodesIntoList)(slice));
338
339
  };
339
340
  };
340
- var handleExpandWithAnalytics = exports.handleExpandWithAnalytics = function handleExpandWithAnalytics(editorAnalyticsAPI) {
341
+ var handleExpandWithAnalytics = exports.handleExpandWithAnalytics = function handleExpandWithAnalytics(editorAnalyticsAPI, isNestingExpandsSupported) {
341
342
  return function (view, event, slice) {
342
343
  return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
343
344
  type: _analytics.PasteTypes.richText,
344
345
  pasteSplitList: true
345
- }))((0, _handlers.handleExpandPasteInTable)(slice));
346
+ }))((0, _handlers.handleExpandPaste)(slice, isNestingExpandsSupported));
346
347
  };
347
348
  };
348
349
  var handleSelectedTableWithAnalytics = exports.handleSelectedTableWithAnalytics = function handleSelectedTableWithAnalytics(editorAnalyticsAPI) {
@@ -27,6 +27,7 @@ var _editorMarkdownTransformer = require("@atlaskit/editor-markdown-transformer"
27
27
  var _model = require("@atlaskit/editor-prosemirror/model");
28
28
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
29
29
  var _utils3 = require("@atlaskit/editor-tables/utils");
30
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
31
  var _actions = require("../actions");
31
32
  var _commands = require("../commands");
32
33
  var _handlers = require("../handlers");
@@ -368,7 +369,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
368
369
 
369
370
  // finally, handle rich-text copy-paste
370
371
  if (isRichText || isNestedMarkdownTable) {
371
- var _pluginInjectionApi$c2, _pluginInjectionApi$e2, _pluginInjectionApi$l;
372
+ var _pluginInjectionApi$c2, _pluginInjectionApi$e2, _pluginInjectionApi$f, _pluginInjectionApi$l;
372
373
  // linkify the text where possible
373
374
  slice = (0, _utils.linkifyContent)(state.schema)(slice);
374
375
  if ((0, _analytics2.handlePasteLinkOnSelectedTextWithAnalytics)(editorAnalyticsAPI)(view, event, slice, _analytics.PasteTypes.richText)(state, dispatch)) {
@@ -425,7 +426,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
425
426
  });
426
427
  slice = sliceCopy;
427
428
  }
428
- if ((0, _analytics2.handleExpandWithAnalytics)(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
429
+ var isNestingExpandsSupported = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 || (_pluginInjectionApi$f = _pluginInjectionApi$f.sharedState.currentState()) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.nestedExpandInExpandEx) || (0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_in_expand_jira');
430
+ if ((0, _analytics2.handleExpandWithAnalytics)(editorAnalyticsAPI, isNestingExpandsSupported)(view, event, slice)(state, dispatch)) {
429
431
  return true;
430
432
  }
431
433
  if (!(0, _coreUtils.insideTable)(state)) {
@@ -16,6 +16,13 @@ import { insertSliceForLists, insertSliceForListsInsideBlockquote, insertSliceFo
16
16
  import { insertSliceInsideOfPanelNodeSelected } from './edge-cases/lists';
17
17
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
18
18
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './util';
19
+ const insideExpand = state => {
20
+ const {
21
+ expand,
22
+ nestedExpand
23
+ } = state.schema.nodes;
24
+ return hasParentNodeOfType([expand, nestedExpand])(state.selection);
25
+ };
19
26
 
20
27
  /** Helper type for single arg function */
21
28
 
@@ -642,7 +649,7 @@ export function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
642
649
  };
643
650
  };
644
651
  }
645
- const checkExpand = slice => {
652
+ const hasTopLevelExpand = slice => {
646
653
  let hasExpand = false;
647
654
  slice.content.forEach(node => {
648
655
  if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
@@ -673,11 +680,13 @@ export function handleTableContentPasteInBodiedExtension(slice) {
673
680
  return false;
674
681
  };
675
682
  }
676
- export function handleExpandPasteInTable(slice) {
683
+ export function handleExpandPaste(slice, isNestingExpandsSupported) {
677
684
  return (state, dispatch) => {
678
- // Do not handle expand if it's not being pasted into a table
679
- // OR if it's nested within another node when being pasted into a table
680
- if (!insideTable(state) || !checkExpand(slice)) {
685
+ const isInsideNestableExpand = isNestingExpandsSupported && !!insideExpand(state);
686
+
687
+ // Do not handle expand if it's not being pasted into a table or expand
688
+ // OR if it's nested within another node when being pasted into a table/expand
689
+ if (!insideTable(state) && !isInsideNestableExpand || !hasTopLevelExpand(slice)) {
681
690
  return false;
682
691
  }
683
692
  const {
@@ -1,7 +1,7 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
2
2
  import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
3
3
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
4
- import { handleCodeBlock, handleExpandPasteInTable, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable } from '../handlers';
4
+ import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable } from '../handlers';
5
5
  import { getPasteSource } from '../util';
6
6
  const contentToPasteContent = {
7
7
  url: PasteContents.url,
@@ -192,6 +192,7 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
192
192
  mentionIds.push(node.attrs.id);
193
193
  mentionLocalIds.push(node.attrs.localId);
194
194
  mentionsInserted.push({
195
+ type: 'added',
195
196
  id: node.attrs.id,
196
197
  localId: node.attrs.localId
197
198
  });
@@ -304,10 +305,10 @@ export const handlePasteNonNestableBlockNodesIntoListWithAnalytics = editorAnaly
304
305
  type: PasteTypes.richText,
305
306
  pasteSplitList: true
306
307
  }))(handlePasteNonNestableBlockNodesIntoList(slice));
307
- export const handleExpandWithAnalytics = editorAnalyticsAPI => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
308
+ export const handleExpandWithAnalytics = (editorAnalyticsAPI, isNestingExpandsSupported) => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
308
309
  type: PasteTypes.richText,
309
310
  pasteSplitList: true
310
- }))(handleExpandPasteInTable(slice));
311
+ }))(handleExpandPaste(slice, isNestingExpandsSupported));
311
312
  export const handleSelectedTableWithAnalytics = editorAnalyticsAPI => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
312
313
  type: PasteTypes.richText
313
314
  }))(handleSelectedTable(editorAnalyticsAPI)(slice));
@@ -11,6 +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 { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { PastePluginActionTypes } from '../actions';
15
16
  import { splitParagraphs, upgradeTextToLists } from '../commands';
16
17
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
@@ -339,7 +340,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
339
340
 
340
341
  // finally, handle rich-text copy-paste
341
342
  if (isRichText || isNestedMarkdownTable) {
342
- var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$e3, _pluginInjectionApi$e4, _pluginInjectionApi$l;
343
+ var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$e3, _pluginInjectionApi$e4, _pluginInjectionApi$f, _pluginInjectionApi$f2, _pluginInjectionApi$l;
343
344
  // linkify the text where possible
344
345
  slice = linkifyContent(state.schema)(slice);
345
346
  if (handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
@@ -394,7 +395,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
394
395
  });
395
396
  slice = sliceCopy;
396
397
  }
397
- if (handleExpandWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
398
+ const isNestingExpandsSupported = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 ? void 0 : (_pluginInjectionApi$f2 = _pluginInjectionApi$f.sharedState.currentState()) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.nestedExpandInExpandEx) || fg('platform_editor_nest_nested_expand_in_expand_jira');
399
+ if (handleExpandWithAnalytics(editorAnalyticsAPI, isNestingExpandsSupported)(view, event, slice)(state, dispatch)) {
398
400
  return true;
399
401
  }
400
402
  if (!insideTable(state)) {
@@ -24,6 +24,12 @@ import { insertSliceForLists, insertSliceForListsInsideBlockquote, insertSliceFo
24
24
  import { insertSliceInsideOfPanelNodeSelected } from './edge-cases/lists';
25
25
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
26
26
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './util';
27
+ var insideExpand = function insideExpand(state) {
28
+ var _state$schema$nodes = state.schema.nodes,
29
+ expand = _state$schema$nodes.expand,
30
+ nestedExpand = _state$schema$nodes.nestedExpand;
31
+ return hasParentNodeOfType([expand, nestedExpand])(state.selection);
32
+ };
27
33
 
28
34
  /** Helper type for single arg function */
29
35
 
@@ -196,10 +202,10 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
196
202
  $to = selection.$to,
197
203
  from = selection.from,
198
204
  to = selection.to;
199
- var _state$schema$nodes = state.schema.nodes,
200
- orderedList = _state$schema$nodes.orderedList,
201
- bulletList = _state$schema$nodes.bulletList,
202
- listItem = _state$schema$nodes.listItem;
205
+ var _state$schema$nodes2 = state.schema.nodes,
206
+ orderedList = _state$schema$nodes2.orderedList,
207
+ bulletList = _state$schema$nodes2.bulletList,
208
+ listItem = _state$schema$nodes2.listItem;
203
209
 
204
210
  // Selected nodes
205
211
  var selectionParentListItemNode = findParentNodeOfType(listItem)(selection);
@@ -637,7 +643,7 @@ export function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
637
643
  };
638
644
  };
639
645
  }
640
- var checkExpand = function checkExpand(slice) {
646
+ var hasTopLevelExpand = function hasTopLevelExpand(slice) {
641
647
  var hasExpand = false;
642
648
  slice.content.forEach(function (node) {
643
649
  if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
@@ -666,16 +672,18 @@ export function handleTableContentPasteInBodiedExtension(slice) {
666
672
  return false;
667
673
  };
668
674
  }
669
- export function handleExpandPasteInTable(slice) {
675
+ export function handleExpandPaste(slice, isNestingExpandsSupported) {
670
676
  return function (state, dispatch) {
671
- // Do not handle expand if it's not being pasted into a table
672
- // OR if it's nested within another node when being pasted into a table
673
- if (!insideTable(state) || !checkExpand(slice)) {
677
+ var isInsideNestableExpand = isNestingExpandsSupported && !!insideExpand(state);
678
+
679
+ // Do not handle expand if it's not being pasted into a table or expand
680
+ // OR if it's nested within another node when being pasted into a table/expand
681
+ if (!insideTable(state) && !isInsideNestableExpand || !hasTopLevelExpand(slice)) {
674
682
  return false;
675
683
  }
676
- var _state$schema$nodes2 = state.schema.nodes,
677
- expand = _state$schema$nodes2.expand,
678
- nestedExpand = _state$schema$nodes2.nestedExpand;
684
+ var _state$schema$nodes3 = state.schema.nodes,
685
+ expand = _state$schema$nodes3.expand,
686
+ nestedExpand = _state$schema$nodes3.nestedExpand;
679
687
  var tr = state.tr;
680
688
  var hasExpand = false;
681
689
  var newSlice = mapSlice(slice, function (maybeNode) {
@@ -876,11 +884,11 @@ export function flattenNestedListInSlice(slice) {
876
884
  export function handleRichText(slice, queueCardsFromChangedTr) {
877
885
  return function (state, dispatch) {
878
886
  var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
879
- var _state$schema$nodes3 = state.schema.nodes,
880
- codeBlock = _state$schema$nodes3.codeBlock,
881
- heading = _state$schema$nodes3.heading,
882
- paragraph = _state$schema$nodes3.paragraph,
883
- panel = _state$schema$nodes3.panel;
887
+ var _state$schema$nodes4 = state.schema.nodes,
888
+ codeBlock = _state$schema$nodes4.codeBlock,
889
+ heading = _state$schema$nodes4.heading,
890
+ paragraph = _state$schema$nodes4.paragraph,
891
+ panel = _state$schema$nodes4.panel;
884
892
  var selection = state.selection,
885
893
  schema = state.schema;
886
894
  var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
@@ -5,7 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
6
6
  import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
7
7
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
8
- import { handleCodeBlock, handleExpandPasteInTable, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable } from '../handlers';
8
+ import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable } from '../handlers';
9
9
  import { getPasteSource } from '../util';
10
10
  var contentToPasteContent = {
11
11
  url: PasteContents.url,
@@ -185,6 +185,7 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
185
185
  mentionIds.push(node.attrs.id);
186
186
  mentionLocalIds.push(node.attrs.localId);
187
187
  mentionsInserted.push({
188
+ type: 'added',
188
189
  id: node.attrs.id,
189
190
  localId: node.attrs.localId
190
191
  });
@@ -325,12 +326,12 @@ export var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function hand
325
326
  }))(handlePasteNonNestableBlockNodesIntoList(slice));
326
327
  };
327
328
  };
328
- export var handleExpandWithAnalytics = function handleExpandWithAnalytics(editorAnalyticsAPI) {
329
+ export var handleExpandWithAnalytics = function handleExpandWithAnalytics(editorAnalyticsAPI, isNestingExpandsSupported) {
329
330
  return function (view, event, slice) {
330
331
  return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
331
332
  type: PasteTypes.richText,
332
333
  pasteSplitList: true
333
- }))(handleExpandPasteInTable(slice));
334
+ }))(handleExpandPaste(slice, isNestingExpandsSupported));
334
335
  };
335
336
  };
336
337
  export var handleSelectedTableWithAnalytics = function handleSelectedTableWithAnalytics(editorAnalyticsAPI) {
@@ -13,6 +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 { fg } from '@atlaskit/platform-feature-flags';
16
17
  import { PastePluginActionTypes } from '../actions';
17
18
  import { splitParagraphs, upgradeTextToLists } from '../commands';
18
19
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
@@ -355,7 +356,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
355
356
 
356
357
  // finally, handle rich-text copy-paste
357
358
  if (isRichText || isNestedMarkdownTable) {
358
- var _pluginInjectionApi$c2, _pluginInjectionApi$e2, _pluginInjectionApi$l;
359
+ var _pluginInjectionApi$c2, _pluginInjectionApi$e2, _pluginInjectionApi$f, _pluginInjectionApi$l;
359
360
  // linkify the text where possible
360
361
  slice = linkifyContent(state.schema)(slice);
361
362
  if (handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI)(view, event, slice, PasteTypes.richText)(state, dispatch)) {
@@ -412,7 +413,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
412
413
  });
413
414
  slice = sliceCopy;
414
415
  }
415
- if (handleExpandWithAnalytics(editorAnalyticsAPI)(view, event, slice)(state, dispatch)) {
416
+ var isNestingExpandsSupported = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 || (_pluginInjectionApi$f = _pluginInjectionApi$f.sharedState.currentState()) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.nestedExpandInExpandEx) || fg('platform_editor_nest_nested_expand_in_expand_jira');
417
+ if (handleExpandWithAnalytics(editorAnalyticsAPI, isNestingExpandsSupported)(view, event, slice)(state, dispatch)) {
416
418
  return true;
417
419
  }
418
420
  if (!insideTable(state)) {
@@ -20,7 +20,7 @@ export declare function handleMacroAutoConvert(text: string, slice: Slice, queue
20
20
  export declare function handleCodeBlock(text: string): Command;
21
21
  export declare function handleMediaSingle(inputMethod: InputMethodInsertMedia, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined): (slice: Slice) => Command;
22
22
  export declare function handleTableContentPasteInBodiedExtension(slice: Slice): Command;
23
- export declare function handleExpandPasteInTable(slice: Slice): Command;
23
+ export declare function handleExpandPaste(slice: Slice, isNestingExpandsSupported?: boolean): Command;
24
24
  export declare function handleMarkdown(markdownSlice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, from?: number, to?: number): Command;
25
25
  export declare function handleParagraphBlockMarks(state: EditorState, slice: Slice): Slice;
26
26
  /**
@@ -31,7 +31,7 @@ export declare const handleMarkdownWithAnalytics: (view: EditorView, event: Clip
31
31
  export declare const handleRichTextWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined) => Command;
32
32
  export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command;
33
33
  export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
34
- export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
34
+ export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
35
35
  export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
36
36
  export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
37
37
  export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
@@ -20,7 +20,7 @@ export declare function handleMacroAutoConvert(text: string, slice: Slice, queue
20
20
  export declare function handleCodeBlock(text: string): Command;
21
21
  export declare function handleMediaSingle(inputMethod: InputMethodInsertMedia, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined): (slice: Slice) => Command;
22
22
  export declare function handleTableContentPasteInBodiedExtension(slice: Slice): Command;
23
- export declare function handleExpandPasteInTable(slice: Slice): Command;
23
+ export declare function handleExpandPaste(slice: Slice, isNestingExpandsSupported?: boolean): Command;
24
24
  export declare function handleMarkdown(markdownSlice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, from?: number, to?: number): Command;
25
25
  export declare function handleParagraphBlockMarks(state: EditorState, slice: Slice): Slice;
26
26
  /**
@@ -31,7 +31,7 @@ export declare const handleMarkdownWithAnalytics: (view: EditorView, event: Clip
31
31
  export declare const handleRichTextWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined) => Command;
32
32
  export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command;
33
33
  export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
34
- export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
34
+ export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
35
35
  export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
36
36
  export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
37
37
  export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.10.1",
3
+ "version": "1.11.1",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^88.0.0",
36
+ "@atlaskit/editor-common": "^88.2.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.11.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^1.19.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
43
43
  "@atlaskit/editor-plugin-list": "^3.8.0",
44
44
  "@atlaskit/editor-plugin-media": "^1.29.0",
45
- "@atlaskit/editor-plugin-mentions": "^2.4.0",
45
+ "@atlaskit/editor-plugin-mentions": "^2.5.0",
46
46
  "@atlaskit/editor-prosemirror": "5.0.1",
47
47
  "@atlaskit/editor-tables": "^2.8.0",
48
48
  "@atlaskit/media-client": "^27.5.0",
@@ -58,7 +58,7 @@
58
58
  "devDependencies": {
59
59
  "@af/visual-regression": "*",
60
60
  "@atlaskit/adf-schema": "^40.8.1",
61
- "@atlaskit/editor-plugin-block-type": "^3.13.0",
61
+ "@atlaskit/editor-plugin-block-type": "^3.14.0",
62
62
  "@atlaskit/editor-plugin-history": "^1.3.0",
63
63
  "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
64
64
  "@atlaskit/ssr": "*",
@@ -118,6 +118,9 @@
118
118
  },
119
119
  "editor_inline_comments_paste_insert_nodes": {
120
120
  "type": "boolean"
121
+ },
122
+ "platform_editor_nest_nested_expand_in_expand_jira": {
123
+ "type": "boolean"
121
124
  }
122
125
  }
123
126
  }