@atlaskit/editor-plugin-paste 6.4.0 → 7.0.1
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,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 7.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`264716e45b5c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/264716e45b5c4) -
|
|
8
|
+
within the editor: ensures links pasted into image captions do not replace the selected text
|
|
9
|
+
content
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.0.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 6.4.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -1125,8 +1125,38 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1125
1125
|
return true;
|
|
1126
1126
|
};
|
|
1127
1127
|
}
|
|
1128
|
+
function isUrlString(text) {
|
|
1129
|
+
try {
|
|
1130
|
+
new URL(text);
|
|
1131
|
+
return true;
|
|
1132
|
+
} catch (_unused) {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function isLinkOrUrlString(slice, schema) {
|
|
1137
|
+
if (slice.content.childCount !== 1 || !(0, _utils.isParagraph)(slice.content.child(0), schema)) {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
var paragraph = slice.content.child(0);
|
|
1141
|
+
if (paragraph.content.childCount !== 1 || !(0, _utils.isText)(paragraph.content.child(0), schema)) {
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
var _paragraph$content$ch = paragraph.content.child(0),
|
|
1145
|
+
marks = _paragraph$content$ch.marks,
|
|
1146
|
+
_paragraph$content$ch2 = _paragraph$content$ch.text,
|
|
1147
|
+
text = _paragraph$content$ch2 === void 0 ? '' : _paragraph$content$ch2;
|
|
1148
|
+
var hasLinkMark = marks.some(function (mark) {
|
|
1149
|
+
return (0, _utils.isLinkMark)(mark, schema);
|
|
1150
|
+
});
|
|
1151
|
+
return hasLinkMark || isUrlString(text);
|
|
1152
|
+
}
|
|
1128
1153
|
function handlePasteIntoCaption(slice) {
|
|
1129
1154
|
return function (state, dispatch) {
|
|
1155
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_captions_on_copy')) {
|
|
1156
|
+
if (isLinkOrUrlString(slice, state.schema)) {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1130
1160
|
var caption = state.schema.nodes.caption;
|
|
1131
1161
|
var tr = state.tr;
|
|
1132
1162
|
if ((0, _utils2.hasParentNodeOfType)(caption)(state.selection)) {
|
|
@@ -1108,8 +1108,36 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1108
1108
|
return true;
|
|
1109
1109
|
};
|
|
1110
1110
|
}
|
|
1111
|
+
function isUrlString(text) {
|
|
1112
|
+
try {
|
|
1113
|
+
new URL(text);
|
|
1114
|
+
return true;
|
|
1115
|
+
} catch {
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
function isLinkOrUrlString(slice, schema) {
|
|
1120
|
+
if (slice.content.childCount !== 1 || !isParagraph(slice.content.child(0), schema)) {
|
|
1121
|
+
return false;
|
|
1122
|
+
}
|
|
1123
|
+
const paragraph = slice.content.child(0);
|
|
1124
|
+
if (paragraph.content.childCount !== 1 || !isText(paragraph.content.child(0), schema)) {
|
|
1125
|
+
return false;
|
|
1126
|
+
}
|
|
1127
|
+
const {
|
|
1128
|
+
marks,
|
|
1129
|
+
text = ''
|
|
1130
|
+
} = paragraph.content.child(0);
|
|
1131
|
+
const hasLinkMark = marks.some(mark => isLinkMark(mark, schema));
|
|
1132
|
+
return hasLinkMark || isUrlString(text);
|
|
1133
|
+
}
|
|
1111
1134
|
export function handlePasteIntoCaption(slice) {
|
|
1112
1135
|
return (state, dispatch) => {
|
|
1136
|
+
if (fg('platform_editor_fix_captions_on_copy')) {
|
|
1137
|
+
if (isLinkOrUrlString(slice, state.schema)) {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1113
1141
|
const {
|
|
1114
1142
|
caption
|
|
1115
1143
|
} = state.schema.nodes;
|
|
@@ -1099,8 +1099,38 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1099
1099
|
return true;
|
|
1100
1100
|
};
|
|
1101
1101
|
}
|
|
1102
|
+
function isUrlString(text) {
|
|
1103
|
+
try {
|
|
1104
|
+
new URL(text);
|
|
1105
|
+
return true;
|
|
1106
|
+
} catch (_unused) {
|
|
1107
|
+
return false;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
function isLinkOrUrlString(slice, schema) {
|
|
1111
|
+
if (slice.content.childCount !== 1 || !isParagraph(slice.content.child(0), schema)) {
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
var paragraph = slice.content.child(0);
|
|
1115
|
+
if (paragraph.content.childCount !== 1 || !isText(paragraph.content.child(0), schema)) {
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
var _paragraph$content$ch = paragraph.content.child(0),
|
|
1119
|
+
marks = _paragraph$content$ch.marks,
|
|
1120
|
+
_paragraph$content$ch2 = _paragraph$content$ch.text,
|
|
1121
|
+
text = _paragraph$content$ch2 === void 0 ? '' : _paragraph$content$ch2;
|
|
1122
|
+
var hasLinkMark = marks.some(function (mark) {
|
|
1123
|
+
return isLinkMark(mark, schema);
|
|
1124
|
+
});
|
|
1125
|
+
return hasLinkMark || isUrlString(text);
|
|
1126
|
+
}
|
|
1102
1127
|
export function handlePasteIntoCaption(slice) {
|
|
1103
1128
|
return function (state, dispatch) {
|
|
1129
|
+
if (fg('platform_editor_fix_captions_on_copy')) {
|
|
1130
|
+
if (isLinkOrUrlString(slice, state.schema)) {
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1104
1134
|
var caption = state.schema.nodes.caption;
|
|
1105
1135
|
var tr = state.tr;
|
|
1106
1136
|
if (hasParentNodeOfType(caption)(state.selection)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,35 +30,35 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^51.2.0",
|
|
31
31
|
"@atlaskit/code": "^17.2.0",
|
|
32
32
|
"@atlaskit/editor-markdown-transformer": "^5.19.0",
|
|
33
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
34
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
35
|
-
"@atlaskit/editor-plugin-better-type-history": "^
|
|
36
|
-
"@atlaskit/editor-plugin-card": "^
|
|
37
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
38
|
-
"@atlaskit/editor-plugin-list": "^
|
|
39
|
-
"@atlaskit/editor-plugin-media": "^
|
|
40
|
-
"@atlaskit/editor-plugin-mentions": "^
|
|
33
|
+
"@atlaskit/editor-plugin-analytics": "^6.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-annotation": "^6.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-better-type-history": "^6.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-card": "^11.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-feature-flags": "^5.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-list": "^8.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-media": "^8.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-mentions": "^8.0.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
43
|
"@atlaskit/insm": "^0.1.0",
|
|
44
44
|
"@atlaskit/media-client": "^35.3.0",
|
|
45
45
|
"@atlaskit/media-common": "^12.3.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^12.32.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
50
|
"uuid": "^3.1.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^
|
|
53
|
+
"@atlaskit/editor-common": "^110.2.0",
|
|
54
54
|
"react": "^18.2.0",
|
|
55
55
|
"react-dom": "^18.2.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@af/visual-regression": "workspace:^",
|
|
59
|
-
"@atlaskit/editor-plugin-block-type": "^
|
|
60
|
-
"@atlaskit/editor-plugin-history": "^
|
|
61
|
-
"@atlaskit/editor-plugin-type-ahead": "^
|
|
59
|
+
"@atlaskit/editor-plugin-block-type": "^9.0.0",
|
|
60
|
+
"@atlaskit/editor-plugin-history": "^6.0.0",
|
|
61
|
+
"@atlaskit/editor-plugin-type-ahead": "^6.1.0",
|
|
62
62
|
"@atlaskit/ssr": "workspace:^",
|
|
63
63
|
"@testing-library/react": "^13.4.0",
|
|
64
64
|
"wait-for-expect": "^1.2.0"
|