@atlaskit/editor-plugin-paste 1.0.3 → 1.0.5

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.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#75378](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75378) [`caf4a7eff92d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/caf4a7eff92d) - ED-22246 Fix pasting text into action/decision inside panel
8
+
9
+ ## 1.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#74662](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74662) [`03889d5b1256`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/03889d5b1256) - ED-22244 Allow copy paste of action within a panel into a panel
14
+ - Updated dependencies
15
+
3
16
  ## 1.0.3
4
17
 
5
18
  ### Patch Changes
@@ -40,6 +40,7 @@ var _utils3 = require("@atlaskit/editor-tables/utils");
40
40
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
41
41
  var _commands = require("./commands");
42
42
  var _edgeCases = require("./edge-cases");
43
+ var _lists = require("./edge-cases/lists");
43
44
  var _pluginFactory = require("./pm-plugins/plugin-factory");
44
45
  var _util = require("./util");
45
46
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -83,7 +84,7 @@ function handleMention(slice, schema) {
83
84
  }
84
85
  function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
85
86
  return function (state, dispatch) {
86
- var _slice$content$firstC, _transformedSlice$con;
87
+ var _slice$content$firstC, _slice$content$firstC2, _transformedSlice$con;
87
88
  var schema = state.schema,
88
89
  selection = state.tr.selection;
89
90
  var codeMark = schema.marks.code,
@@ -105,8 +106,9 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
105
106
  codeBlock = _schema$nodes.codeBlock;
106
107
  var selectionIsValidNode = state.selection instanceof _state.NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
107
108
  var selectionHasValidParentNode = (0, _utils2.hasParentNodeOfType)([decisionItem, taskItem, panel])(state.selection);
108
- var selectionIsPanel = (0, _utils2.hasParentNodeOfType)([panel])(state.selection);
109
109
  var selectionIsCodeBlock = (0, _utils2.hasParentNodeOfType)([codeBlock])(state.selection);
110
+ var panelNode = (0, _util.isSelectionInsidePanel)(selection);
111
+ var selectionIsPanel = Boolean(panelNode);
110
112
 
111
113
  // we avoid handling codeBlock-in-panel use case in this function
112
114
  // returning false will allow code to flow into `handleCodeBlock` function
@@ -117,20 +119,23 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
117
119
  // Some types of content should be handled by the default handler, not this function.
118
120
  // Check through slice content to see if it contains an invalid node.
119
121
  var sliceIsInvalid = false;
122
+ var sliceHasTask = false;
120
123
  slice.content.nodesBetween(0, slice.content.size, function (node) {
121
124
  if (node.type === bulletList || node.type === orderedList || node.type === expand || node.type === heading || node.type === listItem) {
122
125
  sliceIsInvalid = true;
123
126
  }
124
127
  if (selectionIsPanel && node.type === taskList) {
125
- sliceIsInvalid = true;
128
+ sliceHasTask = true;
126
129
  }
127
130
  });
128
-
129
131
  // If the selection is a panel,
130
132
  // and the slice's first node is a paragraph
131
133
  // and it is not from a depth that would indicate it being from inside from another node (e.g. text from a decision)
132
134
  // then we can rely on the default behaviour.
133
- var sliceIsAPanelReceivingLowDepthText = selectionIsPanel && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === paragraph && slice.openEnd < 2;
135
+ var selectionIsTaskOrDecision = (0, _utils2.hasParentNode)(function (node) {
136
+ return node.type === taskItem || node.type === decisionItem;
137
+ })(selection);
138
+ var sliceIsAPanelReceivingLowDepthText = selectionIsPanel && !selectionIsTaskOrDecision && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === paragraph && slice.openEnd < 2;
134
139
  if (sliceIsInvalid || sliceIsAPanelReceivingLowDepthText || !selectionIsValidNode && !selectionHasValidParentNode) {
135
140
  return false;
136
141
  }
@@ -143,6 +148,12 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
143
148
  var transformedSlice = compose.apply(null, filters)(slice);
144
149
  var isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
145
150
  var tr = (0, _history.closeHistory)(state.tr);
151
+ if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.handle-paste-for-action-in-panel') && (0, _util.isEmptyNode)(panelNode) && selection.$from.node() === selection.$to.node()) {
152
+ return Boolean((0, _lists.insertSliceInsideOfPanelNodeSelected)(panelNode)({
153
+ tr: tr,
154
+ slice: slice
155
+ }));
156
+ }
146
157
  var transformedSliceIsValidNode = (transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskItem', 'taskList', 'panel'].includes(transformedSlice.content.firstChild.type.name)) && (!(0, _utils.isInListItem)(state) || (0, _utils.isInListItem)(state) && isFirstChildTaskNode);
147
158
  // If the slice or the selection are valid nodes to handle,
148
159
  // and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
@@ -197,7 +208,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
197
208
  }
