@atlaskit/editor-plugin-paste 1.8.0 → 1.8.2
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 +17 -0
- package/dist/cjs/handlers.js +1 -2
- package/dist/cjs/pm-plugins/clipboard-text-serializer.js +0 -37
- package/dist/es2019/handlers.js +1 -2
- package/dist/es2019/pm-plugins/clipboard-text-serializer.js +0 -37
- package/dist/esm/handlers.js +1 -2
- package/dist/esm/pm-plugins/clipboard-text-serializer.js +0 -37
- package/dist/types/pm-plugins/clipboard-text-serializer.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/clipboard-text-serializer.d.ts +0 -1
- package/package.json +5 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 1.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#130724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130724)
|
|
8
|
+
[`a54f1d5c8a0eb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a54f1d5c8a0eb) -
|
|
9
|
+
remove preserve whitespace clipboard text serialization ff
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 1.8.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#129252](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/129252)
|
|
17
|
+
[`d4ea158a91fde`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d4ea158a91fde) -
|
|
18
|
+
Cleaned up FF platform.editor.allow-action-in-list
|
|
19
|
+
|
|
3
20
|
## 1.8.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/cjs/handlers.js
CHANGED
|
@@ -38,7 +38,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
38
38
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
39
39
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
40
40
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
41
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
42
41
|
var _commands = require("./commands");
|
|
43
42
|
var _edgeCases = require("./edge-cases");
|
|
44
43
|
var _lists = require("./edge-cases/lists");
|
|
@@ -1038,5 +1037,5 @@ var handleSelectedTable = exports.handleSelectedTable = function handleSelectedT
|
|
|
1038
1037
|
};
|
|
1039
1038
|
function checkTaskListInList(state, slice) {
|
|
1040
1039
|
var _slice$content$firstC4;
|
|
1041
|
-
return Boolean((0, _utils.isInListItem)(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || '')
|
|
1040
|
+
return Boolean((0, _utils.isInListItem)(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || ''));
|
|
1042
1041
|
}
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.clipboardTextSerializer = clipboardTextSerializer;
|
|
7
|
-
exports.clipboardTextSerializerSimplified = clipboardTextSerializerSimplified;
|
|
8
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
7
|
/**
|
|
10
8
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
11
9
|
* section of the clipboard on copy.
|
|
@@ -17,15 +15,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
17
15
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
18
16
|
*/
|
|
19
17
|
function clipboardTextSerializer(slice) {
|
|
20
|
-
if (
|
|
21
|
-
// Enables bugfix - https://product-fabric.atlassian.net/browse/ED-23043
|
|
22
|
-
(0, _platformFeatureFlags.getBooleanFF)('platform.editor.preserve-whitespace-clipboard-text-serialization')) {
|
|
23
|
-
return clipboardTextSerializerSimplified(slice);
|
|
24
|
-
} else {
|
|
25
|
-
return clipboardTextSerializerLegacy(slice);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function clipboardTextSerializerSimplified(slice) {
|
|
29
18
|
var blockSeparator = '\n\n';
|
|
30
19
|
return slice.content.textBetween(0, slice.content.size, blockSeparator, function (leafNode) {
|
|
31
20
|
var _leafNode$text;
|
|
@@ -49,30 +38,4 @@ function clipboardTextSerializerSimplified(slice) {
|
|
|
49
38
|
return (_leafNode$text = leafNode.text) !== null && _leafNode$text !== void 0 ? _leafNode$text : '';
|
|
50
39
|
}
|
|
51
40
|
});
|
|
52
|
-
}
|
|
53
|
-
function clipboardTextSerializerLegacy(slice) {
|
|
54
|
-
var text = '';
|
|
55
|
-
var blockSeparater = '\n\n';
|
|
56
|
-
slice.content.nodesBetween(0, slice.content.size, function (node) {
|
|
57
|
-
if (node.type.isBlock) {
|
|
58
|
-
text += blockSeparater;
|
|
59
|
-
}
|
|
60
|
-
if (node.type.name === 'paragraph') {
|
|
61
|
-
return true;
|
|
62
|
-
} else if (node.type.name === 'hardBreak') {
|
|
63
|
-
text += '\n';
|
|
64
|
-
} else if (node.type.name === 'text') {
|
|
65
|
-
text += node.text;
|
|
66
|
-
} else if (node.type.name === 'inlineCard') {
|
|
67
|
-
text += node.attrs.url;
|
|
68
|
-
} else if (node.type.name === 'blockCard') {
|
|
69
|
-
text += node.attrs.url;
|
|
70
|
-
} else if (node.type.name === 'mention') {
|
|
71
|
-
text += node.attrs.text;
|
|
72
|
-
} else {
|
|
73
|
-
text += node.textBetween(0, node.content.size, '\n\n');
|
|
74
|
-
}
|
|
75
|
-
return false;
|
|
76
|
-
});
|
|
77
|
-
return text.trim();
|
|
78
41
|
}
|
package/dist/es2019/handlers.js
CHANGED
|
@@ -9,7 +9,6 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
|
|
|
9
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
11
11
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
// TODO: ED-20519 Needs Macro extraction
|
|
14
13
|
|
|
15
14
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
@@ -1014,5 +1013,5 @@ export const handleSelectedTable = editorAnalyticsAPI => slice => (state, dispat
|
|
|
1014
1013
|
};
|
|
1015
1014
|
export function checkTaskListInList(state, slice) {
|
|
1016
1015
|
var _slice$content$firstC4, _slice$content$firstC5;
|
|
1017
|
-
return Boolean(isInListItem(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 ? void 0 : (_slice$content$firstC5 = _slice$content$firstC4.type) === null || _slice$content$firstC5 === void 0 ? void 0 : _slice$content$firstC5.name) || '')
|
|
1016
|
+
return Boolean(isInListItem(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 ? void 0 : (_slice$content$firstC5 = _slice$content$firstC4.type) === null || _slice$content$firstC5 === void 0 ? void 0 : _slice$content$firstC5.name) || ''));
|
|
1018
1017
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
5
3
|
* section of the clipboard on copy.
|
|
@@ -11,15 +9,6 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
11
9
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
12
10
|
*/
|
|
13
11
|
export function clipboardTextSerializer(slice) {
|
|
14
|
-
if (
|
|
15
|
-
// Enables bugfix - https://product-fabric.atlassian.net/browse/ED-23043
|
|
16
|
-
getBooleanFF('platform.editor.preserve-whitespace-clipboard-text-serialization')) {
|
|
17
|
-
return clipboardTextSerializerSimplified(slice);
|
|
18
|
-
} else {
|
|
19
|
-
return clipboardTextSerializerLegacy(slice);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function clipboardTextSerializerSimplified(slice) {
|
|
23
12
|
const blockSeparator = '\n\n';
|
|
24
13
|
return slice.content.textBetween(0, slice.content.size, blockSeparator, leafNode => {
|
|
25
14
|
var _leafNode$text;
|
|
@@ -43,30 +32,4 @@ export function clipboardTextSerializerSimplified(slice) {
|
|
|
43
32
|
return (_leafNode$text = leafNode.text) !== null && _leafNode$text !== void 0 ? _leafNode$text : '';
|
|
44
33
|
}
|
|
45
34
|
});
|
|
46
|
-
}
|
|
47
|
-
function clipboardTextSerializerLegacy(slice) {
|
|
48
|
-
let text = '';
|
|
49
|
-
const blockSeparater = '\n\n';
|
|
50
|
-
slice.content.nodesBetween(0, slice.content.size, node => {
|
|
51
|
-
if (node.type.isBlock) {
|
|
52
|
-
text += blockSeparater;
|
|
53
|
-
}
|
|
54
|
-
if (node.type.name === 'paragraph') {
|
|
55
|
-
return true;
|
|
56
|
-
} else if (node.type.name === 'hardBreak') {
|
|
57
|
-
text += '\n';
|
|
58
|
-
} else if (node.type.name === 'text') {
|
|
59
|
-
text += node.text;
|
|
60
|
-
} else if (node.type.name === 'inlineCard') {
|
|
61
|
-
text += node.attrs.url;
|
|
62
|
-
} else if (node.type.name === 'blockCard') {
|
|
63
|
-
text += node.attrs.url;
|
|
64
|
-
} else if (node.type.name === 'mention') {
|
|
65
|
-
text += node.attrs.text;
|
|
66
|
-
} else {
|
|
67
|
-
text += node.textBetween(0, node.content.size, '\n\n');
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
});
|
|
71
|
-
return text.trim();
|
|
72
35
|
}
|
package/dist/esm/handlers.js
CHANGED
|
@@ -17,7 +17,6 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
|
|
|
17
17
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
18
18
|
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
19
19
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
20
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
// TODO: ED-20519 Needs Macro extraction
|
|
22
21
|
|
|
23
22
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
@@ -1015,5 +1014,5 @@ export var handleSelectedTable = function handleSelectedTable(editorAnalyticsAPI
|
|
|
1015
1014
|
};
|
|
1016
1015
|
export function checkTaskListInList(state, slice) {
|
|
1017
1016
|
var _slice$content$firstC4;
|
|
1018
|
-
return Boolean(isInListItem(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || '')
|
|
1017
|
+
return Boolean(isInListItem(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || ''));
|
|
1019
1018
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
5
3
|
* section of the clipboard on copy.
|
|
@@ -11,15 +9,6 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
11
9
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
12
10
|
*/
|
|
13
11
|
export function clipboardTextSerializer(slice) {
|
|
14
|
-
if (
|
|
15
|
-
// Enables bugfix - https://product-fabric.atlassian.net/browse/ED-23043
|
|
16
|
-
getBooleanFF('platform.editor.preserve-whitespace-clipboard-text-serialization')) {
|
|
17
|
-
return clipboardTextSerializerSimplified(slice);
|
|
18
|
-
} else {
|
|
19
|
-
return clipboardTextSerializerLegacy(slice);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function clipboardTextSerializerSimplified(slice) {
|
|
23
12
|
var blockSeparator = '\n\n';
|
|
24
13
|
return slice.content.textBetween(0, slice.content.size, blockSeparator, function (leafNode) {
|
|
25
14
|
var _leafNode$text;
|
|
@@ -43,30 +32,4 @@ export function clipboardTextSerializerSimplified(slice) {
|
|
|
43
32
|
return (_leafNode$text = leafNode.text) !== null && _leafNode$text !== void 0 ? _leafNode$text : '';
|
|
44
33
|
}
|
|
45
34
|
});
|
|
46
|
-
}
|
|
47
|
-
function clipboardTextSerializerLegacy(slice) {
|
|
48
|
-
var text = '';
|
|
49
|
-
var blockSeparater = '\n\n';
|
|
50
|
-
slice.content.nodesBetween(0, slice.content.size, function (node) {
|
|
51
|
-
if (node.type.isBlock) {
|
|
52
|
-
text += blockSeparater;
|
|
53
|
-
}
|
|
54
|
-
if (node.type.name === 'paragraph') {
|
|
55
|
-
return true;
|
|
56
|
-
} else if (node.type.name === 'hardBreak') {
|
|
57
|
-
text += '\n';
|
|
58
|
-
} else if (node.type.name === 'text') {
|
|
59
|
-
text += node.text;
|
|
60
|
-
} else if (node.type.name === 'inlineCard') {
|
|
61
|
-
text += node.attrs.url;
|
|
62
|
-
} else if (node.type.name === 'blockCard') {
|
|
63
|
-
text += node.attrs.url;
|
|
64
|
-
} else if (node.type.name === 'mention') {
|
|
65
|
-
text += node.attrs.text;
|
|
66
|
-
} else {
|
|
67
|
-
text += node.textBetween(0, node.content.size, '\n\n');
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
});
|
|
71
|
-
return text.trim();
|
|
72
35
|
}
|
|
@@ -10,4 +10,3 @@ import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
10
10
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
11
11
|
*/
|
|
12
12
|
export declare function clipboardTextSerializer(slice: Slice): string;
|
|
13
|
-
export declare function clipboardTextSerializerSimplified(slice: Slice): string;
|
|
@@ -10,4 +10,3 @@ import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
10
10
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
11
11
|
*/
|
|
12
12
|
export declare function clipboardTextSerializer(slice: Slice): string;
|
|
13
|
-
export declare function clipboardTextSerializerSimplified(slice: Slice): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^87.
|
|
36
|
+
"@atlaskit/editor-common": "^87.12.0",
|
|
37
37
|
"@atlaskit/editor-markdown-transformer": "^5.11.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.7.0",
|
|
39
39
|
"@atlaskit/editor-plugin-annotation": "^1.19.0",
|
|
40
40
|
"@atlaskit/editor-plugin-better-type-history": "^1.7.0",
|
|
41
|
-
"@atlaskit/editor-plugin-card": "^2.
|
|
41
|
+
"@atlaskit/editor-plugin-card": "^2.13.0",
|
|
42
42
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-list": "^3.8.0",
|
|
44
|
-
"@atlaskit/editor-plugin-media": "^1.
|
|
44
|
+
"@atlaskit/editor-plugin-media": "^1.29.0",
|
|
45
45
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
46
46
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
47
47
|
"@atlaskit/media-client": "^27.3.0",
|
|
48
|
-
"@atlaskit/media-common": "^11.
|
|
48
|
+
"@atlaskit/media-common": "^11.4.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
@@ -112,18 +112,12 @@
|
|
|
112
112
|
"platform.editor.media.extended-resize-experience": {
|
|
113
113
|
"type": "boolean"
|
|
114
114
|
},
|
|
115
|
-
"platform.editor.allow-action-in-list": {
|
|
116
|
-
"type": "boolean"
|
|
117
|
-
},
|
|
118
115
|
"platform.editor.media.fix-copy-paste-excel_62g4s": {
|
|
119
116
|
"type": "boolean"
|
|
120
117
|
},
|
|
121
118
|
"platform.editor.multi-bodied-extension_0rygg": {
|
|
122
119
|
"type": "boolean"
|
|
123
120
|
},
|
|
124
|
-
"platform.editor.preserve-whitespace-clipboard-text-serialization": {
|
|
125
|
-
"type": "boolean"
|
|
126
|
-
},
|
|
127
121
|
"editor_inline_comments_paste_insert_nodes": {
|
|
128
122
|
"type": "boolean"
|
|
129
123
|
}
|