This commit is contained in:
parent
92bc52c6ab
commit
421297d338
2 changed files with 21 additions and 6 deletions
|
@ -7,6 +7,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
|||
import {unicode2Emoji} from "../../../emoji";
|
||||
import {transaction} from "../../wysiwyg/transaction";
|
||||
import {openMenuPanel} from "./openMenuPanel";
|
||||
import {uploadFiles} from "../../upload";
|
||||
|
||||
const genAVRollupHTML = (value: IAVCellValue) => {
|
||||
let html = "";
|
||||
|
@ -274,6 +275,12 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"]
|
|||
window.siyuan.dragElement = undefined;
|
||||
}
|
||||
});
|
||||
element.addEventListener("paste", (event) => {
|
||||
const files = event.clipboardData.files;
|
||||
if (document.querySelector(".av__panel .b3-form__upload") && files && files.length > 0) {
|
||||
uploadFiles(protyle, files);
|
||||
}
|
||||
})
|
||||
element.addEventListener("click", (event) => {
|
||||
let target = event.target as HTMLElement;
|
||||
const blockElement = hasClosestBlock(target);
|
||||
|
@ -293,6 +300,11 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"]
|
|||
event.preventDefault();
|
||||
break;
|
||||
} else if (type === "mAsset") {
|
||||
element.querySelectorAll('.custom-attr__avvalue[data-type="mAsset"]').forEach(item => {
|
||||
item.removeAttribute("data-active");
|
||||
})
|
||||
target.setAttribute("data-active", "true");
|
||||
target.focus();
|
||||
popTextCell(protyle, [target], "mAsset");
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
|
@ -170,12 +170,15 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {
|
|||
}
|
||||
|
||||
if (document.querySelector(".av__panel")) {
|
||||
const cellElements: HTMLElement[] = [];
|
||||
protyle.wysiwyg.element.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => {
|
||||
if (getTypeByCellElement(item) === "mAsset") {
|
||||
cellElements.push(item);
|
||||
}
|
||||
});
|
||||
const cellElements: HTMLElement[] = [document.querySelector('.custom-attr__avvalue[data-type="mAsset"][data-active="true"]')];
|
||||
if (!cellElements[0]) {
|
||||
cellElements.splice(0, 1);
|
||||
protyle.wysiwyg.element.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => {
|
||||
if (getTypeByCellElement(item) === "mAsset") {
|
||||
cellElements.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (cellElements.length > 0) {
|
||||
const blockElement = hasClosestBlock(cellElements[0]);
|
||||
if (blockElement) {
|
||||
|
|
Loading…
Add table
Reference in a new issue