@atlaskit/editor-plugin-paste 2.0.16 → 2.0.17

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,15 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 2.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - [#102478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102478)
8
+ [`e14c5f9596217`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e14c5f9596217) -
9
+ Calling media trackMediaPaste command to enable the tracking of out of editor media paste to
10
+ enable deep copy when media copy scope is set to "editor"
11
+ - Updated dependencies
12
+
3
13
  ## 2.0.16
4
14
 
5
15
  ### Patch Changes
@@ -475,7 +475,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
475
475
  }
476
476
  slice = (0, _transforms.transformSingleLineCodeBlockToCodeMark)(slice, schema);
477
477
  slice = (0, _media.transformSliceToCorrectMediaWrapper)(slice, schema);
478
- slice = (0, _media.transformSliceToMediaSingleWithNewExperience)(slice, schema);
478
+ slice = (0, _media.transformSliceToMediaSingleWithNewExperience)(slice, schema, pluginInjectionApi);
479
479
  slice = (0, _transforms.transformSliceToDecisionList)(slice, schema);
480
480
 
481
481
  // splitting linebreaks into paragraphs must happen before upgrading text to lists
@@ -83,7 +83,7 @@ var transformSliceToCorrectMediaWrapper = exports.transformSliceToCorrectMediaWr
83
83
  * Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
84
84
  *
85
85
  */
86
- var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema) {
86
+ var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema, api) {
87
87
  var _schema$nodes3 = schema.nodes,
88
88
  mediaInline = _schema$nodes3.mediaInline,
89
89
  mediaSingle = _schema$nodes3.mediaSingle,
@@ -107,12 +107,16 @@ var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMedia
107
107
  return (0, _utils.mapSlice)(newSlice, function (node) {
108
108
  var __mediaTraceId = (0, _mediaCommon.getRandomHex)(8);
109
109
  if (node.type === media) {
110
+ var _api$media;
111
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.commands.trackMediaPaste(node.attrs));
110
112
  return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
111
113
  __external: node.attrs.type === 'external',
112
114
  __mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
113
115
  }), node.content, node.marks);
114
116
  }
115
117
  if (node.type.name === 'mediaInline') {
118
+ var _api$media2;
119
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media2 = api.media) === null || _api$media2 === void 0 ? void 0 : _api$media2.commands.trackMediaPaste(node.attrs));
116
120
  return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
117
121
  __mediaTraceId: __mediaTraceId
118
122
  }), node.content, node.marks);
@@ -449,7 +449,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
449
449
  }
450
450
  slice = transformSingleLineCodeBlockToCodeMark(slice, schema);
451
451
  slice = transformSliceToCorrectMediaWrapper(slice, schema);
452
- slice = transformSliceToMediaSingleWithNewExperience(slice, schema);
452
+ slice = transformSliceToMediaSingleWithNewExperience(slice, schema, pluginInjectionApi);
453
453
  slice = transformSliceToDecisionList(slice, schema);
454
454
 
455
455
  // splitting linebreaks into paragraphs must happen before upgrading text to lists
