@atlaskit/editor-plugin-paste 0.2.11 → 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 +6 -0
- package/dist/cjs/handlers.js +15 -11
- package/dist/es2019/handlers.js +15 -11
- package/dist/esm/handlers.js +15 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 0.2.11
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/handlers.js
CHANGED
|
@@ -155,17 +155,21 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
155
155
|
tr.replaceSelection(transformedSlice).scrollIntoView();
|
|
156
156
|
}
|
|
157
157
|
} else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
var
|
|
167
|
-
var
|
|
168
|
-
|
|
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);
|
package/dist/es2019/handlers.js
CHANGED
|
@@ -131,17 +131,21 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
131
131
|
tr.replaceSelection(transformedSlice).scrollIntoView();
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
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);
|
package/dist/esm/handlers.js
CHANGED
|
@@ -134,17 +134,21 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
134
134
|
tr.replaceSelection(transformedSlice).scrollIntoView();
|
|
135
135
|
}
|
|
136
136
|
} else {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
|
|
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);
|