@atlaskit/editor-plugin-paste 17.1.7 → 17.1.9
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 +45 -0
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/media.js +9 -0
- package/dist/cjs/pm-plugins/util/handlers.js +2 -2
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/media.js +9 -0
- package/dist/es2019/pm-plugins/util/handlers.js +1 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/media.js +9 -0
- package/dist/esm/pm-plugins/util/handlers.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 17.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0927c3666c010`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0927c3666c010) -
|
|
8
|
+
Upgrade `uuid` from `3.x` to `11.1.1` to remediate GHSA-w5hq-g745-h8pq / SNYK-JS-UUID-16133035.
|
|
9
|
+
|
|
10
|
+
`uuid@11` removed the deep subpath exports (`uuid/v4`, `uuid/v1`, `uuid/v5`) and the default
|
|
11
|
+
export, so all internal call sites were migrated to named imports:
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
-import uuid from 'uuid/v4';
|
|
15
|
+
+import { v4 as uuid } from 'uuid';
|
|
16
|
+
|
|
17
|
+
-import uuid from 'uuid';
|
|
18
|
+
+import { v4 as uuid } from 'uuid';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
With the exception of `@atlassian/integrations` (below), this is an internal implementation change
|
|
22
|
+
only - no public API, export, or entrypoint changed. UUID generation behaviour is unchanged
|
|
23
|
+
(`uuid@3`'s default export was already `v4`).
|
|
24
|
+
|
|
25
|
+
`@atlassian/integrations` declares `uuid` as a peer dependency, so its declared range moved from
|
|
26
|
+
`^3.1.0` to `^11.1.1`. That is a peer dependency declaration change, hence `minor` rather than
|
|
27
|
+
`patch` for that package.
|
|
28
|
+
|
|
29
|
+
The following `platform/packages/ai-mate` packages were also touched, but are all `private: true`
|
|
30
|
+
and so are intentionally not listed in the frontmatter above:
|
|
31
|
+
- `@atlassian/csm-assistance-service` - bumped its explicit `uuid` dependency from `npm:^9.0.0` to
|
|
32
|
+
`npm:^11.1.1` (`9.0.1` is also within the advisory's affected range).
|
|
33
|
+
- `@atlassian/csm-guidance-config` - example helper only, migrated to the named `uuid` import.
|
|
34
|
+
- `@atlassian/csm-ui-components` - example helper only, migrated to the named `uuid` import.
|
|
35
|
+
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
38
|
+
## 17.1.8
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- [`513f878e1df07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/513f878e1df07) -
|
|
43
|
+
[ux] Behind the platform_editor_preserve_mention_on_paste experiment, stop hoisting a mention's
|
|
44
|
+
avatar image out of its span during paste, so pasting a mention pastes a mention instead of a
|
|
45
|
+
standalone image
|
|
46
|
+
- Updated dependencies
|
|
47
|
+
|
|
3
48
|
## 17.1.7
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
|
@@ -9,7 +9,7 @@ exports.isInsideBlockQuote = void 0;
|
|
|
9
9
|
exports.isSharePointUrl = isSharePointUrl;
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
-
var _uuid =
|
|
12
|
+
var _uuid = require("uuid");
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _card = require("@atlaskit/editor-common/card");
|
|
15
15
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
@@ -237,7 +237,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
237
237
|
var state = view.state;
|
|
238
238
|
var content = (0, _analytics2.getContentNodeTypes)(slice.content);
|
|
239
239
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
240
|
-
var pasteId = (0, _uuid.
|
|
240
|
+
var pasteId = (0, _uuid.v4)();
|
|
241
241
|
var measureName = "".concat(PASTE, "_").concat(pasteId);
|
|
242
242
|
(0, _measureRender.measureRender)(measureName, function (_ref) {
|
|
243
243
|
var duration = _ref.duration,
|
|
@@ -12,6 +12,7 @@ var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
14
14
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
15
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
16
|
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; }
|
|
16
17
|
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; }
|
|
17
18
|
/**
|
|
@@ -200,6 +201,14 @@ var unwrapNestedMediaElements = exports.unwrapNestedMediaElements = function unw
|
|
|
200
201
|
return;
|
|
201
202
|
}
|
|
202
203
|
|
|
204
|
+
// Bypass mention avatars - a mention's avatar <img> is nested only inside <span>s
|
|
205
|
+
// (never a valid container), so it would otherwise get hoisted out of the mention's
|
|
206
|
+
// DOM subtree and parsed as a standalone image instead of leaving the mention intact
|
|
207
|
+
// for its own parseDOM rule to match.
|
|
208
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_preserve_mention_on_paste') && imageTag.closest('[data-mention-id]')) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
203
212
|
// Bypass mediaInline images - don't hoist images that are inside a mediaInline wrapper
|
|
204
213
|
// as this would break parseDOM matching for mediaInline nodes
|
|
205
214
|
// We remove the img from the DOM since mediaInline is a leaf node with no content
|
|
@@ -33,7 +33,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
33
33
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
34
34
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
35
35
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
36
|
-
var
|
|
36
|
+
var _uuid = require("uuid");
|
|
37
37
|
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
38
38
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
39
39
|
var _card = require("@atlaskit/editor-common/card");
|
|
@@ -699,7 +699,7 @@ function handleMacroAutoConvert(text, slice, queueCardsFromChangedTr, runMacroAu
|
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
702
|
-
var trackingId = (0,
|
|
702
|
+
var trackingId = (0, _uuid.v4)();
|
|
703
703
|
var trackingFrom = "handleMacroAutoConvert-from-".concat(trackingId);
|
|
704
704
|
var trackingTo = "handleMacroAutoConvert-to-".concat(trackingId);
|
|
705
705
|
(0, _commands.startTrackingPastedMacroPositions)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, trackingFrom, state.selection.from), trackingTo, state.selection.to))(state, dispatch);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
|
-
import uuid from 'uuid';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
3
|
import { ACTION, INPUT_METHOD, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
5
5
|
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
@@ -2,6 +2,7 @@ import { DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
|
2
2
|
import { mapSlice, removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
5
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
6
|
/**
|
|
6
7
|
* Ensure correct layout in nested mode
|
|
7
8
|
*
|
|
@@ -196,6 +197,14 @@ export const unwrapNestedMediaElements = html => {
|
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
// Bypass mention avatars - a mention's avatar <img> is nested only inside <span>s
|
|
201
|
+
// (never a valid container), so it would otherwise get hoisted out of the mention's
|
|
202
|
+
// DOM subtree and parsed as a standalone image instead of leaving the mention intact
|
|
203
|
+
// for its own parseDOM rule to match.
|
|
204
|
+
if (isExperimentEnabled('platform_editor_preserve_mention_on_paste') && imageTag.closest('[data-mention-id]')) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
199
208
|
// Bypass mediaInline images - don't hoist images that are inside a mediaInline wrapper
|
|
200
209
|
// as this would break parseDOM matching for mediaInline nodes
|
|
201
210
|
// We remove the img from the DOM since mediaInline is a leaf node with no content
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
|
-
import uuid from 'uuid
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
3
|
import { transformContainerNodes } from '@atlaskit/adf-utils/transforms';
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
@@ -4,7 +4,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
4
4
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
5
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
6
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
7
|
-
import uuid from 'uuid';
|
|
7
|
+
import { v4 as uuid } from 'uuid';
|
|
8
8
|
import { ACTION, INPUT_METHOD, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
10
10
|
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
@@ -5,6 +5,7 @@ import { DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
|
5
5
|
import { mapSlice, removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
9
|
/**
|
|
9
10
|
* Ensure correct layout in nested mode
|
|
10
11
|
*
|
|
@@ -191,6 +192,14 @@ export var unwrapNestedMediaElements = function unwrapNestedMediaElements(html)
|
|
|
191
192
|
return;
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
// Bypass mention avatars - a mention's avatar <img> is nested only inside <span>s
|
|
196
|
+
// (never a valid container), so it would otherwise get hoisted out of the mention's
|
|
197
|
+
// DOM subtree and parsed as a standalone image instead of leaving the mention intact
|
|
198
|
+
// for its own parseDOM rule to match.
|
|
199
|
+
if (isExperimentEnabled('platform_editor_preserve_mention_on_paste') && imageTag.closest('[data-mention-id]')) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
194
203
|
// Bypass mediaInline images - don't hoist images that are inside a mediaInline wrapper
|
|
195
204
|
// as this would break parseDOM matching for mediaInline nodes
|
|
196
205
|
// We remove the img from the DOM since mediaInline is a leaf node with no content
|
|
@@ -8,7 +8,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
10
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
11
|
-
import uuid from 'uuid
|
|
11
|
+
import { v4 as uuid } from 'uuid';
|
|
12
12
|
import { transformContainerNodes } from '@atlaskit/adf-utils/transforms';
|
|
13
13
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.9",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"atlaskit:src": "src/index.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/adf-schema": "^57.
|
|
23
|
-
"@atlaskit/adf-utils": "^20.
|
|
22
|
+
"@atlaskit/adf-schema": "^57.3.0",
|
|
23
|
+
"@atlaskit/adf-utils": "^20.9.0",
|
|
24
24
|
"@atlaskit/code": "^19.2.0",
|
|
25
25
|
"@atlaskit/editor-markdown-transformer": "^6.3.0",
|
|
26
26
|
"@atlaskit/editor-plugin-analytics": "^16.1.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/icon": "^37.6.0",
|
|
40
40
|
"@atlaskit/insm": "^3.0.0",
|
|
41
41
|
"@atlaskit/linking-common": "^12.1.0",
|
|
42
|
-
"@atlaskit/media-client": "^37.
|
|
42
|
+
"@atlaskit/media-client": "^37.7.0",
|
|
43
43
|
"@atlaskit/media-common": "^14.6.0",
|
|
44
44
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"@atlaskit/tokens": "^16.11.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"lodash": "^4.17.21",
|
|
51
|
-
"uuid": "^
|
|
51
|
+
"uuid": "^11.1.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^120.
|
|
54
|
+
"@atlaskit/editor-common": "^120.13.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"
|