Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14708

Vanessaa9ccee5d550e
diff --git a/app/src/protyle/upload/index.ts b/app/src/protyle/upload/index.ts
index e882fddebc..9a956c206a 100644
--- a/app/src/protyle/upload/index.ts
+++ b/app/src/protyle/upload/index.ts
@@ -122,7 +122,7 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {
let successFileText = "";
const keys = Object.keys(response.data.succMap);
// 插入多个资源文件时按文件名自然升序排列 Use natural ascending order when inserting multiple assets https://github.com/siyuan-note/siyuan/issues/14643
- keys.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
+ keys.sort((a, b) => a.localeCompare(b, undefined, {numeric: true}));
const avAssets: IAVCellAssetValue[] = [];
let hasImage = false;
keys.forEach((key, index) => {
@@ -149,7 +149,27 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {
}
});
- if ((nodeElement && nodeElement.classList.contains("av"))) {
+ if (document.querySelector(".av__panel")) {
+ 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) {
+ updateCellsValue(protyle, blockElement, avAssets, cellElements);
+ document.querySelector(".av__panel")?.remove();
+ return;
+ }
+ } else {
+ return;
+ }
+ } else if (nodeElement && nodeElement.classList.contains("av")) {
const cellElements: HTMLElement[] = [];
nodeElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(item => {
item.querySelectorAll(".av__cell").forEach((cellItem: HTMLElement) => {
@@ -167,30 +187,7 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {
}
if (cellElements.length > 0) {
updateCellsValue(protyle, nodeElement, avAssets, cellElements);
- document.querySelector(".av__panel")?.remove();
- return;
- } else {
return;
- }
- }
-
- if (document.querySelector(".av__panel")) {
- 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) {
- updateCellsValue(protyle, blockElement, avAssets, cellElements);
- document.querySelector(".av__panel")?.remove();
- return;
- }
} else {
return;
}