@atlaskit/editor-plugin-paste 2.0.1 → 2.0.3
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 +18 -0
- package/dist/cjs/plugins/media.js +2 -2
- package/dist/cjs/pm-plugins/main.js +18 -22
- package/dist/es2019/plugins/media.js +2 -2
- package/dist/es2019/pm-plugins/main.js +17 -21
- package/dist/esm/plugins/media.js +2 -2
- package/dist/esm/pm-plugins/main.js +18 -22
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 2.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#162388](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162388)
|
|
8
|
+
[`2ec86d6f98873`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2ec86d6f98873) -
|
|
9
|
+
hard-code pasteTracking to always be enabled :)
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#158691](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/158691)
|
|
17
|
+
[`70ef661bbbb4d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/70ef661bbbb4d) -
|
|
18
|
+
Update feature flag to gate
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.0.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -33,7 +33,7 @@ function transformSliceForMedia(slice, schema) {
|
|
|
33
33
|
var newSlice = slice;
|
|
34
34
|
if ((0, _utils2.hasParentNodeOfType)([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
35
35
|
newSlice = (0, _utils.mapSlice)(newSlice, function (node) {
|
|
36
|
-
var extendedOrLegacyAttrs = (0, _platformFeatureFlags.fg)('
|
|
36
|
+
var extendedOrLegacyAttrs = (0, _platformFeatureFlags.fg)('platform_editor_media_extended_resize_experience') ? {
|
|
37
37
|
layout: node.attrs.layout,
|
|
38
38
|
widthType: node.attrs.widthType,
|
|
39
39
|
width: node.attrs.width
|
|
@@ -96,7 +96,7 @@ var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMedia
|
|
|
96
96
|
// The duplication is in the following file:
|
|
97
97
|
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
98
98
|
if (node.type === mediaSingle) {
|
|
99
|
-
return (0, _platformFeatureFlags.fg)('
|
|
99
|
+
return (0, _platformFeatureFlags.fg)('platform_editor_media_extended_resize_experience') ? mediaSingle.createChecked({
|
|
100
100
|
width: node.attrs.width || _mediaSingle.DEFAULT_IMAGE_WIDTH,
|
|
101
101
|
widthType: node.attrs.widthType || 'pixel',
|
|
102
102
|
layout: node.attrs.layout
|
|
@@ -135,7 +135,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
138
|
-
var _text,
|
|
138
|
+
var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
|
|
139
139
|
var event = rawEvent;
|
|
140
140
|
if (!event.clipboardData) {
|
|
141
141
|
return false;
|
|
@@ -189,26 +189,22 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
189
189
|
event.stopPropagation();
|
|
190
190
|
}
|
|
191
191
|
var state = view.state;
|
|
192
|
-
var
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
(0,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
duration: duration,
|
|
204
|
-
content: content,
|
|
205
|
-
distortedDuration: distortedDuration
|
|
206
|
-
});
|
|
207
|
-
if (payload) {
|
|
208
|
-
dispatchAnalyticsEvent(payload);
|
|
209
|
-
}
|
|
192
|
+
var content = (0, _analytics2.getContentNodeTypes)(slice.content);
|
|
193
|
+
var pasteId = (0, _uuid.default)();
|
|
194
|
+
var measureName = "".concat(PASTE, "_").concat(pasteId);
|
|
195
|
+
(0, _measureRender.measureRender)(measureName, function (_ref) {
|
|
196
|
+
var duration = _ref.duration,
|
|
197
|
+
distortedDuration = _ref.distortedDuration;
|
|
198
|
+
var payload = (0, _analytics2.createPasteMeasurePayload)({
|
|
199
|
+
view: view,
|
|
200
|
+
duration: duration,
|
|
201
|
+
content: content,
|
|
202
|
+
distortedDuration: distortedDuration
|
|
210
203
|
});
|
|
211
|
-
|
|
204
|
+
if (payload) {
|
|
205
|
+
dispatchAnalyticsEvent(payload);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
212
208
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
213
209
|
var dispatch = function dispatch(tr) {
|
|
214
210
|
var _state$doc$resolve$no;
|
|
@@ -405,8 +401,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
405
401
|
// remove annotation marks from the pasted data if they are not present in the document
|
|
406
402
|
// for the cases when they are pasted from external pages
|
|
407
403
|
if (slice.content.size && (0, _utils.containsAnyAnnotations)(slice, state)) {
|
|
408
|
-
var _pluginInjectionApi$
|
|
409
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
404
|
+
var _pluginInjectionApi$a2;
|
|
405
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
|
|
410
406
|
}
|
|
411
407
|
|
|
412
408
|
// ED-4732
|
|
@@ -23,7 +23,7 @@ export function transformSliceForMedia(slice, schema) {
|
|
|
23
23
|
let newSlice = slice;
|
|
24
24
|
if (hasParentNodeOfType([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
25
25
|
newSlice = mapSlice(newSlice, node => {
|
|
26
|
-
const extendedOrLegacyAttrs = fg('
|
|
26
|
+
const extendedOrLegacyAttrs = fg('platform_editor_media_extended_resize_experience') ? {
|
|
27
27
|
layout: node.attrs.layout,
|
|
28
28
|
widthType: node.attrs.widthType,
|
|
29
29
|
width: node.attrs.width
|
|
@@ -91,7 +91,7 @@ export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
|
|
|
91
91
|
// The duplication is in the following file:
|
|
92
92
|
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
93
93
|
if (node.type === mediaSingle) {
|
|
94
|
-
return fg('
|
|
94
|
+
return fg('platform_editor_media_extended_resize_experience') ? mediaSingle.createChecked({
|
|
95
95
|
width: node.attrs.width || DEFAULT_IMAGE_WIDTH,
|
|
96
96
|
widthType: node.attrs.widthType || 'pixel',
|
|
97
97
|
layout: node.attrs.layout
|
|
@@ -99,7 +99,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
handlePaste(view, rawEvent, slice) {
|
|
102
|
-
var _text,
|
|
102
|
+
var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
|
|
103
103
|
const event = rawEvent;
|
|
104
104
|
if (!event.clipboardData) {
|
|
105
105
|
return false;
|
|
@@ -155,27 +155,23 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
155
155
|
const {
|
|
156
156
|
state
|
|
157
157
|
} = view;
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
const content = getContentNodeTypes(slice.content);
|
|
159
|
+
const pasteId = uuid();
|
|
160
|
+
const measureName = `${PASTE}_${pasteId}`;
|
|
161
|
+
measureRender(measureName, ({
|
|
162
|
+
duration,
|
|
163
|
+
distortedDuration
|
|
164
|
+
}) => {
|
|
165
|
+
const payload = createPasteMeasurePayload({
|
|
166
|
+
view,
|
|
165
167
|
duration,
|
|
168
|
+
content,
|
|
166
169
|
distortedDuration
|
|
167
|
-
}) => {
|
|
168
|
-
const payload = createPasteMeasurePayload({
|
|
169
|
-
view,
|
|
170
|
-
duration,
|
|
171
|
-
content,
|
|
172
|
-
distortedDuration
|
|
173
|
-
});
|
|
174
|
-
if (payload) {
|
|
175
|
-
dispatchAnalyticsEvent(payload);
|
|
176
|
-
}
|
|
177
170
|
});
|
|
178
|
-
|
|
171
|
+
if (payload) {
|
|
172
|
+
dispatchAnalyticsEvent(payload);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
179
175
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
180
176
|
const dispatch = tr => {
|
|
181
177
|
var _state$doc$resolve$no;
|
|
@@ -376,8 +372,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
376
372
|
// remove annotation marks from the pasted data if they are not present in the document
|
|
377
373
|
// for the cases when they are pasted from external pages
|
|
378
374
|
if (slice.content.size && containsAnyAnnotations(slice, state)) {
|
|
379
|
-
var _pluginInjectionApi$
|
|
380
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
375
|
+
var _pluginInjectionApi$a2;
|
|
376
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
|
|
381
377
|
}
|
|
382
378
|
|
|
383
379
|
// ED-4732
|
|
@@ -25,7 +25,7 @@ export function transformSliceForMedia(slice, schema) {
|
|
|
25
25
|
var newSlice = slice;
|
|
26
26
|
if (hasParentNodeOfType([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
27
27
|
newSlice = mapSlice(newSlice, function (node) {
|
|
28
|
-
var extendedOrLegacyAttrs = fg('
|
|
28
|
+
var extendedOrLegacyAttrs = fg('platform_editor_media_extended_resize_experience') ? {
|
|
29
29
|
layout: node.attrs.layout,
|
|
30
30
|
widthType: node.attrs.widthType,
|
|
31
31
|
width: node.attrs.width
|
|
@@ -88,7 +88,7 @@ export var transformSliceToMediaSingleWithNewExperience = function transformSlic
|
|
|
88
88
|
// The duplication is in the following file:
|
|
89
89
|
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
90
90
|
if (node.type === mediaSingle) {
|
|
91
|
-
return fg('
|
|
91
|
+
return fg('platform_editor_media_extended_resize_experience') ? mediaSingle.createChecked({
|
|
92
92
|
width: node.attrs.width || DEFAULT_IMAGE_WIDTH,
|
|
93
93
|
widthType: node.attrs.widthType || 'pixel',
|
|
94
94
|
layout: node.attrs.layout
|
|
@@ -122,7 +122,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
125
|
-
var _text,
|
|
125
|
+
var _text, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m, _schema$nodes$table;
|
|
126
126
|
var event = rawEvent;
|
|
127
127
|
if (!event.clipboardData) {
|
|
128
128
|
return false;
|
|
@@ -176,26 +176,22 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
176
176
|
event.stopPropagation();
|
|
177
177
|
}
|
|
178
178
|
var state = view.state;
|
|
179
|
-
var
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
duration: duration,
|
|
191
|
-
content: content,
|
|
192
|
-
distortedDuration: distortedDuration
|
|
193
|
-
});
|
|
194
|
-
if (payload) {
|
|
195
|
-
dispatchAnalyticsEvent(payload);
|
|
196
|
-
}
|
|
179
|
+
var content = getContentNodeTypes(slice.content);
|
|
180
|
+
var pasteId = uuid();
|
|
181
|
+
var measureName = "".concat(PASTE, "_").concat(pasteId);
|
|
182
|
+
measureRender(measureName, function (_ref) {
|
|
183
|
+
var duration = _ref.duration,
|
|
184
|
+
distortedDuration = _ref.distortedDuration;
|
|
185
|
+
var payload = createPasteMeasurePayload({
|
|
186
|
+
view: view,
|
|
187
|
+
duration: duration,
|
|
188
|
+
content: content,
|
|
189
|
+
distortedDuration: distortedDuration
|
|
197
190
|
});
|
|
198
|
-
|
|
191
|
+
if (payload) {
|
|
192
|
+
dispatchAnalyticsEvent(payload);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
199
195
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
200
196
|
var dispatch = function dispatch(tr) {
|
|
201
197
|
var _state$doc$resolve$no;
|
|
@@ -392,8 +388,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
392
388
|
// remove annotation marks from the pasted data if they are not present in the document
|
|
393
389
|
// for the cases when they are pasted from external pages
|
|
394
390
|
if (slice.content.size && containsAnyAnnotations(slice, state)) {
|
|
395
|
-
var _pluginInjectionApi$
|
|
396
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
391
|
+
var _pluginInjectionApi$a2;
|
|
392
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.annotation) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.stripNonExistingAnnotations(slice, state);
|
|
397
393
|
}
|
|
398
394
|
|
|
399
395
|
// ED-4732
|
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.3",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^94.
|
|
34
|
+
"@atlaskit/editor-common": "^94.17.0",
|
|
35
35
|
"@atlaskit/editor-markdown-transformer": "^5.13.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-annotation": "^1.23.0",
|
|
38
38
|
"@atlaskit/editor-plugin-better-type-history": "^1.9.0",
|
|
39
|
-
"@atlaskit/editor-plugin-card": "^4.
|
|
39
|
+
"@atlaskit/editor-plugin-card": "^4.4.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-list": "^3.9.0",
|
|
42
|
-
"@atlaskit/editor-plugin-media": "^1.
|
|
42
|
+
"@atlaskit/editor-plugin-media": "^1.39.0",
|
|
43
43
|
"@atlaskit/editor-plugin-mentions": "^2.10.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
46
|
-
"@atlaskit/media-client": "^28.
|
|
46
|
+
"@atlaskit/media-client": "^28.2.0",
|
|
47
47
|
"@atlaskit/media-common": "^11.7.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^2.12.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"uuid": "^3.1.0"
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
]
|
|
110
110
|
},
|
|
111
111
|
"platform-feature-flags": {
|
|
112
|
-
"
|
|
112
|
+
"platform_editor_media_extended_resize_experience": {
|
|
113
113
|
"type": "boolean"
|
|
114
114
|
},
|
|
115
115
|
"editor_inline_comments_paste_insert_nodes": {
|