198
209
  function handlePasteNonNestableBlockNodesIntoList(slice) {
199
210
  return function (state, dispatch) {
200
- var _tr$doc$nodeAt, _slice$content$firstC2, _sliceContent$firstCh, _findParentNodeOfType;
211
+ var _tr$doc$nodeAt, _slice$content$firstC3, _sliceContent$firstCh, _findParentNodeOfType;
201
212
  var tr = state.tr;
202
213
  var selection = tr.selection;
203
214
  var $from = selection.$from,
@@ -272,7 +283,7 @@ function handlePasteNonNestableBlockNodesIntoList(slice) {
272
283
  }
273
284
 
274
285
  // handle the insertion of the slice
275
- if (((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type.name) === 'blockquote' && (0, _utils2.contains)(slice.content.firstChild, state.schema.nodes.listItem)) {
286
+ if (((_slice$content$firstC3 = slice.content.firstChild) === null || _slice$content$firstC3 === void 0 ? void 0 : _slice$content$firstC3.type.name) === 'blockquote' && (0, _utils2.contains)(slice.content.firstChild, state.schema.nodes.listItem)) {
276
287
  (0, _edgeCases.insertSliceForListsInsideBlockquote)({
277
288
  tr: tr,
278
289
  slice: slice
@@ -991,6 +1002,6 @@ var handleSelectedTable = exports.handleSelectedTable = function handleSelectedT
991
1002
  };
992
1003
  };
993
1004
  function checkTaskListInList(state, slice) {
994
- var _slice$content$firstC3;
995
- return Boolean((0, _utils.isInListItem)(state) && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-action-in-list') && ['taskList', 'taskItem'].includes(((_slice$content$firstC3 = slice.content.firstChild) === null || _slice$content$firstC3 === void 0 || (_slice$content$firstC3 = _slice$content$firstC3.type) === null || _slice$content$firstC3 === void 0 ? void 0 : _slice$content$firstC3.name) || ''));
1005
+ var _slice$content$firstC4;
1006
+ return Boolean((0, _utils.isInListItem)(state) && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-action-in-list') && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || ''));
996
1007
  }
@@ -7,15 +7,16 @@ import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isL
7
7
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
8
8
  import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
9
9
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
10
- import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
10
+ import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
11
11
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
  // TODO: ED-20519 Needs Macro extraction
14
14
 
15
15
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
16
16
  import { insertSliceForLists, insertSliceForListsInsideBlockquote, insertSliceForTaskInsideList } from './edge-cases';
17
+ import { insertSliceInsideOfPanelNodeSelected } from './edge-cases/lists';
17
18
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
18
- import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
19
+ import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './util';
19
20
 
20
21
  /** Helper type for single arg function */
21
22
 
@@ -49,7 +50,7 @@ export function handleMention(slice, schema) {
49
50
  }
50
51
  export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
51
52
  return (state, dispatch) => {
52
- var _slice$content$firstC, _transformedSlice$con;
53
+ var _slice$content$firstC, _slice$content$firstC2, _transformedSlice$con;
53
54
  const {
54
55
  schema,
55
56
  tr: {
@@ -80,8 +81,9 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
80
81
  } = schema;
81
82
  const selectionIsValidNode = state.selection instanceof NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
82
83
  const selectionHasValidParentNode = hasParentNodeOfType([decisionItem, taskItem, panel])(state.selection);
83
- const selectionIsPanel = hasParentNodeOfType([panel])(state.selection);
84
84
  const selectionIsCodeBlock = hasParentNodeOfType([codeBlock])(state.selection);
85
+ const panelNode = isSelectionInsidePanel(selection);
86
+ const selectionIsPanel = Boolean(panelNode);
85
87
 
86
88
  // we avoid handling codeBlock-in-panel use case in this function
87
89
  // returning false will allow code to flow into `handleCodeBlock` function
@@ -92,20 +94,21 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
92
94
  // Some types of content should be handled by the default handler, not this function.
93
95
  // Check through slice content to see if it contains an invalid node.
94
96
  let sliceIsInvalid = false;
97
+ let sliceHasTask = false;
95
98
  slice.content.nodesBetween(0, slice.content.size, node => {
96
99
  if (node.type === bulletList || node.type === orderedList || node.type === expand || node.type === heading || node.type === listItem) {
97
100
  sliceIsInvalid = true;
98
101
  }
99
102
  if (selectionIsPanel && node.type === taskList) {
100
- sliceIsInvalid = true;
103
+ sliceHasTask = true;
101
104
  }
102
105
  });
103
-
104
106
  // If the selection is a panel,
105
107
  // and the slice's first node is a paragraph
106
108
  // and it is not from a depth that would indicate it being from inside from another node (e.g. text from a decision)
107
109
  // then we can rely on the default behaviour.
108
- const sliceIsAPanelReceivingLowDepthText = selectionIsPanel && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === paragraph && slice.openEnd < 2;
110
+ const selectionIsTaskOrDecision = hasParentNode(node => node.type === taskItem || node.type === decisionItem)(selection);
111
+ const sliceIsAPanelReceivingLowDepthText = selectionIsPanel && !selectionIsTaskOrDecision && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === paragraph && slice.openEnd < 2;
109
112
  if (sliceIsInvalid || sliceIsAPanelReceivingLowDepthText || !selectionIsValidNode && !selectionHasValidParentNode) {
110
113
  return false;
111
114
  }
@@ -118,6 +121,12 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
118
121
  const transformedSlice = compose.apply(null, filters)(slice);
119
122
  const isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
120
123
  const tr = closeHistory(state.tr);
124
+ if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && getBooleanFF('platform.editor.handle-paste-for-action-in-panel') && isEmptyNode(panelNode) && selection.$from.node() === selection.$to.node()) {
125
+ return Boolean(insertSliceInsideOfPanelNodeSelected(panelNode)({
126
+ tr,
127
+ slice
128
+ }));
129
+ }
121
130
  const transformedSliceIsValidNode = (transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskItem', 'taskList', 'panel'].includes(transformedSlice.content.firstChild.type.name)) && (!isInListItem(state) || isInListItem(state) && isFirstChildTaskNode);
122
131
  // If the slice or the selection are valid nodes to handle,
123
132
  // and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
@@ -172,7 +181,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
172
181
  }
173
182
  export function handlePasteNonNestableBlockNodesIntoList(slice) {
174
183
  return (state, dispatch) => {
175
- var _tr$doc$nodeAt, _slice$content$firstC2, _sliceContent$firstCh, _findParentNodeOfType;
184
+ var _tr$doc$nodeAt, _slice$content$firstC3, _sliceContent$firstCh, _findParentNodeOfType;
176
185
  const {
177
186
  tr
178
187
  } = state;
@@ -254,7 +263,7 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
254
263
  }
255
264
 
256
265
  // handle the insertion of the slice
257
- if (((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type.name) === 'blockquote' && contains(slice.content.firstChild, state.schema.nodes.listItem)) {
266
+ if (((_slice$content$firstC3 = slice.content.firstChild) === null || _slice$content$firstC3 === void 0 ? void 0 : _slice$content$firstC3.type.name) === 'blockquote' && contains(slice.content.firstChild, state.schema.nodes.listItem)) {
258
267
  insertSliceForListsInsideBlockquote({
259
268
  tr,
260
269
  slice
@@ -970,6 +979,6 @@ export const handleSelectedTable = editorAnalyticsAPI => slice => (state, dispat
970
979
  return false;
971
980
  };
972
981
  export function checkTaskListInList(state, slice) {
973
- var _slice$content$firstC3, _slice$content$firstC4;
974
- return Boolean(isInListItem(state) && getBooleanFF('platform.editor.allow-action-in-list') && ['taskList', 'taskItem'].includes(((_slice$content$firstC3 = slice.content.firstChild) === null || _slice$content$firstC3 === void 0 ? void 0 : (_slice$content$firstC4 = _slice$content$firstC3.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || ''));
982
+ var _slice$content$firstC4, _slice$content$firstC5;
983
+ return Boolean(isInListItem(state) && getBooleanFF('platform.editor.allow-action-in-list') && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 ? void 0 : (_slice$content$firstC5 = _slice$content$firstC4.type) === null || _slice$content$firstC5 === void 0 ? void 0 : _slice$content$firstC5.name) || ''));
975
984
  }
@@ -15,15 +15,16 @@ import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isL
15
15
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
16
16
  import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
17
17
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
18
- import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
18
+ import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
19
19
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
20
20
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
21
21
  // TODO: ED-20519 Needs Macro extraction
22
22
 
23
23
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
24
24
  import { insertSliceForLists, insertSliceForListsInsideBlockquote, insertSliceForTaskInsideList } from './edge-cases';
25
+ import { insertSliceInsideOfPanelNodeSelected } from './edge-cases/lists';
25
26
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
26
- import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
27
+ import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './util';
27
28
 
28
29
  /** Helper type for single arg function */
29
30
 
@@ -61,7 +62,7 @@ export function handleMention(slice, schema) {
61
62
  }
62
63
  export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
63
64
  return function (state, dispatch) {
64
- var _slice$content$firstC, _transformedSlice$con;
65
+ var _slice$content$firstC, _slice$content$firstC2, _transformedSlice$con;
65
66
  var schema = state.schema,
66
67
  selection = state.tr.selection;
67
68
  var codeMark = schema.marks.code,
@@ -83,8 +84,9 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
83
84
  codeBlock = _schema$nodes.codeBlock;
84
85
  var selectionIsValidNode = state.selection instanceof NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
85
86
  var selectionHasValidParentNode = hasParentNodeOfType([decisionItem, taskItem, panel])(state.selection);
86
- var selectionIsPanel = hasParentNodeOfType([panel])(state.selection);
87
87
  var selectionIsCodeBlock = hasParentNodeOfType([codeBlock])(state.selection);
88
+ var panelNode = isSelectionInsidePanel(selection);
89
+ var selectionIsPanel = Boolean(panelNode);
88
90
 
89
91
  // we avoid handling codeBlock-in-panel use case in this function
90
92
  // returning false will allow code to flow into `handleCodeBlock` function
@@ -95,20 +97,23 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
95
97
  // Some types of content should be handled by the default handler, not this function.
96
98
  // Check through slice content to see if it contains an invalid node.
97
99
  var sliceIsInvalid = false;
100
+ var sliceHasTask = false;
98
101
  slice.content.nodesBetween(0, slice.content.size, function (node) {
99
102
  if (node.type === bulletList || node.type === orderedList || node.type === expand || node.type === heading || node.type === listItem) {
100
103
  sliceIsInvalid = true;
101
104
  }
102
105
  if (selectionIsPanel && node.type === taskList) {
103
- sliceIsInvalid = true;
106
+ sliceHasTask = true;
104
107
  }
105
108
  });
106
-
107
109
  // If the selection is a panel,
108
110
  // and the slice's first node is a paragraph
109
111
  // and it is not from a depth that would indicate it being from inside from another node (e.g. text from a decision)
110
112
  // then we can rely on the default behaviour.
111
- var sliceIsAPanelReceivingLowDepthText = selectionIsPanel && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === paragraph && slice.openEnd < 2;
113
+ var selectionIsTaskOrDecision = hasParentNode(function (node) {
114
+ return node.type === taskItem || node.type === decisionItem;
115
+ })(selection);
116
+ var sliceIsAPanelReceivingLowDepthText = selectionIsPanel && !selectionIsTaskOrDecision && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === paragraph && slice.openEnd < 2;
112
117
  if (sliceIsInvalid || sliceIsAPanelReceivingLowDepthText || !selectionIsValidNode && !selectionHasValidParentNode) {
113
118
  return false;
114
119
  }
@@ -121,6 +126,12 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
121
126
  var transformedSlice = compose.apply(null, filters)(slice);
122
127
  var isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
123
128
  var tr = closeHistory(state.tr);
129
+ if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && getBooleanFF('platform.editor.handle-paste-for-action-in-panel') && isEmptyNode(panelNode) && selection.$from.node() === selection.$to.node()) {
130
+ return Boolean(insertSliceInsideOfPanelNodeSelected(panelNode)({
131
+ tr: tr,
132
+ slice: slice
133
+ }));
134
+ }
124
135
  var transformedSliceIsValidNode = (transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskItem', 'taskList', 'panel'].includes(transformedSlice.content.firstChild.type.name)) && (!isInListItem(state) || isInListItem(state) && isFirstChildTaskNode);
125
136
  // If the slice or the selection are valid nodes to handle,
126
137
  // and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
@@ -175,7 +186,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
175
186
  }
176
187
  export function handlePasteNonNestableBlockNodesIntoList(slice) {
177
188
  return function (state, dispatch) {
178
- var _tr$doc$nodeAt, _slice$content$firstC2, _sliceContent$firstCh, _findParentNodeOfType;
189
+ var _tr$doc$nodeAt, _slice$content$firstC3, _sliceContent$firstCh, _findParentNodeOfType;
179
190
  var tr = state.tr;
180
191
  var selection = tr.selection;
181
192
  var $from = selection.$from,
@@ -250,7 +261,7 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
250
261
  }
251
262
 
252
263
  // handle the insertion of the slice
253
- if (((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type.name) === 'blockquote' && contains(slice.content.firstChild, state.schema.nodes.listItem)) {
264
+ if (((_slice$content$firstC3 = slice.content.firstChild) === null || _slice$content$firstC3 === void 0 ? void 0 : _slice$content$firstC3.type.name) === 'blockquote' && contains(slice.content.firstChild, state.schema.nodes.listItem)) {
254
265
  insertSliceForListsInsideBlockquote({
255
266
  tr: tr,
256
267
  slice: slice
@@ -969,6 +980,6 @@ export var handleSelectedTable = function handleSelectedTable(editorAnalyticsAPI
969
980
  };
970
981
  };
971
982
  export function checkTaskListInList(state, slice) {
972
- var _slice$content$firstC3;
973
- return Boolean(isInListItem(state) && getBooleanFF('platform.editor.allow-action-in-list') && ['taskList', 'taskItem'].includes(((_slice$content$firstC3 = slice.content.firstChild) === null || _slice$content$firstC3 === void 0 || (_slice$content$firstC3 = _slice$content$firstC3.type) === null || _slice$content$firstC3 === void 0 ? void 0 : _slice$content$firstC3.name) || ''));
983
+ var _slice$content$firstC4;
984
+ return Boolean(isInListItem(state) && getBooleanFF('platform.editor.allow-action-in-list') && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || ''));
974
985
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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": "^78.3.0",
36
+ "@atlaskit/editor-common": "^78.4.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.3.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^1.0.0",
@@ -125,6 +125,9 @@
125
125
  },
126
126
  "platform.editor.media.fix-copy-paste-excel_62g4s": {
127
127
  "type": "boolean"
128
+ },
129
+ "platform.editor.handle-paste-for-action-in-panel": {
130
+ "type": "boolean"
128
131
  }
129
132
  }
130
133
  }