@atlaskit/editor-plugin-paste 0.2.7 → 0.2.8
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 +11 -0
- package/dist/es2019/handlers.js +11 -0
- package/dist/esm/handlers.js +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 0.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#66495](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66495) [`8d310bc51505`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d310bc51505) - ED-21623: Fixing paste behaviour for nested codeblock in panel
|
|
8
|
+
|
|
3
9
|
## 0.2.7
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/handlers.js
CHANGED
|
@@ -86,6 +86,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
86
86
|
selection = state.tr.selection;
|
|
87
87
|
var codeMark = schema.marks.code,
|
|
88
88
|
_schema$nodes = schema.nodes,
|
|
89
|
+
codeBlock = _schema$nodes.codeBlock,
|
|
89
90
|
decisionItem = _schema$nodes.decisionItem,
|
|
90
91
|
emoji = _schema$nodes.emoji,
|
|
91
92
|
hardBreak = _schema$nodes.hardBreak,
|
|
@@ -145,6 +146,16 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
145
146
|
} else {
|
|
146
147
|
// This maintains both the selection (destination) and the slice (paste content).
|
|
147
148
|
(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
|
|
151
|
+
//we manually shift the cursor to end of the codeblock
|
|
152
|
+
var currentPosition = tr.selection.$from;
|
|
153
|
+
var currentNode = currentPosition.parent;
|
|
154
|
+
if (currentNode.type === codeBlock) {
|
|
155
|
+
var endPosOfCodeBlock = currentPosition.end();
|
|
156
|
+
var endResolvedPosition = tr.doc.resolve(endPosOfCodeBlock);
|
|
157
|
+
tr.setSelection(new _state.TextSelection(endResolvedPosition, endResolvedPosition));
|
|
158
|
+
}
|
|
148
159
|
}
|
|
149
160
|
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
150
161
|
if (dispatch) {
|
package/dist/es2019/handlers.js
CHANGED
|
@@ -60,6 +60,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
60
60
|
code: codeMark
|
|
61
61
|
},
|
|
62
62
|
nodes: {
|
|
63
|
+
codeBlock,
|
|
63
64
|
decisionItem,
|
|
64
65
|
emoji,
|
|
65
66
|
hardBreak,
|
|
@@ -121,6 +122,16 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
121
122
|
} else {
|
|
122
123
|
// This maintains both the selection (destination) and the slice (paste content).
|
|
123
124
|
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
|
|
127
|
+
//we manually shift the cursor to end of the codeblock
|
|
128
|
+
const currentPosition = tr.selection.$from;
|
|
129
|
+
const currentNode = currentPosition.parent;
|
|
130
|
+
if (currentNode.type === codeBlock) {
|
|
131
|
+
const endPosOfCodeBlock = currentPosition.end();
|
|
132
|
+
const endResolvedPosition = tr.doc.resolve(endPosOfCodeBlock);
|
|
133
|
+
tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
|
|
134
|
+
}
|
|
124
135
|
}
|
|
125
136
|
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
126
137
|
if (dispatch) {
|
package/dist/esm/handlers.js
CHANGED
|
@@ -65,6 +65,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
65
65
|
selection = state.tr.selection;
|
|
66
66
|
var codeMark = schema.marks.code,
|
|
67
67
|
_schema$nodes = schema.nodes,
|
|
68
|
+
codeBlock = _schema$nodes.codeBlock,
|
|
68
69
|
decisionItem = _schema$nodes.decisionItem,
|
|
69
70
|
emoji = _schema$nodes.emoji,
|
|
70
71
|
hardBreak = _schema$nodes.hardBreak,
|
|
@@ -124,6 +125,16 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
124
125
|
} else {
|
|
125
126
|
// This maintains both the selection (destination) and the slice (paste content).
|
|
126
127
|
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
|
|
130
|
+
//we manually shift the cursor to end of the codeblock
|
|
131
|
+
var currentPosition = tr.selection.$from;
|
|
132
|
+
var currentNode = currentPosition.parent;
|
|
133
|
+
if (currentNode.type === codeBlock) {
|
|
134
|
+
var endPosOfCodeBlock = currentPosition.end();
|
|
135
|
+
var endResolvedPosition = tr.doc.resolve(endPosOfCodeBlock);
|
|
136
|
+
tr.setSelection(new TextSelection(endResolvedPosition, endResolvedPosition));
|
|
137
|
+
}
|
|
127
138
|
}
|
|
128
139
|
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
129
140
|
if (dispatch) {
|