@atlaskit/editor-plugin-paste 17.1.12 → 18.0.0
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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 18.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fb891566dfac2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb891566dfac2) -
|
|
8
|
+
Add anyMarksActiveFromTr and getHadMarkAttributes so mark-active checks can run from a
|
|
9
|
+
transaction. Color, highlight, toolbar/Cmd+K link apply, and paste events include had-mark
|
|
10
|
+
attributes behind kill switch platform_editor_add_text_color_tracking.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 17.1.13
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 17.1.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -13,6 +13,7 @@ exports.sendPasteAnalyticsEvent = exports.handleSelectedTableWithAnalytics = exp
|
|
|
13
13
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
|
+
var _mark = require("@atlaskit/editor-common/mark");
|
|
16
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
18
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
19
|
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
@@ -165,7 +166,7 @@ function createPastePayload(actionSubjectId, attributes, linkDomain) {
|
|
|
165
166
|
} : {});
|
|
166
167
|
}
|
|
167
168
|
function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, pluginInjectionApi) {
|
|
168
|
-
return function (selection) {
|
|
169
|
+
return function (selection, tr) {
|
|
169
170
|
var _pluginInjectionApi$m;
|
|
170
171
|
var text = event.clipboardData ? event.clipboardData.getData('text/plain') || event.clipboardData.getData('text/uri-list') : '';
|
|
171
172
|
var actionSubjectId = getActionSubjectId({
|
|
@@ -252,7 +253,9 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
252
253
|
});
|
|
253
254
|
}
|
|
254
255
|
var linkDomains = linkUrls.map(_utils.getLinkDomain);
|
|
255
|
-
|
|
256
|
+
var backgroundColor = selection.$from.doc.type.schema.marks.backgroundColor;
|
|
257
|
+
var hadMarkAttributes = pasteContext.hyperlinkPasteOnText && tr ? (0, _mark.getHadMarkAttributes)(tr, [backgroundColor]) : {};
|
|
258
|
+
return createPastePayload(actionSubjectId, _objectSpread({
|
|
256
259
|
type: pasteContext.type,
|
|
257
260
|
pasteSize: pasteSize,
|
|
258
261
|
content: content,
|
|
@@ -263,7 +266,7 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
263
266
|
mentionIds: mentionIds,
|
|
264
267
|
mentionLocalIds: mentionLocalIds,
|
|
265
268
|
pasteSplitList: pasteContext.pasteSplitList
|
|
266
|
-
}, linkDomains);
|
|
269
|
+
}, hadMarkAttributes), linkDomains);
|
|
267
270
|
};
|
|
268
271
|
}
|
|
269
272
|
function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
@@ -348,7 +351,7 @@ var injectAnalyticsPayloadBeforeCommand = function injectAnalyticsPayloadBeforeC
|
|
|
348
351
|
}
|
|
349
352
|
if (dispatch && originalTransaction.docChanged) {
|
|
350
353
|
// it needs to know the selection before the changes
|
|
351
|
-
var payload = createPayloadByTransaction(state.selection);
|
|
354
|
+
var payload = createPayloadByTransaction(state.selection, state.tr);
|
|
352
355
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(originalTransaction);
|
|
353
356
|
dispatch(originalTransaction);
|
|
354
357
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { getHadMarkAttributes } from '@atlaskit/editor-common/mark';
|
|
2
3
|
import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
|
|
3
4
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
5
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
@@ -158,7 +159,7 @@ function createPastePayload(actionSubjectId, attributes, linkDomain) {
|
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, pluginInjectionApi) {
|
|
161
|
-
return selection => {
|
|
162
|
+
return (selection, tr) => {
|
|
162
163
|
var _pluginInjectionApi$m, _pluginInjectionApi$m2;
|
|
163
164
|
const text = event.clipboardData ? event.clipboardData.getData('text/plain') || event.clipboardData.getData('text/uri-list') : '';
|
|
164
165
|
const actionSubjectId = getActionSubjectId({
|
|
@@ -245,6 +246,8 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
248
|
const linkDomains = linkUrls.map(getLinkDomain);
|
|
249
|
+
const backgroundColor = selection.$from.doc.type.schema.marks.backgroundColor;
|
|
250
|
+
const hadMarkAttributes = pasteContext.hyperlinkPasteOnText && tr ? getHadMarkAttributes(tr, [backgroundColor]) : {};
|
|
248
251
|
return createPastePayload(actionSubjectId, {
|
|
249
252
|
type: pasteContext.type,
|
|
250
253
|
pasteSize,
|
|
@@ -255,7 +258,8 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
255
258
|
mediaTraceId,
|
|
256
259
|
mentionIds,
|
|
257
260
|
mentionLocalIds,
|
|
258
|
-
pasteSplitList: pasteContext.pasteSplitList
|
|
261
|
+
pasteSplitList: pasteContext.pasteSplitList,
|
|
262
|
+
...hadMarkAttributes
|
|
259
263
|
}, linkDomains);
|
|
260
264
|
};
|
|
261
265
|
}
|
|
@@ -322,7 +326,7 @@ const injectAnalyticsPayloadBeforeCommand = editorAnalyticsAPI => createPayloadB
|
|
|
322
326
|
}
|
|
323
327
|
if (dispatch && originalTransaction.docChanged) {
|
|
324
328
|
// it needs to know the selection before the changes
|
|
325
|
-
const payload = createPayloadByTransaction(state.selection);
|
|
329
|
+
const payload = createPayloadByTransaction(state.selection, state.tr);
|
|
326
330
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(originalTransaction);
|
|
327
331
|
dispatch(originalTransaction);
|
|
328
332
|
}
|
|
@@ -3,6 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { getHadMarkAttributes } from '@atlaskit/editor-common/mark';
|
|
6
7
|
import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
8
9
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
@@ -153,7 +154,7 @@ function createPastePayload(actionSubjectId, attributes, linkDomain) {
|
|
|
153
154
|
} : {});
|
|
154
155
|
}
|
|
155
156
|
function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, pluginInjectionApi) {
|
|
156
|
-
return function (selection) {
|
|
157
|
+
return function (selection, tr) {
|
|
157
158
|
var _pluginInjectionApi$m;
|
|
158
159
|
var text = event.clipboardData ? event.clipboardData.getData('text/plain') || event.clipboardData.getData('text/uri-list') : '';
|
|
159
160
|
var actionSubjectId = getActionSubjectId({
|
|
@@ -240,7 +241,9 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
240
241
|
});
|
|
241
242
|
}
|
|
242
243
|
var linkDomains = linkUrls.map(getLinkDomain);
|
|
243
|
-
|
|
244
|
+
var backgroundColor = selection.$from.doc.type.schema.marks.backgroundColor;
|
|
245
|
+
var hadMarkAttributes = pasteContext.hyperlinkPasteOnText && tr ? getHadMarkAttributes(tr, [backgroundColor]) : {};
|
|
246
|
+
return createPastePayload(actionSubjectId, _objectSpread({
|
|
244
247
|
type: pasteContext.type,
|
|
245
248
|
pasteSize: pasteSize,
|
|
246
249
|
content: content,
|
|
@@ -251,7 +254,7 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
251
254
|
mentionIds: mentionIds,
|
|
252
255
|
mentionLocalIds: mentionLocalIds,
|
|
253
256
|
pasteSplitList: pasteContext.pasteSplitList
|
|
254
|
-
}, linkDomains);
|
|
257
|
+
}, hadMarkAttributes), linkDomains);
|
|
255
258
|
};
|
|
256
259
|
}
|
|
257
260
|
export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
@@ -336,7 +339,7 @@ var injectAnalyticsPayloadBeforeCommand = function injectAnalyticsPayloadBeforeC
|
|
|
336
339
|
}
|
|
337
340
|
if (dispatch && originalTransaction.docChanged) {
|
|
338
341
|
// it needs to know the selection before the changes
|
|
339
|
-
var payload = createPayloadByTransaction(state.selection);
|
|
342
|
+
var payload = createPayloadByTransaction(state.selection, state.tr);
|
|
340
343
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(originalTransaction);
|
|
341
344
|
dispatch(originalTransaction);
|
|
342
345
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"atlaskit:src": "src/index.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/adf-schema": "^57.
|
|
22
|
+
"@atlaskit/adf-schema": "^57.4.0",
|
|
23
23
|
"@atlaskit/adf-utils": "^20.9.0",
|
|
24
24
|
"@atlaskit/code": "^19.2.0",
|
|
25
25
|
"@atlaskit/editor-markdown-transformer": "^6.3.0",
|
|
26
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
27
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
28
|
-
"@atlaskit/editor-plugin-better-type-history": "^
|
|
29
|
-
"@atlaskit/editor-plugin-card": "^
|
|
30
|
-
"@atlaskit/editor-plugin-expand": "^
|
|
31
|
-
"@atlaskit/editor-plugin-extension": "^
|
|
32
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
33
|
-
"@atlaskit/editor-plugin-list": "^
|
|
34
|
-
"@atlaskit/editor-plugin-media": "^
|
|
35
|
-
"@atlaskit/editor-plugin-mentions": "^
|
|
26
|
+
"@atlaskit/editor-plugin-analytics": "^17.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-annotation": "^17.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-better-type-history": "^17.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-card": "^23.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-expand": "^18.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-extension": "^20.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-feature-flags": "^16.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-list": "^19.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-media": "^19.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-mentions": "^19.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
37
37
|
"@atlaskit/editor-tables": "^3.1.0",
|
|
38
38
|
"@atlaskit/flag": "^18.5.0",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
46
46
|
"@atlaskit/prosemirror-history": "^1.2.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^179.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^16.11.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"lodash": "^4.17.21",
|
|
51
51
|
"uuid": "^11.1.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^
|
|
54
|
+
"@atlaskit/editor-common": "^121.0.0",
|
|
55
55
|
"react": "^18.2.0 || ^19.2.0",
|
|
56
56
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
57
57
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|