@atlaskit/editor-plugin-paste 13.1.2 → 13.2.1
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,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 13.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`75bc915c1fe98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/75bc915c1fe98) -
|
|
14
|
+
Hide paste actions when pasting agent mentions behind the platform_editor_agent_mentions
|
|
15
|
+
experiment. The paste plugin now exposes the source pasted slice so consumers can inspect the
|
|
16
|
+
paste handler content without depending on the last transaction step slice.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 13.1.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -253,7 +253,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
253
253
|
_insm.insm.endHeavyTask('paste');
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
|
-
var
|
|
256
|
+
var getLastReplaceStepSlice = function getLastReplaceStepSlice(tr) {
|
|
257
257
|
var slice;
|
|
258
258
|
var _iterator = _createForOfIteratorHelper(tr.steps),
|
|
259
259
|
_step;
|
|
@@ -338,7 +338,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
338
338
|
// we make sure to call paste options toolbar
|
|
339
339
|
// only for a valid paste action
|
|
340
340
|
if (isDocChanged) {
|
|
341
|
-
var pastedSlice =
|
|
341
|
+
var pastedSlice = getLastReplaceStepSlice(tr);
|
|
342
342
|
if (pastedSlice) {
|
|
343
343
|
var _input;
|
|
344
344
|
var pasteStartPos = state.selection.from;
|
|
@@ -353,7 +353,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
353
353
|
isPlainText: Boolean(isPlainText),
|
|
354
354
|
pastedSlice: pastedSlice,
|
|
355
355
|
pastedAt: Date.now(),
|
|
356
|
-
pasteSource: (0, _util.getPasteSource)(event)
|
|
356
|
+
pasteSource: (0, _util.getPasteSource)(event),
|
|
357
|
+
sourcePastedSlice: slice
|
|
357
358
|
};
|
|
358
359
|
tr.setMeta(_pluginFactory.pluginKey, {
|
|
359
360
|
type: _actions.PastePluginActionTypes.ON_PASTE,
|
|
@@ -221,7 +221,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
221
221
|
insm.endHeavyTask('paste');
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
|
-
const
|
|
224
|
+
const getLastReplaceStepSlice = tr => {
|
|
225
225
|
let slice;
|
|
226
226
|
for (const step of tr.steps) {
|
|
227
227
|
const stepSlice = extractSliceFromStep(step);
|
|
@@ -297,7 +297,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
297
297
|
// we make sure to call paste options toolbar
|
|
298
298
|
// only for a valid paste action
|
|
299
299
|
if (isDocChanged) {
|
|
300
|
-
const pastedSlice =
|
|
300
|
+
const pastedSlice = getLastReplaceStepSlice(tr);
|
|
301
301
|
if (pastedSlice) {
|
|
302
302
|
var _input;
|
|
303
303
|
const pasteStartPos = state.selection.from;
|
|
@@ -312,7 +312,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
312
312
|
isPlainText: Boolean(isPlainText),
|
|
313
313
|
pastedSlice,
|
|
314
314
|
pastedAt: Date.now(),
|
|
315
|
-
pasteSource: getPasteSource(event)
|
|
315
|
+
pasteSource: getPasteSource(event),
|
|
316
|
+
sourcePastedSlice: slice
|
|
316
317
|
};
|
|
317
318
|
tr.setMeta(stateKey, {
|
|
318
319
|
type: PastePluginActionTypes.ON_PASTE,
|
|
@@ -245,7 +245,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
245
245
|
insm.endHeavyTask('paste');
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
|
-
var
|
|
248
|
+
var getLastReplaceStepSlice = function getLastReplaceStepSlice(tr) {
|
|
249
249
|
var slice;
|
|
250
250
|
var _iterator = _createForOfIteratorHelper(tr.steps),
|
|
251
251
|
_step;
|
|
@@ -330,7 +330,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
330
330
|
// we make sure to call paste options toolbar
|
|
331
331
|
// only for a valid paste action
|
|
332
332
|
if (isDocChanged) {
|
|
333
|
-
var pastedSlice =
|
|
333
|
+
var pastedSlice = getLastReplaceStepSlice(tr);
|
|
334
334
|
if (pastedSlice) {
|
|
335
335
|
var _input;
|
|
336
336
|
var pasteStartPos = state.selection.from;
|
|
@@ -345,7 +345,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
345
345
|
isPlainText: Boolean(isPlainText),
|
|
346
346
|
pastedSlice: pastedSlice,
|
|
347
347
|
pastedAt: Date.now(),
|
|
348
|
-
pasteSource: getPasteSource(event)
|
|
348
|
+
pasteSource: getPasteSource(event),
|
|
349
|
+
sourcePastedSlice: slice
|
|
349
350
|
};
|
|
350
351
|
tr.setMeta(stateKey, {
|
|
351
352
|
type: PastePluginActionTypes.ON_PASTE,
|
|
@@ -42,10 +42,24 @@ export type LastContentPasted = {
|
|
|
42
42
|
isPlainText: boolean;
|
|
43
43
|
isShiftPressed: boolean;
|
|
44
44
|
pastedAt: number;
|
|
45
|
+
/**
|
|
46
|
+
* Backwards-compatible field for existing paste option consumers.
|
|
47
|
+
*
|
|
48
|
+
* This is the last slice extracted from a ReplaceStep or ReplaceAroundStep
|
|
49
|
+
* in the paste transaction. It is not necessarily the original clipboard
|
|
50
|
+
* slice or the full content inserted by the paste.
|
|
51
|
+
*/
|
|
45
52
|
pastedSlice: Slice;
|
|
46
53
|
pasteEndPos: number;
|
|
47
54
|
pasteSource: PasteSource;
|
|
48
55
|
pasteStartPos: number;
|
|
56
|
+
/**
|
|
57
|
+
* The paste handler slice captured before inspecting transaction steps.
|
|
58
|
+
* This has already passed through clipboard parsing and paste transforms,
|
|
59
|
+
* but does not depend on which ReplaceStep or ReplaceAroundStep happens to
|
|
60
|
+
* be last in the paste transaction.
|
|
61
|
+
*/
|
|
62
|
+
sourcePastedSlice?: Slice;
|
|
49
63
|
text?: string;
|
|
50
64
|
};
|
|
51
65
|
export type PastePluginOptions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "13.1
|
|
3
|
+
"version": "13.2.1",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"@atlaskit/media-common": "^14.1.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
43
43
|
"@atlaskit/prosemirror-history": "^1.0.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^112.0.0",
|
|
45
45
|
"@atlaskit/tokens": "^15.0.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"uuid": "^3.1.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^116.
|
|
51
|
+
"@atlaskit/editor-common": "^116.12.0",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-dom": "^18.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"type": "boolean"
|
|
124
124
|
},
|
|
125
125
|
"platform_editor_agent_mentions": {
|
|
126
|
-
"type": "
|
|
126
|
+
"type": "experiment"
|
|
127
127
|
},
|
|
128
128
|
"platform_editor_paste_renderer_analytics": {
|
|
129
129
|
"type": "boolean"
|