diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts
index 230916cd9..cf76f2b3b 100644
--- a/app/src/protyle/render/av/blockAttr.ts
+++ b/app/src/protyle/render/av/blockAttr.ts
@@ -2,8 +2,8 @@ import {fetchPost} from "../../../util/fetch";
import {addCol, getColIconByType} from "./col";
import {escapeAttr} from "../../../util/escape";
import * as dayjs from "dayjs";
-import {popTextCell} from "./cell";
-import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
+import {popTextCell, updateCellsValue} from "./cell";
+import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../../util/hasClosest";
import {unicode2Emoji} from "../../../emoji";
import {transaction} from "../../wysiwyg/transaction";
import {openMenuPanel} from "./openMenuPanel";
@@ -74,7 +74,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
if (item.type === "image") {
html += `
`;
} else {
- html += `${item.name}`;
+ html += `${item.name || item.content}`;
}
});
break;
@@ -282,8 +282,19 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"]
});
element.addEventListener("paste", (event) => {
const files = event.clipboardData.files;
- if (document.querySelector(".av__panel .b3-form__upload") && files && files.length > 0) {
- uploadFiles(protyle, files);
+ if (document.querySelector(".av__panel .b3-form__upload")) {
+ if (files && files.length > 0) {
+ uploadFiles(protyle, files);
+ } else {
+ const textPlain = event.clipboardData.getData("text/plain");
+ const target = event.target as HTMLElement;
+ const blockElement = hasClosestBlock(target)
+ const cellsElement = hasClosestByAttribute(target, "data-type","mAsset")
+ if (blockElement && cellsElement && textPlain) {
+ updateCellsValue(protyle, blockElement as HTMLElement, textPlain, [cellsElement], undefined, protyle.lute.Md2BlockDOM(textPlain));
+ document.querySelector(".av__panel")?.remove();
+ }
+ }
}
});
element.addEventListener("click", (event) => {
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index ef3966624..0b28250e9 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -190,6 +190,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
updateCellsValue(protyle, blockElement as HTMLElement, text, undefined, columns, html);
} else if (cellsElement.length > 0) {
updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns, html);
+ document.querySelector(".av__panel")?.remove();
} else if (hasClosestByClassName(range.startContainer, "av__title")) {
range.insertNode(document.createTextNode(text));
range.collapse(false);