@atlaskit/editor-plugin-paste 0.2.10 → 0.2.12

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,17 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 0.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#68721](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68721) [`0c420c1e6b96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c420c1e6b96) - ED-21618 Replace selected decision in panel on pasting another decision
8
+
9
+ ## 0.2.11
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 0.2.10
4
16
 
5
17
  ### Patch Changes
@@ -155,17 +155,21 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
155
155
  tr.replaceSelection(transformedSlice).scrollIntoView();
156
156
  }
157
157
  } else {
158
- // This maintains both the selection (destination) and the slice (paste content).
159
- (0, _utils2.safeInsert)(transformedSlice.content)(tr).scrollIntoView();
160
- //safeInsert doesn't set correct cursor position inside codeBlock or decision
161
- //it moves the cursor to beginning of the node
162
- //we manually shift the cursor to end of the codeblock
163
- var currentPosition = tr.selection.$from;
164
- var currentNode = currentPosition.parent;
165
- if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
166
- var endPosOfNode = currentPosition.end();
167
- var endResolvedPosition = tr.doc.resolve(endPosOfNode);
168
- tr.setSelection(new _state.TextSelection(endResolvedPosition, endResolvedPosition));
158
+ if (pastingDecisionIntoExtendedPanel && selectionIsValidNode) {
159
+ tr.replaceSelection(transformedSlice).scrollIntoView();
160
+ } else {
161
+ // This maintains both the selection (destination) and the slice (paste content).
162
+ (0, _utils2.safeInsert)(transformedSlice.content)(tr).scrollIntoView();
163
+ //safeInsert doesn't set correct cursor position inside codeBlock or decision
164
+ //it moves the cursor to beginning of the node
165
+ //we manually shift the cursor to end of the codeblock
166
+ var currentPosition = tr.selection.$from;
167
+ var currentNode = currentPosition.parent;
168
+ if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
169
+ var endPosOfNode = currentPosition.end();
170
+ var endResolvedPosition = tr.doc.resolve(endPosOfNode);
171
+ tr.setSelection(new _state.TextSelection(endResolvedPosition, endResolvedPosition));
172
+ }
169
173
  }
170
174
  }
171
175
  queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
@@ -131,17 +131,21 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
131
131
  tr.replaceSelection(transformedSlice).scrollIntoView();
132
132
  }
133
133
  } else {
134
- // This maintains both the selection (destination) and the slice (paste content).
135
- safeInsert(transformedSlice.content)(tr).scrollIntoView();
136
- //safeInsert doesn't set correct cursor position inside codeBlock or decision
137
- //it moves the cursor to beginning of the node
138
- //we manually shift the cursor to end of the codeblock
139
- const currentPosition = tr.selection.$from;
140
- const currentNode = currentPosition.parent;
141
- if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
142
- const endPosOfNode = currentPosition.end();
143
- const endResolvedPosition = tr.doc.resolve(endPosOfNode);
144
- tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
134
+ if (pastingDecisionIntoExtendedPanel && selectionIsValidNode) {
135
+ tr.replaceSelection(transformedSlice).scrollIntoView();
136
+ } else {
137
+ // This maintains both the selection (destination) and the slice (paste content).
138
+ safeInsert(transformedSlice.content)(tr).scrollIntoView();
139
+ //safeInsert doesn't set correct cursor position inside codeBlock or decision
140
+ //it moves the cursor to beginning of the node
141
+ //we manually shift the cursor to end of the codeblock
142
+ const currentPosition = tr.selection.$from;
143
+ const currentNode = currentPosition.parent;
144
+ if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
145
+ const endPosOfNode = currentPosition.end();
146
+ const endResolvedPosition = tr.doc.resolve(endPosOfNode);
147
+ tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
148
+ }
145
149
  }
146
150
  }
147
151
  queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
@@ -134,17 +134,21 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
134
134
  tr.replaceSelection(transformedSlice).scrollIntoView();
135
135
  }
136
136
  } else {
137
- // This maintains both the selection (destination) and the slice (paste content).
138
- safeInsert(transformedSlice.content)(tr).scrollIntoView();
139
- //safeInsert doesn't set correct cursor position inside codeBlock or decision
140
- //it moves the cursor to beginning of the node
141
- //we manually shift the cursor to end of the codeblock
142
- var currentPosition = tr.selection.$from;
143
- var currentNode = currentPosition.parent;
144
- if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
145
- var endPosOfNode = currentPosition.end();
146
- var endResolvedPosition = tr.doc.resolve(endPosOfNode);
147
- tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
137
+ if (pastingDecisionIntoExtendedPanel && selectionIsValidNode) {
138
+ tr.replaceSelection(transformedSlice).scrollIntoView();
139
+ } else {
140
+ // This maintains both the selection (destination) and the slice (paste content).
141
+ safeInsert(transformedSlice.content)(tr).scrollIntoView();
142
+ //safeInsert doesn't set correct cursor position inside codeBlock or decision
143
+ //it moves the cursor to beginning of the node
144
+ //we manually shift the cursor to end of the codeblock
145
+ var currentPosition = tr.selection.$from;
146
+ var currentNode = currentPosition.parent;
147
+ if (['codeBlock', 'decisionItem'].includes(currentNode.type.name)) {
148
+ var endPosOfNode = currentPosition.end();
149
+ var endResolvedPosition = tr.doc.resolve(endPosOfNode);
150
+ tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
151
+ }
148
152
  }
149
153
  }
150
154
  queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
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": "^76.41.0",
36
+ "@atlaskit/editor-common": "^77.0.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",