@atlaskit/editor-plugin-clipboard 7.0.0 → 7.1.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 +7 -0
- package/dist/cjs/pm-plugins/main.js +13 -20
- package/dist/es2019/pm-plugins/main.js +13 -20
- package/dist/esm/pm-plugins/main.js +13 -20
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-clipboard
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a0f86fbc3de86`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a0f86fbc3de86) -
|
|
8
|
+
[FFCLEANUP-79685] clean up platform_editor_fix_captions_on_copy feature gate
|
|
9
|
+
|
|
3
10
|
## 7.0.0
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -12,7 +12,6 @@ var _clipboard = require("@atlaskit/editor-common/clipboard");
|
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _pluginKey = require("./plugin-key");
|
|
17
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; }
|
|
18
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; }
|
|
@@ -118,25 +117,19 @@ var createClipboardSerializer = exports.createClipboardSerializer = function cre
|
|
|
118
117
|
var strippedMediaNode = schema.nodes.media.createChecked(mediaNode.attrs, mediaNode.content, (_mediaNode$marks = mediaNode.marks) === null || _mediaNode$marks === void 0 ? void 0 : _mediaNode$marks.filter(function (mark) {
|
|
119
118
|
return mark.type.name !== 'annotation';
|
|
120
119
|
}));
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
} else {
|
|
135
|
-
var _newContent2 = _model.Fragment.from(strippedMediaNode);
|
|
136
|
-
// Currently incorrectly typed, see comment above
|
|
137
|
-
//@ts-ignore
|
|
138
|
-
return originalSerializeFragment(_newContent2, options, target);
|
|
139
|
-
}
|
|
120
|
+
|
|
121
|
+
// Content for media parents can include multiple content nodes (media and captions). We now take that
|
|
122
|
+
// into consideration when we are stripping annotations.
|
|
123
|
+
var contentArray = [strippedMediaNode];
|
|
124
|
+
content.forEach(function (node) {
|
|
125
|
+
if (node.type.name !== 'media') {
|
|
126
|
+
contentArray = [].concat((0, _toConsumableArray2.default)(contentArray), [node]);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
var _newContent = _model.Fragment.fromArray(contentArray);
|
|
130
|
+
// Currently incorrectly typed, see comment above
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
return originalSerializeFragment(_newContent, options, target);
|
|
140
133
|
}
|
|
141
134
|
|
|
142
135
|
// If we're not copying any rows or media nodes, just run default serializeFragment function.
|
|
@@ -3,7 +3,6 @@ import { getAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
|
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { DOMSerializer, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { clipboardPluginKey } from './plugin-key';
|
|
8
7
|
export let ClipboardEventType = /*#__PURE__*/function (ClipboardEventType) {
|
|
9
8
|
ClipboardEventType["CUT"] = "CUT";
|
|
@@ -106,25 +105,19 @@ export const createClipboardSerializer = (schema, getEditorView) => {
|
|
|
106
105
|
var _mediaNode$marks;
|
|
107
106
|
const mediaNode = content.firstChild;
|
|
108
107
|
const strippedMediaNode = schema.nodes.media.createChecked(mediaNode.attrs, mediaNode.content, (_mediaNode$marks = mediaNode.marks) === null || _mediaNode$marks === void 0 ? void 0 : _mediaNode$marks.filter(mark => mark.type.name !== 'annotation'));
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} else {
|
|
123
|
-
const newContent = Fragment.from(strippedMediaNode);
|
|
124
|
-
// Currently incorrectly typed, see comment above
|
|
125
|
-
//@ts-ignore
|
|
126
|
-
return originalSerializeFragment(newContent, options, target);
|
|
127
|
-
}
|
|
108
|
+
|
|
109
|
+
// Content for media parents can include multiple content nodes (media and captions). We now take that
|
|
110
|
+
// into consideration when we are stripping annotations.
|
|
111
|
+
let contentArray = [strippedMediaNode];
|
|
112
|
+
content.forEach(node => {
|
|
113
|
+
if (node.type.name !== 'media') {
|
|
114
|
+
contentArray = [...contentArray, node];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const newContent = Fragment.fromArray(contentArray);
|
|
118
|
+
// Currently incorrectly typed, see comment above
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
return originalSerializeFragment(newContent, options, target);
|
|
128
121
|
}
|
|
129
122
|
|
|
130
123
|
// If we're not copying any rows or media nodes, just run default serializeFragment function.
|
|
@@ -7,7 +7,6 @@ import { getAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
|
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
8
|
import { DOMSerializer, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { clipboardPluginKey } from './plugin-key';
|
|
12
11
|
export var ClipboardEventType = /*#__PURE__*/function (ClipboardEventType) {
|
|
13
12
|
ClipboardEventType["CUT"] = "CUT";
|
|
@@ -111,25 +110,19 @@ export var createClipboardSerializer = function createClipboardSerializer(schema
|
|
|
111
110
|
var strippedMediaNode = schema.nodes.media.createChecked(mediaNode.attrs, mediaNode.content, (_mediaNode$marks = mediaNode.marks) === null || _mediaNode$marks === void 0 ? void 0 : _mediaNode$marks.filter(function (mark) {
|
|
112
111
|
return mark.type.name !== 'annotation';
|
|
113
112
|
}));
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
} else {
|
|
128
|
-
var _newContent2 = Fragment.from(strippedMediaNode);
|
|
129
|
-
// Currently incorrectly typed, see comment above
|
|
130
|
-
//@ts-ignore
|
|
131
|
-
return originalSerializeFragment(_newContent2, options, target);
|
|
132
|
-
}
|
|
113
|
+
|
|
114
|
+
// Content for media parents can include multiple content nodes (media and captions). We now take that
|
|
115
|
+
// into consideration when we are stripping annotations.
|
|
116
|
+
var contentArray = [strippedMediaNode];
|
|
117
|
+
content.forEach(function (node) {
|
|
118
|
+
if (node.type.name !== 'media') {
|
|
119
|
+
contentArray = [].concat(_toConsumableArray(contentArray), [node]);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var _newContent = Fragment.fromArray(contentArray);
|
|
123
|
+
// Currently incorrectly typed, see comment above
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
return originalSerializeFragment(_newContent, options, target);
|
|
133
126
|
}
|
|
134
127
|
|
|
135
128
|
// If we're not copying any rows or media nodes, just run default serializeFragment function.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-clipboard",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Clipboard plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"atlaskit:src": "src/index.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/editor-prosemirror": "^7.
|
|
30
|
+
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^111.
|
|
35
|
+
"@atlaskit/editor-common": "^111.21.0",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"react-dom": "^18.2.0"
|
|
38
38
|
},
|