@atlaskit/editor-plugin-paste 2.0.15 → 2.0.17
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 +19 -0
- package/dist/cjs/pm-plugins/main.js +6 -6
- package/dist/cjs/pm-plugins/media.js +5 -1
- package/dist/es2019/pm-plugins/main.js +6 -6
- package/dist/es2019/pm-plugins/media.js +5 -2
- package/dist/esm/pm-plugins/main.js +6 -6
- package/dist/esm/pm-plugins/media.js +5 -2
- package/dist/types/pm-plugins/media.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/media.d.ts +3 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 2.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#102478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102478)
|
|
8
|
+
[`e14c5f9596217`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e14c5f9596217) -
|
|
9
|
+
Calling media trackMediaPaste command to enable the tracking of out of editor media paste to
|
|
10
|
+
enable deep copy when media copy scope is set to "editor"
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 2.0.16
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#102083](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102083)
|
|
18
|
+
[`0b462924a7c7a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0b462924a7c7a) -
|
|
19
|
+
[ux] ED-26221 Reverting changes to nested table paste behaviour for panels in tables as it caused
|
|
20
|
+
some unexpected issues with cell copy/paste
|
|
21
|
+
|
|
3
22
|
## 2.0.15
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -328,11 +328,6 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
328
328
|
// @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
|
|
329
329
|
slice.openStart = 1;
|
|
330
330
|
}
|
|
331
|
-
|
|
332
|
-
// handle paste of nested tables to ensure nesting limits are respected
|
|
333
|
-
if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
331
|
if ((0, _analytics2.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics.PasteTypes.plain : _analytics.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
337
332
|
return true;
|
|
338
333
|
}
|
|
@@ -406,6 +401,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
406
401
|
return true;
|
|
407
402
|
}
|
|
408
403
|
|
|
404
|
+
// handle paste of nested tables to ensure nesting limits are respected
|
|
405
|
+
if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
409
|
// handle the case when copy content from a table cell inside bodied extension
|
|
410
410
|
if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
|
|
411
411
|
return true;
|
|
@@ -475,7 +475,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
475
475
|
}
|
|
476
476
|
slice = (0, _transforms.transformSingleLineCodeBlockToCodeMark)(slice, schema);
|
|
477
477
|
slice = (0, _media.transformSliceToCorrectMediaWrapper)(slice, schema);
|
|
478
|
-
slice = (0, _media.transformSliceToMediaSingleWithNewExperience)(slice, schema);
|
|
478
|
+
slice = (0, _media.transformSliceToMediaSingleWithNewExperience)(slice, schema, pluginInjectionApi);
|
|
479
479
|
slice = (0, _transforms.transformSliceToDecisionList)(slice, schema);
|
|
480
480
|
|
|
481
481
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
@@ -83,7 +83,7 @@ var transformSliceToCorrectMediaWrapper = exports.transformSliceToCorrectMediaWr
|
|
|
83
83
|
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
84
84
|
*
|
|
85
85
|
*/
|
|
86
|
-
var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema) {
|
|
86
|
+
var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema, api) {
|
|
87
87
|
var _schema$nodes3 = schema.nodes,
|
|
88
88
|
mediaInline = _schema$nodes3.mediaInline,
|
|
89
89
|
mediaSingle = _schema$nodes3.mediaSingle,
|
|
@@ -107,12 +107,16 @@ var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMedia
|
|
|
107
107
|
return (0, _utils.mapSlice)(newSlice, function (node) {
|
|
108
108
|
var __mediaTraceId = (0, _mediaCommon.getRandomHex)(8);
|
|
109
109
|
if (node.type === media) {
|
|
110
|
+
var _api$media;
|
|
111
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.commands.trackMediaPaste(node.attrs));
|
|
110
112
|
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
111
113
|
__external: node.attrs.type === 'external',
|
|
112
114
|
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
113
115
|
}), node.content, node.marks);
|
|
114
116
|
}
|
|
115
117
|
if (node.type.name === 'mediaInline') {
|
|
118
|
+
var _api$media2;
|
|
119
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media2 = api.media) === null || _api$media2 === void 0 ? void 0 : _api$media2.commands.trackMediaPaste(node.attrs));
|
|
116
120
|
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
117
121
|
__mediaTraceId: __mediaTraceId
|
|
118
122
|
}), node.content, node.marks);
|
|
@@ -302,11 +302,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
302
302
|
// @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
|
|
303
303
|
slice.openStart = 1;
|
|
304
304
|
}
|
|
305
|
-
|
|
306
|
-
// handle paste of nested tables to ensure nesting limits are respected
|
|
307
|
-
if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
|
|
308
|
-
return true;
|
|
309
|
-
}
|
|
310
305
|
if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
311
306
|
return true;
|
|
312
307
|
}
|
|
@@ -382,6 +377,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
382
377
|
return true;
|
|
383
378
|
}
|
|
384
379
|
|
|
380
|
+
// handle paste of nested tables to ensure nesting limits are respected
|
|
381
|
+
if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
385
|
// handle the case when copy content from a table cell inside bodied extension
|
|
386
386
|
if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
|
|
387
387
|
return true;
|
|
@@ -449,7 +449,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
449
449
|
}
|
|
450
450
|
slice = transformSingleLineCodeBlockToCodeMark(slice, schema);
|
|
451
451
|
slice = transformSliceToCorrectMediaWrapper(slice, schema);
|
|
452
|
-
slice = transformSliceToMediaSingleWithNewExperience(slice, schema);
|
|
452
|
+
slice = transformSliceToMediaSingleWithNewExperience(slice, schema, pluginInjectionApi);
|
|
453
453
|
slice = transformSliceToDecisionList(slice, schema);
|
|
454
454
|
|
|
455
455
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
@@ -3,7 +3,6 @@ import { mapSlice, removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlask
|
|
|
3
3
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Ensure correct layout in nested mode
|
|
9
8
|
*
|
|
@@ -77,7 +76,7 @@ export const transformSliceToCorrectMediaWrapper = (slice, schema) => {
|
|
|
77
76
|
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
78
77
|
*
|
|
79
78
|
*/
|
|
80
|
-
export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
|
|
79
|
+
export const transformSliceToMediaSingleWithNewExperience = (slice, schema, api) => {
|
|
81
80
|
const {
|
|
82
81
|
mediaInline,
|
|
83
82
|
mediaSingle,
|
|
@@ -102,6 +101,8 @@ export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
|
|
|
102
101
|
return mapSlice(newSlice, node => {
|
|
103
102
|
const __mediaTraceId = getRandomHex(8);
|
|
104
103
|
if (node.type === media) {
|
|
104
|
+
var _api$media;
|
|
105
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.commands.trackMediaPaste(node.attrs));
|
|
105
106
|
return media.createChecked({
|
|
106
107
|
...node.attrs,
|
|
107
108
|
__external: node.attrs.type === 'external',
|
|
@@ -109,6 +110,8 @@ export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
|
|
|
109
110
|
}, node.content, node.marks);
|
|
110
111
|
}
|
|
111
112
|
if (node.type.name === 'mediaInline') {
|
|
113
|
+
var _api$media2;
|
|
114
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$media2 = api.media) === null || _api$media2 === void 0 ? void 0 : _api$media2.commands.trackMediaPaste(node.attrs));
|
|
112
115
|
return mediaInline.createChecked({
|
|
113
116
|
...node.attrs,
|
|
114
117
|
__mediaTraceId
|
|
@@ -320,11 +320,6 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
320
320
|
// @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
|
|
321
321
|
slice.openStart = 1;
|
|
322
322
|
}
|
|
323
|
-
|
|
324
|
-
// handle paste of nested tables to ensure nesting limits are respected
|
|
325
|
-
if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
|
|
326
|
-
return true;
|
|
327
|
-
}
|
|
328
323
|
if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
329
324
|
return true;
|
|
330
325
|
}
|
|
@@ -398,6 +393,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
398
393
|
return true;
|
|
399
394
|
}
|
|
400
395
|
|
|
396
|
+
// handle paste of nested tables to ensure nesting limits are respected
|
|
397
|
+
if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
401
|
// handle the case when copy content from a table cell inside bodied extension
|
|
402
402
|
if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
|
|
403
403
|
return true;
|
|
@@ -467,7 +467,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
467
467
|
}
|
|
468
468
|
slice = transformSingleLineCodeBlockToCodeMark(slice, schema);
|
|
469
469
|
slice = transformSliceToCorrectMediaWrapper(slice, schema);
|
|
470
|
-
slice = transformSliceToMediaSingleWithNewExperience(slice, schema);
|
|
470
|
+
slice = transformSliceToMediaSingleWithNewExperience(slice, schema, pluginInjectionApi);
|
|
471
471
|
slice = transformSliceToDecisionList(slice, schema);
|
|
472
472
|
|
|
473
473
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
@@ -6,7 +6,6 @@ import { mapSlice, removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlask
|
|
|
6
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* Ensure correct layout in nested mode
|
|
12
11
|
*
|
|
@@ -75,7 +74,7 @@ export var transformSliceToCorrectMediaWrapper = function transformSliceToCorrec
|
|
|
75
74
|
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
76
75
|
*
|
|
77
76
|
*/
|
|
78
|
-
export var transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema) {
|
|
77
|
+
export var transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema, api) {
|
|
79
78
|
var _schema$nodes3 = schema.nodes,
|
|
80
79
|
mediaInline = _schema$nodes3.mediaInline,
|
|
81
80
|
mediaSingle = _schema$nodes3.mediaSingle,
|
|
@@ -99,12 +98,16 @@ export var transformSliceToMediaSingleWithNewExperience = function transformSlic
|
|
|
99
98
|
return mapSlice(newSlice, function (node) {
|
|
100
99
|
var __mediaTraceId = getRandomHex(8);
|
|
101
100
|
if (node.type === media) {
|
|
101
|
+
var _api$media;
|
|
102
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.commands.trackMediaPaste(node.attrs));
|
|
102
103
|
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
103
104
|
__external: node.attrs.type === 'external',
|
|
104
105
|
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
105
106
|
}), node.content, node.marks);
|
|
106
107
|
}
|
|
107
108
|
if (node.type.name === 'mediaInline') {
|
|
109
|
+
var _api$media2;
|
|
110
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media2 = api.media) === null || _api$media2 === void 0 ? void 0 : _api$media2.commands.trackMediaPaste(node.attrs));
|
|
108
111
|
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
109
112
|
__mediaTraceId: __mediaTraceId
|
|
110
113
|
}), node.content, node.marks);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { PastePlugin } from '../pastePluginType';
|
|
3
5
|
/**
|
|
4
6
|
* Ensure correct layout in nested mode
|
|
5
7
|
*
|
|
@@ -13,7 +15,7 @@ export declare const transformSliceToCorrectMediaWrapper: (slice: Slice, schema:
|
|
|
13
15
|
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
14
16
|
*
|
|
15
17
|
*/
|
|
16
|
-
export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema) => Slice;
|
|
18
|
+
export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
|
|
17
19
|
/**
|
|
18
20
|
* Given a html string, we attempt to hoist any nested `<img>` tags,
|
|
19
21
|
* not directly wrapped by a `<div>` as ProseMirror no-op's
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { PastePlugin } from '../pastePluginType';
|
|
3
5
|
/**
|
|
4
6
|
* Ensure correct layout in nested mode
|
|
5
7
|
*
|
|
@@ -13,7 +15,7 @@ export declare const transformSliceToCorrectMediaWrapper: (slice: Slice, schema:
|
|
|
13
15
|
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
14
16
|
*
|
|
15
17
|
*/
|
|
16
|
-
export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema) => Slice;
|
|
18
|
+
export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
|
|
17
19
|
/**
|
|
18
20
|
* Given a html string, we attempt to hoist any nested `<img>` tags,
|
|
19
21
|
* not directly wrapped by a `<div>` as ProseMirror no-op's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/
|
|
34
|
+
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
+
"@atlaskit/editor-common": "^99.2.0",
|
|
35
36
|
"@atlaskit/editor-markdown-transformer": "^5.13.0",
|
|
36
37
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
38
|
"@atlaskit/editor-plugin-annotation": "^1.26.0",
|
|
@@ -40,13 +41,13 @@
|
|
|
40
41
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
41
42
|
"@atlaskit/editor-plugin-list": "^3.9.0",
|
|
42
43
|
"@atlaskit/editor-plugin-media": "^1.44.0",
|
|
43
|
-
"@atlaskit/editor-plugin-mentions": "^2.
|
|
44
|
+
"@atlaskit/editor-plugin-mentions": "^2.12.0",
|
|
44
45
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
45
46
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
46
47
|
"@atlaskit/media-client": "^29.0.0",
|
|
47
48
|
"@atlaskit/media-common": "^11.7.0",
|
|
48
49
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^2.35.0",
|
|
50
51
|
"@babel/runtime": "^7.0.0",
|
|
51
52
|
"lodash": "^4.17.21",
|
|
52
53
|
"uuid": "^3.1.0"
|
|
@@ -57,7 +58,6 @@
|
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@af/visual-regression": "*",
|
|
60
|
-
"@atlaskit/adf-schema": "^46.1.0",
|
|
61
61
|
"@atlaskit/editor-plugin-block-type": "^4.1.0",
|
|
62
62
|
"@atlaskit/editor-plugin-history": "^1.3.0",
|
|
63
63
|
"@atlaskit/editor-plugin-type-ahead": "^1.11.0",
|