@atlaskit/editor-plugin-paste 0.2.8 → 0.2.10

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,19 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 0.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#67922](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67922) [`cd95401d8cde`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cd95401d8cde) - ED-21865 Set correct cursor position when decision is pasted inside panel
8
+
9
+ ## 0.2.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [#66826](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66826) [`5e9f6778a15a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5e9f6778a15a) - [ux] resolved a bug where the cursor mispalced after pasting the media into the panel
14
+ - [#67283](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67283) [`4f10a52c6e39`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4f10a52c6e39) - ED-21613 handle incorrect cursor position - when task is copied into a list
15
+ - Updated dependencies
16
+
3
17
  ## 0.2.8
4
18
 
5
19
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.insertSliceForLists = insertSliceForLists;
7
7
  exports.insertSliceForListsInsideBlockquote = insertSliceForListsInsideBlockquote;
8
+ exports.updateSelectionAfterReplace = updateSelectionAfterReplace;
8
9
  var _utils = require("@atlaskit/editor-common/utils");
9
10
  var _model = require("@atlaskit/editor-prosemirror/model");
10
11
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -70,6 +71,13 @@ function insertSliceForListsInsideBlockquote(_ref3) {
70
71
  //insert blockquote explicitly and set the selection in blockquote since replaceSelection will only insert the list
71
72
  var schema = tr.doc.type.schema;
72
73
  tr.replaceSelection(new _model.Slice(_model.Fragment.from(schema.nodes.blockquote.createAndFill()), 0, 0));
74
+ updateSelectionAfterReplace({
75
+ tr: tr
76
+ });
77
+ tr.replaceSelection(slice);
78
+ }
79
+ function updateSelectionAfterReplace(_ref4) {
80
+ var tr = _ref4.tr;
73
81
  // ProseMirror doesn't give a proper way to tell us where something was inserted.
74
82
  // However, we can know "how" it inserted something.
75
83
  //
@@ -78,6 +86,7 @@ function insertSliceForListsInsideBlockquote(_ref3) {
78
86
  // The `replaceStep.to and replaceStep.from`, tell us the real position
79
87
  // where the content will be insert.
80
88
  // Then, we can use the `tr.mapping.map` to the updated position after the replace operation
89
+
81
90
  var replaceStep = tr.steps[0];
82
91
  if (!(replaceStep instanceof _transform.ReplaceStep)) {
83
92
  return tr;
@@ -88,5 +97,4 @@ function insertSliceForListsInsideBlockquote(_ref3) {
88
97
  if (nextSelection) {
89
98
  tr.setSelection(nextSelection);
90
99
  }
91
- tr.replaceSelection(slice);
92
100
  }
@@ -36,6 +36,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
36
36
  var _state = require("@atlaskit/editor-prosemirror/state");
37
37
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
38
38
  var _utils3 = require("@atlaskit/editor-tables/utils");
39
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
39
40
  var _commands = require("./commands");
40
41
  var _edgeCases = require("./edge-cases");
41
42
  var _pluginFactory = require("./pm-plugins/plugin-factory");
@@ -86,7 +87,6 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
86
87
  selection = state.tr.selection;
87
88
  var codeMark = schema.marks.code,
88
89
  _schema$nodes = schema.nodes,
89
- codeBlock = _schema$nodes.codeBlock,
90
90
  decisionItem = _schema$nodes.decisionItem,
91
91
  emoji = _schema$nodes.emoji,
92
92
  hardBreak = _schema$nodes.hardBreak,
@@ -139,21 +139,32 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
139
139
  // and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
140
140
  // or the slice's first node is a paragraph,
141
141
  // then we can replace the selection with our slice.
142
- if ((transformedSliceIsValidNode || selectionIsValidNode) && !(transformedSlice.openStart === 1 && transformedSlice.openEnd === 0 ||
142
+ var pastingDecisionIntoExtendedPanel = selectionIsPanel && transformedSlice.content.firstChild.type.name === 'decisionList' && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-extended-panel');
143
+ if ((transformedSliceIsValidNode || selectionIsValidNode) && !pastingDecisionIntoExtendedPanel && !(transformedSlice.openStart === 1 && transformedSlice.openEnd === 0 ||
143
144
  // Whole codeblock node has reverse slice depths.
144
145
  transformedSlice.openStart === 0 && transformedSlice.openEnd === 1) || ((_transformedSlice$con = transformedSlice.content.firstChild) === null || _transformedSlice$con === void 0 ? void 0 : _transformedSlice$con.type) === paragraph) {
145
146
  tr.replaceSelection(transformedSlice).scrollIntoView();
147
+ } else if (['mediaSingle'].includes(transformedSlice.content.firstChild.type.name) && selectionIsPanel) {
148
+ var parentNode = (0, _utils2.findParentNodeOfType)(panel)(selection);
149
+ if (selectionIsPanel && parentNode && (0, _utils.isNodeEmpty)(parentNode.node)) {
150
+ tr.insert(selection.$from.pos, transformedSlice.content).scrollIntoView();
151
+ // Place the cursor at the the end of the insersertion
152
+ var endPos = tr.selection.from + transformedSlice.size;
153
+ tr.setSelection(new _state.TextSelection(tr.doc.resolve(endPos)));
154
+ } else {
155
+ tr.replaceSelection(transformedSlice).scrollIntoView();
156
+ }
146
157
  } else {
147
158
  // This maintains both the selection (destination) and the slice (paste content).
148
159
  (0, _utils2.safeInsert)(transformedSlice.content)(tr).scrollIntoView();
149
- //safeInsert doesn't set correct cursor position inside codeBlock
150
- //it moves the cursor to beginning of the codeblock
160
+ //safeInsert doesn't set correct cursor position inside codeBlock or decision
161
+ //it moves the cursor to beginning of the node
151
162
  //we manually shift the cursor to end of the codeblock
152
163
  var currentPosition = tr.selection.$from;
153
164
  var currentNode = currentPosition.parent;
154
- if (currentNode.type === codeBlock) {
155
- var endPosOfCodeBlock = currentPosition.end();
156
- var endResolvedPosition = tr.doc.resolve(endPosOfCodeBlock);
165
+ if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
166
+ var endPosOfNode = currentPosition.end();
167
+ var endResolvedPosition = tr.doc.resolve(endPosOfNode);
157
168
  tr.setSelection(new _state.TextSelection(endResolvedPosition, endResolvedPosition));
158
169
  }
159
170
  }
@@ -827,7 +838,7 @@ function flattenNestedListInSlice(slice) {
827
838
  }
828
839
  function handleRichText(slice, queueCardsFromChangedTr) {
829
840
  return function (state, dispatch) {
830
- var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
841
+ var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre, _slice$content$firstC3;
831
842
  var _state$schema$nodes3 = state.schema.nodes,
832
843
  codeBlock = _state$schema$nodes3.codeBlock,
833
844
  heading = _state$schema$nodes3.heading,
@@ -910,6 +921,11 @@ function handleRichText(slice, queueCardsFromChangedTr) {
910
921
  if (tr.selection.empty && tr.selection.$from.parent.type === codeBlock) {
911
922
  tr.setSelection(_state.TextSelection.near(tr.selection.$from, 1));
912
923
  }
924
+ if ((0, _utils.isInListItem)(state) && ['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) || '')) {
925
+ (0, _edgeCases.updateSelectionAfterReplace)({
926
+ tr: tr
927
+ });
928
+ }
913
929
  tr.scrollIntoView();
914
930
 
915
931
  // queue link cards, ignoring any errors
@@ -71,6 +71,14 @@ export function insertSliceForListsInsideBlockquote({
71
71
  schema
72
72
  } = tr.doc.type;
73
73
  tr.replaceSelection(new Slice(Fragment.from(schema.nodes.blockquote.createAndFill()), 0, 0));
74
+ updateSelectionAfterReplace({
75
+ tr
76
+ });
77
+ tr.replaceSelection(slice);
78
+ }
79
+ export function updateSelectionAfterReplace({
80
+ tr
81
+ }) {
74
82
  // ProseMirror doesn't give a proper way to tell us where something was inserted.
75
83
  // However, we can know "how" it inserted something.
76
84
  //
@@ -79,6 +87,7 @@ export function insertSliceForListsInsideBlockquote({
79
87
  // The `replaceStep.to and replaceStep.from`, tell us the real position
80
88
  // where the content will be insert.
81
89
  // Then, we can use the `tr.mapping.map` to the updated position after the replace operation
90
+
82
91
  const replaceStep = tr.steps[0];
83
92
  if (!(replaceStep instanceof ReplaceStep)) {
84
93
  return tr;
@@ -89,5 +98,4 @@ export function insertSliceForListsInsideBlockquote({
89
98
  if (nextSelection) {
90
99
  tr.setSelection(nextSelection);
91
100
  }
92
- tr.replaceSelection(slice);
93
101
  }
@@ -3,16 +3,17 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { insideTable } from '@atlaskit/editor-common/core-utils';
4
4
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
5
5
  import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
6
- import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
6
+ import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isNodeEmpty, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
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
10
  import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
11
11
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
12
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
13
  // TODO: ED-20519 Needs Macro extraction
13
14
 
14
15
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
15
- import { insertSliceForLists, insertSliceForListsInsideBlockquote } from './edge-cases';
16
+ import { insertSliceForLists, insertSliceForListsInsideBlockquote, updateSelectionAfterReplace } from './edge-cases';
16
17
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
17
18
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
18
19
 
@@ -60,7 +61,6 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
60
61
  code: codeMark
61
62
  },
62
63
  nodes: {
63
- codeBlock,
64
64
  decisionItem,
65
65
  emoji,
66
66
  hardBreak,
@@ -115,21 +115,32 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
115
115
  // and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
116
116
  // or the slice's first node is a paragraph,
117
117
  // then we can replace the selection with our slice.
118
- if ((transformedSliceIsValidNode || selectionIsValidNode) && !(transformedSlice.openStart === 1 && transformedSlice.openEnd === 0 ||
118
+ const pastingDecisionIntoExtendedPanel = selectionIsPanel && transformedSlice.content.firstChild.type.name === 'decisionList' && getBooleanFF('platform.editor.allow-extended-panel');
119
+ if ((transformedSliceIsValidNode || selectionIsValidNode) && !pastingDecisionIntoExtendedPanel && !(transformedSlice.openStart === 1 && transformedSlice.openEnd === 0 ||
119
120
  // Whole codeblock node has reverse slice depths.
120
121
  transformedSlice.openStart === 0 && transformedSlice.openEnd === 1) || ((_transformedSlice$con = transformedSlice.content.firstChild) === null || _transformedSlice$con === void 0 ? void 0 : _transformedSlice$con.type) === paragraph) {
121
122
  tr.replaceSelection(transformedSlice).scrollIntoView();
123
+ } else if (['mediaSingle'].includes(transformedSlice.content.firstChild.type.name) && selectionIsPanel) {
124
+ const parentNode = findParentNodeOfType(panel)(selection);
125
+ if (selectionIsPanel && parentNode && isNodeEmpty(parentNode.node)) {
126
+ tr.insert(selection.$from.pos, transformedSlice.content).scrollIntoView();
127
+ // Place the cursor at the the end of the insersertion
128
+ const endPos = tr.selection.from + transformedSlice.size;
129
+ tr.setSelection(new TextSelection(tr.doc.resolve(endPos)));
130
+ } else {
131
+ tr.replaceSelection(transformedSlice).scrollIntoView();
132
+ }
122
133
  } else {
123
134
  // This maintains both the selection (destination) and the slice (paste content).
124
135
  safeInsert(transformedSlice.content)(tr).scrollIntoView();
125
- //safeInsert doesn't set correct cursor position inside codeBlock
126
- //it moves the cursor to beginning of the codeblock
136
+ //safeInsert doesn't set correct cursor position inside codeBlock or decision
137
+ //it moves the cursor to beginning of the node
127
138
  //we manually shift the cursor to end of the codeblock
128
139
  const currentPosition = tr.selection.$from;
129
140
  const currentNode = currentPosition.parent;
130
- if (currentNode.type === codeBlock) {
131
- const endPosOfCodeBlock = currentPosition.end();
132
- const endResolvedPosition = tr.doc.resolve(endPosOfCodeBlock);
141
+ if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
142
+ const endPosOfNode = currentPosition.end();
143
+ const endResolvedPosition = tr.doc.resolve(endPosOfNode);
133
144
  tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
134
145
  }
135
146
  }
@@ -806,7 +817,7 @@ export function flattenNestedListInSlice(slice) {
806
817
  }
807
818
  export function handleRichText(slice, queueCardsFromChangedTr) {
808
819
  return (state, dispatch) => {
809
- var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
820
+ var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre, _slice$content$firstC3, _slice$content$firstC4;
810
821
  const {
811
822
  codeBlock,
812
823
  heading,
@@ -892,6 +903,11 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
892
903
  if (tr.selection.empty && tr.selection.$from.parent.type === codeBlock) {
893
904
  tr.setSelection(TextSelection.near(tr.selection.$from, 1));
894
905
  }
906
+ if (isInListItem(state) && ['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) || '')) {
907
+ updateSelectionAfterReplace({
908
+ tr
909
+ });
910
+ }
895
911
  tr.scrollIntoView();
896
912
 
897
913
  // queue link cards, ignoring any errors
@@ -63,6 +63,13 @@ export function insertSliceForListsInsideBlockquote(_ref3) {
63
63
  //insert blockquote explicitly and set the selection in blockquote since replaceSelection will only insert the list
64
64
  var schema = tr.doc.type.schema;
65
65
  tr.replaceSelection(new Slice(Fragment.from(schema.nodes.blockquote.createAndFill()), 0, 0));
66
+ updateSelectionAfterReplace({
67
+ tr: tr
68
+ });
69
+ tr.replaceSelection(slice);
70
+ }
71
+ export function updateSelectionAfterReplace(_ref4) {
72
+ var tr = _ref4.tr;
66
73
  // ProseMirror doesn't give a proper way to tell us where something was inserted.
67
74
  // However, we can know "how" it inserted something.
68
75
  //
@@ -71,6 +78,7 @@ export function insertSliceForListsInsideBlockquote(_ref3) {
71
78
  // The `replaceStep.to and replaceStep.from`, tell us the real position
72
79
  // where the content will be insert.
73
80
  // Then, we can use the `tr.mapping.map` to the updated position after the replace operation
81
+
74
82
  var replaceStep = tr.steps[0];
75
83
  if (!(replaceStep instanceof ReplaceStep)) {
76
84
  return tr;
@@ -81,5 +89,4 @@ export function insertSliceForListsInsideBlockquote(_ref3) {
81
89
  if (nextSelection) {
82
90
  tr.setSelection(nextSelection);
83
91
  }
84
- tr.replaceSelection(slice);
85
92
  }
@@ -11,16 +11,17 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
11
  import { insideTable } from '@atlaskit/editor-common/core-utils';
12
12
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
13
13
  import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
14
- import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
14
+ import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isNodeEmpty, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
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
18
  import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
19
19
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
20
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
21
  // TODO: ED-20519 Needs Macro extraction
21
22
 
22
23
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
23
- import { insertSliceForLists, insertSliceForListsInsideBlockquote } from './edge-cases';
24
+ import { insertSliceForLists, insertSliceForListsInsideBlockquote, updateSelectionAfterReplace } from './edge-cases';
24
25
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
25
26
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
26
27
 
@@ -65,7 +66,6 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
65
66
  selection = state.tr.selection;
66
67
  var codeMark = schema.marks.code,
67
68
  _schema$nodes = schema.nodes,
68
- codeBlock = _schema$nodes.codeBlock,
69
69
  decisionItem = _schema$nodes.decisionItem,
70
70
  emoji = _schema$nodes.emoji,
71
71
  hardBreak = _schema$nodes.hardBreak,
@@ -118,21 +118,32 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
118
118
  // and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
119
119
  // or the slice's first node is a paragraph,
120
120
  // then we can replace the selection with our slice.
121
- if ((transformedSliceIsValidNode || selectionIsValidNode) && !(transformedSlice.openStart === 1 && transformedSlice.openEnd === 0 ||
121
+ var pastingDecisionIntoExtendedPanel = selectionIsPanel && transformedSlice.content.firstChild.type.name === 'decisionList' && getBooleanFF('platform.editor.allow-extended-panel');
122
+ if ((transformedSliceIsValidNode || selectionIsValidNode) && !pastingDecisionIntoExtendedPanel && !(transformedSlice.openStart === 1 && transformedSlice.openEnd === 0 ||
122
123
  // Whole codeblock node has reverse slice depths.
123
124
  transformedSlice.openStart === 0 && transformedSlice.openEnd === 1) || ((_transformedSlice$con = transformedSlice.content.firstChild) === null || _transformedSlice$con === void 0 ? void 0 : _transformedSlice$con.type) === paragraph) {
124
125
  tr.replaceSelection(transformedSlice).scrollIntoView();
126
+ } else if (['mediaSingle'].includes(transformedSlice.content.firstChild.type.name) && selectionIsPanel) {
127
+ var parentNode = findParentNodeOfType(panel)(selection);
128
+ if (selectionIsPanel && parentNode && isNodeEmpty(parentNode.node)) {
129
+ tr.insert(selection.$from.pos, transformedSlice.content).scrollIntoView();
130
+ // Place the cursor at the the end of the insersertion
131
+ var endPos = tr.selection.from + transformedSlice.size;
132
+ tr.setSelection(new TextSelection(tr.doc.resolve(endPos)));
133
+ } else {
134
+ tr.replaceSelection(transformedSlice).scrollIntoView();
135
+ }
125
136
  } else {
126
137
  // This maintains both the selection (destination) and the slice (paste content).
127
138
  safeInsert(transformedSlice.content)(tr).scrollIntoView();
128
- //safeInsert doesn't set correct cursor position inside codeBlock
129
- //it moves the cursor to beginning of the codeblock
139
+ //safeInsert doesn't set correct cursor position inside codeBlock or decision
140
+ //it moves the cursor to beginning of the node
130
141
  //we manually shift the cursor to end of the codeblock
131
142
  var currentPosition = tr.selection.$from;
132
143
  var currentNode = currentPosition.parent;
133
- if (currentNode.type === codeBlock) {
134
- var endPosOfCodeBlock = currentPosition.end();
135
- var endResolvedPosition = tr.doc.resolve(endPosOfCodeBlock);
144
+ if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
145
+ var endPosOfNode = currentPosition.end();
146
+ var endResolvedPosition = tr.doc.resolve(endPosOfNode);
136
147
  tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
137
148
  }
138
149
  }
@@ -806,7 +817,7 @@ export function flattenNestedListInSlice(slice) {
806
817
  }
807
818
  export function handleRichText(slice, queueCardsFromChangedTr) {
808
819
  return function (state, dispatch) {
809
- var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
820
+ var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre, _slice$content$firstC3;
810
821
  var _state$schema$nodes3 = state.schema.nodes,
811
822
  codeBlock = _state$schema$nodes3.codeBlock,
812
823
  heading = _state$schema$nodes3.heading,
@@ -889,6 +900,11 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
889
900
  if (tr.selection.empty && tr.selection.$from.parent.type === codeBlock) {
890
901
  tr.setSelection(TextSelection.near(tr.selection.$from, 1));
891
902
  }
903
+ if (isInListItem(state) && ['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) || '')) {
904
+ updateSelectionAfterReplace({
905
+ tr: tr
906
+ });
907
+ }
892
908
  tr.scrollIntoView();
893
909
 
894
910
  // queue link cards, ignoring any errors
@@ -8,4 +8,7 @@ export declare function insertSliceForLists({ tr, slice, schema, }: {
8
8
  export declare function insertSliceForListsInsideBlockquote({ tr, slice, }: {
9
9
  tr: Transaction;
10
10
  slice: PMSlice;
11
+ }): void;
12
+ export declare function updateSelectionAfterReplace({ tr }: {
13
+ tr: Transaction;
11
14
  }): Transaction | undefined;
@@ -8,4 +8,7 @@ export declare function insertSliceForLists({ tr, slice, schema, }: {
8
8
  export declare function insertSliceForListsInsideBlockquote({ tr, slice, }: {
9
9
  tr: Transaction;
10
10
  slice: PMSlice;
11
+ }): void;
12
+ export declare function updateSelectionAfterReplace({ tr }: {
13
+ tr: Transaction;
11
14
  }): Transaction | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -14,7 +14,7 @@
14
14
  "releaseModel": "continuous",
15
15
  "runReact18": false
16
16
  },
17
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
17
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
18
18
  "main": "dist/cjs/index.js",
19
19
  "module": "dist/esm/index.js",
20
20
  "module:es2019": "dist/es2019/index.js",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^76.39.0",
36
+ "@atlaskit/editor-common": "^76.41.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.3.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^0.1.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/editor-plugin-list": "^3.1.0",
44
44
  "@atlaskit/editor-plugin-media": "^0.11.0",
45
45
  "@atlaskit/editor-prosemirror": "1.1.0",
46
- "@atlaskit/editor-tables": "^2.3.0",
46
+ "@atlaskit/editor-tables": "^2.4.0",
47
47
  "@atlaskit/media-client": "^26.1.0",
48
48
  "@atlaskit/media-common": "^11.0.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
@@ -116,6 +116,9 @@
116
116
  "platform-feature-flags": {
117
117
  "platform.editor.media.extended-resize-experience": {
118
118
  "type": "boolean"
119
+ },
120
+ "platform.editor.allow-extended-panel": {
121
+ "type": "boolean"
119
122
  }
120
123
  }
121
124
  }