@@ -3,7 +3,6 @@ import { mapSlice, removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlask
3
3
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
4
4
  import { getRandomHex } from '@atlaskit/media-common';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
-
7
6
  /**
8
7
  * Ensure correct layout in nested mode
9
8
  *
@@ -77,7 +76,7 @@ export const transformSliceToCorrectMediaWrapper = (slice, schema) => {
77
76
  * Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
78
77
  *
79
78
  */
80
- export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
79
+ export const transformSliceToMediaSingleWithNewExperience = (slice, schema, api) => {
81
80
  const {
82
81
  mediaInline,
83
82
  mediaSingle,
@@ -102,6 +101,8 @@ export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
102
101
  return mapSlice(newSlice, node => {
103
102
  const __mediaTraceId = getRandomHex(8);
104
103
  if (node.type === media) {
104
+ var _api$media;
105
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.commands.trackMediaPaste(node.attrs));
105
106
  return media.createChecked({
106
107
  ...node.attrs,
107
108
  __external: node.attrs.type === 'external',
@@ -109,6 +110,8 @@ export const transformSliceToMediaSingleWithNewExperience = (slice, schema) => {
109
110
  }, node.content, node.marks);
110
111
  }
111
112
  if (node.type.name === 'mediaInline') {
113
+ var _api$media2;
114
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$media2 = api.media) === null || _api$media2 === void 0 ? void 0 : _api$media2.commands.trackMediaPaste(node.attrs));
112
115
  return mediaInline.createChecked({
113
116
  ...node.attrs,
114
117
  __mediaTraceId
@@ -467,7 +467,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
467
467
  }
468
468
  slice = transformSingleLineCodeBlockToCodeMark(slice, schema);
469
469
  slice = transformSliceToCorrectMediaWrapper(slice, schema);
470
- slice = transformSliceToMediaSingleWithNewExperience(slice, schema);
470
+ slice = transformSliceToMediaSingleWithNewExperience(slice, schema, pluginInjectionApi);
471
471
  slice = transformSliceToDecisionList(slice, schema);
472
472
 
473
473
  // splitting linebreaks into paragraphs must happen before upgrading text to lists
@@ -6,7 +6,6 @@ import { mapSlice, removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlask
6
6
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { getRandomHex } from '@atlaskit/media-common';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
-
10
9
  /**
11
10
  * Ensure correct layout in nested mode
12
11
  *
@@ -75,7 +74,7 @@ export var transformSliceToCorrectMediaWrapper = function transformSliceToCorrec
75
74
  * Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
76
75
  *
77
76
  */
78
- export var transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema) {
77
+ export var transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema, api) {
79
78
  var _schema$nodes3 = schema.nodes,
80
79
  mediaInline = _schema$nodes3.mediaInline,
81
80
  mediaSingle = _schema$nodes3.mediaSingle,
@@ -99,12 +98,16 @@ export var transformSliceToMediaSingleWithNewExperience = function transformSlic
99
98
  return mapSlice(newSlice, function (node) {
100
99
  var __mediaTraceId = getRandomHex(8);
101
100
  if (node.type === media) {
101
+ var _api$media;
102
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.commands.trackMediaPaste(node.attrs));
102
103
  return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
103
104
  __external: node.attrs.type === 'external',
104
105
  __mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
105
106
  }), node.content, node.marks);
106
107
  }
107
108
  if (node.type.name === 'mediaInline') {
109
+ var _api$media2;
110
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$media2 = api.media) === null || _api$media2 === void 0 ? void 0 : _api$media2.commands.trackMediaPaste(node.attrs));
108
111
  return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
109
112
  __mediaTraceId: __mediaTraceId
110
113
  }), node.content, node.marks);
@@ -1,5 +1,7 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
2
  import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
3
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
4
+ import type { PastePlugin } from '../pastePluginType';
3
5
  /**
4
6
  * Ensure correct layout in nested mode
5
7
  *
@@ -13,7 +15,7 @@ export declare const transformSliceToCorrectMediaWrapper: (slice: Slice, schema:
13
15
  * Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
14
16
  *
15
17
  */
16
- export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema) => Slice;
18
+ export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
17
19
  /**
18
20
  * Given a html string, we attempt to hoist any nested `<img>` tags,
19
21
  * not directly wrapped by a `<div>` as ProseMirror no-op's
@@ -1,5 +1,7 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
2
  import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
3
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
4
+ import type { PastePlugin } from '../pastePluginType';
3
5
  /**
4
6
  * Ensure correct layout in nested mode
5
7
  *
@@ -13,7 +15,7 @@ export declare const transformSliceToCorrectMediaWrapper: (slice: Slice, schema:
13
15
  * Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
14
16
  *
15
17
  */
16
- export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema) => Slice;
18
+ export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
17
19
  /**
18
20
  * Given a html string, we attempt to hoist any nested `<img>` tags,
19
21
  * not directly wrapped by a `<div>` as ProseMirror no-op's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,8 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^99.1.0",
34
+ "@atlaskit/adf-schema": "^46.1.0",
35
+ "@atlaskit/editor-common": "^99.2.0",
35
36
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
36
37
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
38
  "@atlaskit/editor-plugin-annotation": "^1.26.0",
@@ -40,13 +41,13 @@
40
41
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
41
42
  "@atlaskit/editor-plugin-list": "^3.9.0",
42
43
  "@atlaskit/editor-plugin-media": "^1.44.0",
43
- "@atlaskit/editor-plugin-mentions": "^2.11.0",
44
+ "@atlaskit/editor-plugin-mentions": "^2.12.0",
44
45
  "@atlaskit/editor-prosemirror": "6.2.1",
45
46
  "@atlaskit/editor-tables": "^2.8.0",
46
47
  "@atlaskit/media-client": "^29.0.0",
47
48
  "@atlaskit/media-common": "^11.7.0",
48
49
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^2.34.0",
50
+ "@atlaskit/tmp-editor-statsig": "^2.35.0",
50
51
  "@babel/runtime": "^7.0.0",
51
52
  "lodash": "^4.17.21",
52
53
  "uuid": "^3.1.0"
@@ -57,7 +58,6 @@
57
58
  },
58
59
  "devDependencies": {
59
60
  "@af/visual-regression": "*",
60
- "@atlaskit/adf-schema": "^46.1.0",
61
61
  "@atlaskit/editor-plugin-block-type": "^4.1.0",
62
62
  "@atlaskit/editor-plugin-history": "^1.3.0",
63
63
  "@atlaskit/editor-plugin-type-ahead": "^1.11.0",