@atlaskit/editor-plugin-paste 1.0.6 → 1.0.7
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 +9 -0
- package/dist/cjs/handlers.js +6 -1
- package/dist/cjs/pm-plugins/main.js +27 -19
- package/dist/es2019/handlers.js +6 -1
- package/dist/es2019/pm-plugins/main.js +27 -19
- package/dist/esm/handlers.js +6 -1
- package/dist/esm/pm-plugins/main.js +27 -19
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 1.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#78224](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78224) [`6b4c9dd4ad34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b4c9dd4ad34) - ED-22219: adf-schema updated to 35.5.2
|
|
8
|
+
- [#76560](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76560) [`ecab0d093882`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ecab0d093882) - Fixed misplaced cursor positon when code block is pasted into extended nested expand
|
|
9
|
+
- [#78176](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78176) [`7482f69bb25f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7482f69bb25f) - ED-21833: Stop showing paste options toolbar for smart links
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 1.0.6
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/cjs/handlers.js
CHANGED
|
@@ -931,7 +931,12 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
931
931
|
// need to make sure the cursor position is is right after the panel, expand, or decisionList
|
|
932
932
|
// still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
|
|
933
933
|
var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
|
|
934
|
-
|
|
934
|
+
var lastChild = slice.content.lastChild;
|
|
935
|
+
var $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
936
|
+
var nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? _state.TextSelection.findFrom($nextPos, -1, true) : new _selection.GapCursorSelection($nextPos, _selection.Side.RIGHT);
|
|
937
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.place-cursor-inside-text-block') && nextSelection) {
|
|
938
|
+
tr.setSelection(nextSelection);
|
|
939
|
+
} else if ((0, _utils.insideTableCell)(state) && shouldUpdateCursorPosAfterPaste) {
|
|
935
940
|
var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
936
941
|
tr.setSelection(new _selection.GapCursorSelection(nextPos, _selection.Side.RIGHT));
|
|
937
942
|
}
|
|
@@ -207,7 +207,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
207
207
|
}
|
|
208
208
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
209
209
|
var dispatch = function dispatch(tr) {
|
|
210
|
-
var _state$doc$resolve$no
|
|
210
|
+
var _state$doc$resolve$no;
|
|
211
211
|
// https://product-fabric.atlassian.net/browse/ED-12633
|
|
212
212
|
// don't add closeHistory call if we're pasting a text inside placeholder text as we want the whole action
|
|
213
213
|
// to be atomic
|
|
@@ -238,28 +238,36 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
238
238
|
var _pluginInjectionApi$b;
|
|
239
239
|
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$b = pluginInjectionApi.betterTypeHistory) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.flagPasteEvent(tr);
|
|
240
240
|
}
|
|
241
|
+
var isDocChanged = tr.docChanged;
|
|
241
242
|
(0, _card.addLinkMetadata)(view.state.selection, tr, {
|
|
242
243
|
action: isPlainText ? _analytics.ACTION.PASTED_AS_PLAIN : _analytics.ACTION.PASTED,
|
|
243
244
|
inputMethod: _analytics.INPUT_METHOD.CLIPBOARD
|
|
244
245
|
});
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
246
|
+
|
|
247
|
+
// handleMacroAutoConvert dispatches twice
|
|
248
|
+
// we make sure to call paste options toolbar
|
|
249
|
+
// only for a valid paste action
|
|
250
|
+
if (isDocChanged) {
|
|
251
|
+
var _input;
|
|
252
|
+
var pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
|
|
253
|
+
var pasteEndPos = tr.selection.to;
|
|
254
|
+
var contentPasted = {
|
|
255
|
+
pasteStartPos: pasteStartPos,
|
|
256
|
+
pasteEndPos: pasteEndPos,
|
|
257
|
+
text: text,
|
|
258
|
+
isShiftPressed: Boolean(
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
|
+
view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
|
|
261
|
+
isPlainText: Boolean(isPlainText),
|
|
262
|
+
pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
|
|
263
|
+
pastedAt: Date.now(),
|
|
264
|
+
pasteSource: (0, _util.getPasteSource)(event)
|
|
265
|
+
};
|
|
266
|
+
tr.setMeta(_pluginFactory.pluginKey, {
|
|
267
|
+
type: _actions.PastePluginActionTypes.ON_PASTE,
|
|
268
|
+
contentPasted: contentPasted
|
|
269
|
+
});
|
|
270
|
+
}
|
|
263
271
|
view.dispatch(tr);
|
|
264
272
|
};
|
|
265
273
|
slice = (0, _handlers.handleParagraphBlockMarks)(state, slice);
|
package/dist/es2019/handlers.js
CHANGED
|
@@ -908,7 +908,12 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
908
908
|
// need to make sure the cursor position is is right after the panel, expand, or decisionList
|
|
909
909
|
// still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
|
|
910
910
|
const shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : (_slice$content$lastCh2 = _slice$content$lastCh.type) === null || _slice$content$lastCh2 === void 0 ? void 0 : _slice$content$lastCh2.name) || '');
|
|
911
|
-
|
|
911
|
+
const lastChild = slice.content.lastChild;
|
|
912
|
+
const $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
913
|
+
const nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? TextSelection.findFrom($nextPos, -1, true) : new GapCursorSelection($nextPos, Side.RIGHT);
|
|
914
|
+
if (getBooleanFF('platform.editor.place-cursor-inside-text-block') && nextSelection) {
|
|
915
|
+
tr.setSelection(nextSelection);
|
|
916
|
+
} else if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
|
|
912
917
|
const nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
913
918
|
tr.setSelection(new GapCursorSelection(nextPos, Side.RIGHT));
|
|
914
919
|
}
|
|
@@ -174,7 +174,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
174
174
|
}
|
|
175
175
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
176
176
|
const dispatch = tr => {
|
|
177
|
-
var _state$doc$resolve$no
|
|
177
|
+
var _state$doc$resolve$no;
|
|
178
178
|
// https://product-fabric.atlassian.net/browse/ED-12633
|
|
179
179
|
// don't add closeHistory call if we're pasting a text inside placeholder text as we want the whole action
|
|
180
180
|
// to be atomic
|
|
@@ -207,28 +207,36 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
207
207
|
var _pluginInjectionApi$b;
|
|
208
208
|
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$b = pluginInjectionApi.betterTypeHistory) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.flagPasteEvent(tr);
|
|
209
209
|
}
|
|
210
|
+
const isDocChanged = tr.docChanged;
|
|
210
211
|
addLinkMetadata(view.state.selection, tr, {
|
|
211
212
|
action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
|
|
212
213
|
inputMethod: INPUT_METHOD.CLIPBOARD
|
|
213
214
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
215
|
+
|
|
216
|
+
// handleMacroAutoConvert dispatches twice
|
|
217
|
+
// we make sure to call paste options toolbar
|
|
218
|
+
// only for a valid paste action
|
|
219
|
+
if (isDocChanged) {
|
|
220
|
+
var _input;
|
|
221
|
+
const pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
|
|
222
|
+
const pasteEndPos = tr.selection.to;
|
|
223
|
+
const contentPasted = {
|
|
224
|
+
pasteStartPos,
|
|
225
|
+
pasteEndPos,
|
|
226
|
+
text,
|
|
227
|
+
isShiftPressed: Boolean(
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
229
|
+
view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
|
|
230
|
+
isPlainText: Boolean(isPlainText),
|
|
231
|
+
pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
|
|
232
|
+
pastedAt: Date.now(),
|
|
233
|
+
pasteSource: getPasteSource(event)
|
|
234
|
+
};
|
|
235
|
+
tr.setMeta(stateKey, {
|
|
236
|
+
type: PastePluginActionTypes.ON_PASTE,
|
|
237
|
+
contentPasted
|
|
238
|
+
});
|
|
239
|
+
}
|
|
232
240
|
view.dispatch(tr);
|
|
233
241
|
};
|
|
234
242
|
slice = handleParagraphBlockMarks(state, slice);
|
package/dist/esm/handlers.js
CHANGED
|
@@ -909,7 +909,12 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
909
909
|
// need to make sure the cursor position is is right after the panel, expand, or decisionList
|
|
910
910
|
// still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
|
|
911
911
|
var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
|
|
912
|
-
|
|
912
|
+
var lastChild = slice.content.lastChild;
|
|
913
|
+
var $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
914
|
+
var nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? TextSelection.findFrom($nextPos, -1, true) : new GapCursorSelection($nextPos, Side.RIGHT);
|
|
915
|
+
if (getBooleanFF('platform.editor.place-cursor-inside-text-block') && nextSelection) {
|
|
916
|
+
tr.setSelection(nextSelection);
|
|
917
|
+
} else if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
|
|
913
918
|
var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
914
919
|
tr.setSelection(new GapCursorSelection(nextPos, Side.RIGHT));
|
|
915
920
|
}
|
|
@@ -194,7 +194,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
194
194
|
}
|
|
195
195
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
196
196
|
var dispatch = function dispatch(tr) {
|
|
197
|
-
var _state$doc$resolve$no
|
|
197
|
+
var _state$doc$resolve$no;
|
|
198
198
|
// https://product-fabric.atlassian.net/browse/ED-12633
|
|
199
199
|
// don't add closeHistory call if we're pasting a text inside placeholder text as we want the whole action
|
|
200
200
|
// to be atomic
|
|
@@ -225,28 +225,36 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
225
225
|
var _pluginInjectionApi$b;
|
|
226
226
|
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$b = pluginInjectionApi.betterTypeHistory) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.flagPasteEvent(tr);
|
|
227
227
|
}
|
|
228
|
+
var isDocChanged = tr.docChanged;
|
|
228
229
|
addLinkMetadata(view.state.selection, tr, {
|
|
229
230
|
action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
|
|
230
231
|
inputMethod: INPUT_METHOD.CLIPBOARD
|
|
231
232
|
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
233
|
+
|
|
234
|
+
// handleMacroAutoConvert dispatches twice
|
|
235
|
+
// we make sure to call paste options toolbar
|
|
236
|
+
// only for a valid paste action
|
|
237
|
+
if (isDocChanged) {
|
|
238
|
+
var _input;
|
|
239
|
+
var pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
|
|
240
|
+
var pasteEndPos = tr.selection.to;
|
|
241
|
+
var contentPasted = {
|
|
242
|
+
pasteStartPos: pasteStartPos,
|
|
243
|
+
pasteEndPos: pasteEndPos,
|
|
244
|
+
text: text,
|
|
245
|
+
isShiftPressed: Boolean(
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
|
+
view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
|
|
248
|
+
isPlainText: Boolean(isPlainText),
|
|
249
|
+
pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
|
|
250
|
+
pastedAt: Date.now(),
|
|
251
|
+
pasteSource: getPasteSource(event)
|
|
252
|
+
};
|
|
253
|
+
tr.setMeta(stateKey, {
|
|
254
|
+
type: PastePluginActionTypes.ON_PASTE,
|
|
255
|
+
contentPasted: contentPasted
|
|
256
|
+
});
|
|
257
|
+
}
|
|
250
258
|
view.dispatch(tr);
|
|
251
259
|
};
|
|
252
260
|
slice = handleParagraphBlockMarks(state, slice);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^78.
|
|
36
|
+
"@atlaskit/editor-common": "^78.10.0",
|
|
37
37
|
"@atlaskit/editor-markdown-transformer": "^5.4.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-annotation": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-better-type-history": "^1.0.0",
|
|
41
|
-
"@atlaskit/editor-plugin-card": "^1.
|
|
41
|
+
"@atlaskit/editor-plugin-card": "^1.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-list": "^3.1.0",
|
|
44
|
-
"@atlaskit/editor-plugin-media": "^1.
|
|
44
|
+
"@atlaskit/editor-plugin-media": "^1.6.0",
|
|
45
45
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
46
46
|
"@atlaskit/editor-tables": "^2.5.0",
|
|
47
47
|
"@atlaskit/media-client": "^26.2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@af/visual-regression": "*",
|
|
59
|
-
"@atlaskit/adf-schema": "^35.5.
|
|
59
|
+
"@atlaskit/adf-schema": "^35.5.2",
|
|
60
60
|
"@atlaskit/editor-plugin-block-type": "^3.0.0",
|
|
61
61
|
"@atlaskit/editor-plugin-history": "^1.0.0",
|
|
62
62
|
"@atlaskit/editor-plugin-type-ahead": "^1.0.0",
|
|
@@ -128,6 +128,9 @@
|
|
|
128
128
|
},
|
|
129
129
|
"platform.editor.handle-paste-for-action-in-panel": {
|
|
130
130
|
"type": "boolean"
|
|
131
|
+
},
|
|
132
|
+
"platform.editor.place-cursor-inside-text-block": {
|
|
133
|
+
"type": "boolean"
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
}
|