@atlaskit/editor-plugin-paste 2.0.2 → 2.0.4
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/commands.js +1 -2
- package/dist/cjs/pm-plugins/main.js +18 -22
- package/dist/es2019/commands.js +1 -2
- package/dist/es2019/pm-plugins/main.js +17 -21
- package/dist/esm/commands.js +1 -2
- package/dist/esm/pm-plugins/main.js +18 -22
- package/package.json +7 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#166663](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166663)
|
|
8
|
+
[`339439561ae6d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/339439561ae6d) -
|
|
9
|
+
Cleanup feature gate for CONFCLOUD-79708
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.0.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#162388](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162388)
|
|
17
|
+
[`2ec86d6f98873`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2ec86d6f98873) -
|
|
18
|
+
hard-code pasteTracking to always be enabled :)
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/commands.js
CHANGED
|
@@ -11,7 +11,6 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
11
11
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _actions = require("./actions");
|
|
16
15
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
17
16
|
/**
|
|
@@ -132,7 +131,7 @@ var extractListFromParagraph = exports.extractListFromParagraph = function extra
|
|
|
132
131
|
if (!listMatch ||
|
|
133
132
|
// CONFCLOUD-79708: If we are inside a list - let's not try to upgrade list as it resolves
|
|
134
133
|
// to invalid content
|
|
135
|
-
isListItem(parent, schema)
|
|
134
|
+
isListItem(parent, schema)) {
|
|
136
135
|
// if there is not list match return as is
|
|
137
136
|
paragraphParts.push(line);
|
|
138
137
|
continue;
|
|
@@ -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
|
package/dist/es2019/commands.js
CHANGED
|
@@ -2,7 +2,6 @@ import { isListNode, mapChildren, mapSlice } from '@atlaskit/editor-common/utils
|
|
|
2
2
|
import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { PastePluginActionTypes as ActionTypes } from './actions';
|
|
7
6
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
8
7
|
|
|
@@ -120,7 +119,7 @@ export const extractListFromParagraph = (node, parent, schema) => {
|
|
|
120
119
|
if (!listMatch ||
|
|
121
120
|
// CONFCLOUD-79708: If we are inside a list - let's not try to upgrade list as it resolves
|
|
122
121
|
// to invalid content
|
|
123
|
-
isListItem(parent, schema)
|
|
122
|
+
isListItem(parent, schema)) {
|
|
124
123
|
// if there is not list match return as is
|
|
125
124
|
paragraphParts.push(line);
|
|
126
125
|
continue;
|
|
@@ -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
|
package/dist/esm/commands.js
CHANGED
|
@@ -4,7 +4,6 @@ import { isListNode, mapChildren, mapSlice } from '@atlaskit/editor-common/utils
|
|
|
4
4
|
import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { PastePluginActionTypes as ActionTypes } from './actions';
|
|
9
8
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
10
9
|
|
|
@@ -126,7 +125,7 @@ export var extractListFromParagraph = function extractListFromParagraph(node, pa
|
|
|
126
125
|
if (!listMatch ||
|
|
127
126
|
// CONFCLOUD-79708: If we are inside a list - let's not try to upgrade list as it resolves
|
|
128
127
|
// to invalid content
|
|
129
|
-
isListItem(parent, schema)
|
|
128
|
+
isListItem(parent, schema)) {
|
|
130
129
|
// if there is not list match return as is
|
|
131
130
|
paragraphParts.push(line);
|
|
132
131
|
continue;
|
|
@@ -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.4",
|
|
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": "^
|
|
34
|
+
"@atlaskit/editor-common": "^95.0.0",
|
|
35
35
|
"@atlaskit/editor-markdown-transformer": "^5.13.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
|
-
"@atlaskit/editor-plugin-annotation": "^1.
|
|
37
|
+
"@atlaskit/editor-plugin-annotation": "^1.24.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.42.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.3.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.19.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"uuid": "^3.1.0"
|
|
@@ -120,9 +120,6 @@
|
|
|
120
120
|
},
|
|
121
121
|
"editor_nest_media_and_codeblock_in_quotes_jira": {
|
|
122
122
|
"type": "boolean"
|
|
123
|
-
},
|
|
124
|
-
"platform_editor_escape_formatting_for_nested_list": {
|
|
125
|
-
"type": "boolean"
|
|
126
123
|
}
|
|
127
124
|
}
|
|
128
125
|
}
|