@atlaskit/editor-plugin-paste 12.1.8 → 12.1.12
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,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 12.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 12.1.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 12.1.10
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 12.1.9
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [`ebfe7dee1573c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ebfe7dee1573c) -
|
|
26
|
+
Suppress pasted agent mention notifications
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 12.1.8
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -16,10 +16,17 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
16
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
19
20
|
var _util = require("./util");
|
|
20
21
|
var _handlers = require("./util/handlers");
|
|
21
22
|
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; }
|
|
22
23
|
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) { (0, _defineProperty2.default)(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; }
|
|
24
|
+
var isAgentUserType = function isAgentUserType(userType) {
|
|
25
|
+
return userType === 'APP' || userType === 'AGENT';
|
|
26
|
+
};
|
|
27
|
+
var shouldSuppressPastedMentionNotification = function shouldSuppressPastedMentionNotification(node) {
|
|
28
|
+
return (0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false) && isAgentUserType(node.attrs.userType);
|
|
29
|
+
};
|
|
23
30
|
var contentToPasteContent = {
|
|
24
31
|
url: _analytics.PasteContents.url,
|
|
25
32
|
paragraph: _analytics.PasteContents.text,
|
|
@@ -204,23 +211,27 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
204
211
|
var mentionsInserted = [];
|
|
205
212
|
slice.content.descendants(function (node) {
|
|
206
213
|
if (node.type.name === 'mention') {
|
|
207
|
-
mentionsInserted.push({
|
|
214
|
+
mentionsInserted.push(_objectSpread({
|
|
208
215
|
type: 'added',
|
|
209
216
|
id: node.attrs.id,
|
|
210
217
|
localId: node.attrs.localId,
|
|
211
218
|
method: 'pasted'
|
|
212
|
-
})
|
|
219
|
+
}, shouldSuppressPastedMentionNotification(node) ? {
|
|
220
|
+
shouldSuppressMentionNotification: true
|
|
221
|
+
} : {}));
|
|
213
222
|
}
|
|
214
223
|
if (node.type.name === 'taskItem') {
|
|
215
224
|
node.content.forEach(function (nodeContent) {
|
|
216
225
|
if (nodeContent.type.name === 'mention') {
|
|
217
|
-
mentionsInserted.push({
|
|
226
|
+
mentionsInserted.push(_objectSpread({
|
|
218
227
|
type: 'added',
|
|
219
228
|
localId: nodeContent.attrs.localId,
|
|
220
229
|
id: nodeContent.attrs.id,
|
|
221
230
|
taskLocalId: node.attrs.localId,
|
|
222
231
|
method: 'pasted'
|
|
223
|
-
})
|
|
232
|
+
}, shouldSuppressPastedMentionNotification(nodeContent) ? {
|
|
233
|
+
shouldSuppressMentionNotification: true
|
|
234
|
+
} : {}));
|
|
224
235
|
}
|
|
225
236
|
});
|
|
226
237
|
return false;
|
|
@@ -2,8 +2,11 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, Pa
|
|
|
2
2
|
import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
5
6
|
import { getPasteSource } from './util';
|
|
6
7
|
import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable, handleNestedTablePaste } from './util/handlers';
|
|
8
|
+
const isAgentUserType = userType => userType === 'APP' || userType === 'AGENT';
|
|
9
|
+
const shouldSuppressPastedMentionNotification = node => expVal('platform_editor_agent_mentions', 'isEnabled', false) && isAgentUserType(node.attrs.userType);
|
|
7
10
|
const contentToPasteContent = {
|
|
8
11
|
url: PasteContents.url,
|
|
9
12
|
paragraph: PasteContents.text,
|
|
@@ -203,7 +206,10 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
203
206
|
type: 'added',
|
|
204
207
|
id: node.attrs.id,
|
|
205
208
|
localId: node.attrs.localId,
|
|
206
|
-
method: 'pasted'
|
|
209
|
+
method: 'pasted',
|
|
210
|
+
...(shouldSuppressPastedMentionNotification(node) ? {
|
|
211
|
+
shouldSuppressMentionNotification: true
|
|
212
|
+
} : {})
|
|
207
213
|
});
|
|
208
214
|
}
|
|
209
215
|
if (node.type.name === 'taskItem') {
|
|
@@ -214,7 +220,10 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
214
220
|
localId: nodeContent.attrs.localId,
|
|
215
221
|
id: nodeContent.attrs.id,
|
|
216
222
|
taskLocalId: node.attrs.localId,
|
|
217
|
-
method: 'pasted'
|
|
223
|
+
method: 'pasted',
|
|
224
|
+
...(shouldSuppressPastedMentionNotification(nodeContent) ? {
|
|
225
|
+
shouldSuppressMentionNotification: true
|
|
226
|
+
} : {})
|
|
218
227
|
});
|
|
219
228
|
}
|
|
220
229
|
});
|
|
@@ -6,8 +6,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, Pa
|
|
|
6
6
|
import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
9
10
|
import { getPasteSource } from './util';
|
|
10
11
|
import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable, handleNestedTablePaste } from './util/handlers';
|
|
12
|
+
var isAgentUserType = function isAgentUserType(userType) {
|
|
13
|
+
return userType === 'APP' || userType === 'AGENT';
|
|
14
|
+
};
|
|
15
|
+
var shouldSuppressPastedMentionNotification = function shouldSuppressPastedMentionNotification(node) {
|
|
16
|
+
return expVal('platform_editor_agent_mentions', 'isEnabled', false) && isAgentUserType(node.attrs.userType);
|
|
17
|
+
};
|
|
11
18
|
var contentToPasteContent = {
|
|
12
19
|
url: PasteContents.url,
|
|
13
20
|
paragraph: PasteContents.text,
|
|
@@ -192,23 +199,27 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
|
|
|
192
199
|
var mentionsInserted = [];
|
|
193
200
|
slice.content.descendants(function (node) {
|
|
194
201
|
if (node.type.name === 'mention') {
|
|
195
|
-
mentionsInserted.push({
|
|
202
|
+
mentionsInserted.push(_objectSpread({
|
|
196
203
|
type: 'added',
|
|
197
204
|
id: node.attrs.id,
|
|
198
205
|
localId: node.attrs.localId,
|
|
199
206
|
method: 'pasted'
|
|
200
|
-
})
|
|
207
|
+
}, shouldSuppressPastedMentionNotification(node) ? {
|
|
208
|
+
shouldSuppressMentionNotification: true
|
|
209
|
+
} : {}));
|
|
201
210
|
}
|
|
202
211
|
if (node.type.name === 'taskItem') {
|
|
203
212
|
node.content.forEach(function (nodeContent) {
|
|
204
213
|
if (nodeContent.type.name === 'mention') {
|
|
205
|
-
mentionsInserted.push({
|
|
214
|
+
mentionsInserted.push(_objectSpread({
|
|
206
215
|
type: 'added',
|
|
207
216
|
localId: nodeContent.attrs.localId,
|
|
208
217
|
id: nodeContent.attrs.id,
|
|
209
218
|
taskLocalId: node.attrs.localId,
|
|
210
219
|
method: 'pasted'
|
|
211
|
-
})
|
|
220
|
+
}, shouldSuppressPastedMentionNotification(nodeContent) ? {
|
|
221
|
+
shouldSuppressMentionNotification: true
|
|
222
|
+
} : {}));
|
|
212
223
|
}
|
|
213
224
|
});
|
|
214
225
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.12",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"atlaskit:src": "src/index.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/adf-schema": "^
|
|
30
|
+
"@atlaskit/adf-schema": "^54.0.0",
|
|
31
31
|
"@atlaskit/adf-utils": "^19.33.0",
|
|
32
32
|
"@atlaskit/code": "^17.5.0",
|
|
33
33
|
"@atlaskit/editor-markdown-transformer": "^5.21.0",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"@atlaskit/media-common": "^13.3.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
51
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^99.0.0",
|
|
53
53
|
"@atlaskit/tokens": "^13.3.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
56
|
"uuid": "^3.1.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^115.
|
|
59
|
+
"@atlaskit/editor-common": "^115.13.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0",
|
|
62
62
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -129,6 +129,9 @@
|
|
|
129
129
|
"platform_synced_block_unsupported_products": {
|
|
130
130
|
"type": "boolean"
|
|
131
131
|
},
|
|
132
|
+
"platform_editor_agent_mentions": {
|
|
133
|
+
"type": "boolean"
|
|
134
|
+
},
|
|
132
135
|
"platform_editor_paste_renderer_analytics": {
|
|
133
136
|
"type": "boolean"
|
|
134
137
|
}
|