@atlaskit/editor-plugin-paste 2.0.11 → 2.0.13
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 +12 -0
- package/dist/cjs/editor-commands/commands.js +18 -1
- package/dist/cjs/pm-plugins/analytics.js +68 -28
- package/dist/cjs/pm-plugins/main.js +16 -0
- package/dist/cjs/pm-plugins/util/edge-cases/lists.js +3 -0
- package/dist/cjs/pm-plugins/util/handlers.js +19 -2
- package/dist/cjs/pm-plugins/util/index.js +23 -1
- package/dist/cjs/pm-plugins/util/tinyMCE.js +6 -1
- package/dist/es2019/editor-commands/commands.js +18 -1
- package/dist/es2019/pm-plugins/analytics.js +46 -10
- package/dist/es2019/pm-plugins/main.js +17 -1
- package/dist/es2019/pm-plugins/media.js +1 -1
- package/dist/es2019/pm-plugins/util/edge-cases/lists.js +3 -0
- package/dist/es2019/pm-plugins/util/handlers.js +23 -4
- package/dist/es2019/pm-plugins/util/index.js +23 -1
- package/dist/es2019/pm-plugins/util/tinyMCE.js +6 -1
- package/dist/esm/editor-commands/commands.js +18 -1
- package/dist/esm/pm-plugins/analytics.js +68 -28
- package/dist/esm/pm-plugins/main.js +16 -0
- package/dist/esm/pm-plugins/util/edge-cases/lists.js +3 -0
- package/dist/esm/pm-plugins/util/handlers.js +19 -2
- package/dist/esm/pm-plugins/util/index.js +23 -1
- package/dist/esm/pm-plugins/util/tinyMCE.js +6 -1
- package/package.json +5 -5
|
@@ -15,12 +15,18 @@ export function isPastedFromExcel(html) {
|
|
|
15
15
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:excel') >= 0;
|
|
16
16
|
}
|
|
17
17
|
function isPastedFromDropboxPaper(html) {
|
|
18
|
+
// Ignored via go/ees005
|
|
19
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
18
20
|
return !!html && !!html.match(/class=\"\s?author-d-.+"/gim);
|
|
19
21
|
}
|
|
20
22
|
function isPastedFromGoogleDocs(html) {
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
21
25
|
return !!html && !!html.match(/id=\"docs-internal-guid-.+"/gim);
|
|
22
26
|
}
|
|
23
27
|
function isPastedFromGoogleSpreadSheets(html) {
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
24
30
|
return !!html && !!html.match(/data-sheets-.+=/gim);
|
|
25
31
|
}
|
|
26
32
|
function isPastedFromPages(html) {
|
|
@@ -33,9 +39,13 @@ export var isSingleLine = function isSingleLine(text) {
|
|
|
33
39
|
return !!text && text.trim().split('\n').length === 1;
|
|
34
40
|
};
|
|
35
41
|
export function htmlContainsSingleFile(html) {
|
|
42
|
+
// Ignored via go/ees005
|
|
43
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
36
44
|
return !!html.match(/<img .*>/) && !isMediaBlobUrl(html);
|
|
37
45
|
}
|
|
38
46
|
export function getPasteSource(event) {
|
|
47
|
+
// Ignored via go/ees005
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
39
49
|
var html = event.clipboardData.getData('text/html');
|
|
40
50
|
if (isPastedFromDropboxPaper(html)) {
|
|
41
51
|
return 'dropbox-paper';
|
|
@@ -71,7 +81,11 @@ export function getPasteSource(event) {
|
|
|
71
81
|
* check behaviour of double quotes in url strings
|
|
72
82
|
*/
|
|
73
83
|
export function escapeLinks(text) {
|
|
84
|
+
// Ignored via go/ees005
|
|
85
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
74
86
|
return text.replace(/(\[([^\]]+)\]\()?((https?|ftp|jamfselfservice):\/\/[^\s>"]+)/g, function (str) {
|
|
87
|
+
// Ignored via go/ees005
|
|
88
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
75
89
|
return str.match(/^(https?|ftp|jamfselfservice):\/\/[^\s>"]+$/) ? "<".concat(str, ">") : str;
|
|
76
90
|
});
|
|
77
91
|
}
|
|
@@ -161,11 +175,19 @@ export var htmlHasInvalidLinkTags = function htmlHasInvalidLinkTags(html) {
|
|
|
161
175
|
// <li><a href="http://www.atlassian.com\"<a> href="http://www.atlassian.com\"http://www.atlassian.com</a></a></li>">
|
|
162
176
|
export var removeDuplicateInvalidLinks = function removeDuplicateInvalidLinks(html) {
|
|
163
177
|
if (htmlHasInvalidLinkTags(html)) {
|
|
178
|
+
// Ignored via go/ees005
|
|
179
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
164
180
|
var htmlArray = html.split(/(?=<a)/);
|
|
165
181
|
var htmlArrayWithoutInvalidLinks = htmlArray.filter(function (item) {
|
|
166
182
|
return !(item.includes('<a') && item.includes('"></a>')) && !(item.includes('<a') && !item.includes('</a>'));
|
|
167
183
|
});
|
|
168
|
-
var fixedHtml = htmlArrayWithoutInvalidLinks.join('')
|
|
184
|
+
var fixedHtml = htmlArrayWithoutInvalidLinks.join('')
|
|
185
|
+
// Ignored via go/ees005
|
|
186
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
187
|
+
.replace(/<\/a><\/a>/gi, '</a>')
|
|
188
|
+
// Ignored via go/ees005
|
|
189
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
190
|
+
.replace(/<a>/gi, '<a');
|
|
169
191
|
return fixedHtml;
|
|
170
192
|
}
|
|
171
193
|
return html;
|
|
@@ -7,7 +7,10 @@ var isPastedFromTinyMCE = function isPastedFromTinyMCE(pasteEvent) {
|
|
|
7
7
|
})) !== null && _pasteEvent$clipboard !== void 0 ? _pasteEvent$clipboard : false;
|
|
8
8
|
};
|
|
9
9
|
export var isPastedFromTinyMCEConfluence = function isPastedFromTinyMCEConfluence(pasteEvent, html) {
|
|
10
|
-
return isPastedFromTinyMCE(pasteEvent) && !!html &&
|
|
10
|
+
return isPastedFromTinyMCE(pasteEvent) && !!html &&
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
13
|
+
!!html.match(/class=\"\s?(confluenceTd|confluenceTh|confluenceTable).+"/gim);
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -116,6 +119,8 @@ var fillIncompleteRowWithEmptyCells = function fillIncompleteRowWithEmptyCells(d
|
|
|
116
119
|
* headers exist.
|
|
117
120
|
*/
|
|
118
121
|
export var tryReconstructTableRows = function tryReconstructTableRows(doc) {
|
|
122
|
+
// Ignored via go/ees005
|
|
123
|
+
// eslint-disable-next-line prefer-const
|
|
119
124
|
var _getTableElementsInfo = getTableElementsInfo(doc),
|
|
120
125
|
cellCount = _getTableElementsInfo.cellCount,
|
|
121
126
|
thCount = _getTableElementsInfo.thCount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/editor-common": "^98.0.0",
|
|
35
35
|
"@atlaskit/editor-markdown-transformer": "^5.13.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-annotation": "^1.26.0",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-mentions": "^2.10.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
46
|
-
"@atlaskit/media-client": "^
|
|
46
|
+
"@atlaskit/media-client": "^29.0.0",
|
|
47
47
|
"@atlaskit/media-common": "^11.7.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^2.31.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"uuid": "^3.1.0"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@af/visual-regression": "*",
|
|
60
60
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
61
|
-
"@atlaskit/editor-plugin-block-type": "^4.
|
|
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",
|
|
64
64
|
"@atlaskit/ssr": "*",
|