mirror of
https://github.com/docmost/docmost.git
synced 2026-05-20 00:14:10 +08:00
fix: spreadsheets paste (#1982)
This commit is contained in:
@@ -54,7 +54,10 @@ export const handlePaste = (
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.clipboardData?.files.length) {
|
const htmlData = event.clipboardData?.getData("text/html");
|
||||||
|
const hasHtmlTable = htmlData && /<table[\s>]/i.test(htmlData);
|
||||||
|
|
||||||
|
if (event.clipboardData?.files.length && !hasHtmlTable) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
for (const file of event.clipboardData.files) {
|
for (const file of event.clipboardData.files) {
|
||||||
const pos = editor.state.selection.from;
|
const pos = editor.state.selection.from;
|
||||||
@@ -65,7 +68,6 @@ export const handlePaste = (
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const htmlData = event.clipboardData?.getData("text/html");
|
|
||||||
if (htmlData && ATTACHMENT_URL_RE.test(htmlData)) {
|
if (htmlData && ATTACHMENT_URL_RE.test(htmlData)) {
|
||||||
const pasteFrom = editor.state.selection.from;
|
const pasteFrom = editor.state.selection.from;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user