Skip to content

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

:bug: 数据库加载更多后的操作

Vanessac301a4ac0a06
diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts
index cd38f97fe1..51eb8920d3 100644
--- a/app/src/protyle/render/av/asset.ts
+++ b/app/src/protyle/render/av/asset.ts
@@ -13,7 +13,7 @@ import {previewImage} from "../../preview/image";
import {genAVValueHTML} from "./blockAttr";
import {hideMessage, showMessage} from "../../../dialog/message";
import {fetchPost} from "../../../util/fetch";
-import {hasClosestByClassName} from "../../util/hasClosest";
+import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
export const bindAssetEvent = (options: {
protyle: IProtyle,
@@ -334,35 +334,39 @@ export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTML
isUpload: true,
id: protyle.block.rootID
}, (response) => {
- hideMessage(msgId);
- const addUpdateValue: IAVCellAssetValue[] = [];
- Object.keys(response.data.succMap).forEach(key => {
- const type = pathPosix().extname(key).toLowerCase();
- const name = key.substring(0, key.length - type.length);
- if (Constants.SIYUAN_ASSETS_IMAGE.includes(type)) {
- addUpdateValue.push({
- type: "image",
- name,
- content: response.data.succMap[key],
- });
- } else {
- addUpdateValue.push({
- type: "file",
- name,
- content: response.data.succMap[key],
+ const blockElement = hasClosestBlock(cellElement);
+ if (blockElement) {
+ hideMessage(msgId);
+ const addUpdateValue: IAVCellAssetValue[] = [];
+ Object.keys(response.data.succMap).forEach(key => {
+ const type = pathPosix().extname(key).toLowerCase();
+ const name = key.substring(0, key.length - type.length);
+ if (Constants.SIYUAN_ASSETS_IMAGE.includes(type)) {
+ addUpdateValue.push({
+ type: "image",
+ name,
+ content: response.data.succMap[key],
+ });
+ } else {
+ addUpdateValue.push({
+ type: "file",
+ name,
+ content: response.data.succMap[key],
+ });
+ }
+ });
+ fetchPost("/api/av/renderAttributeView", {
+ id: avID,
+ pageSize: parseInt(blockElement.getAttribute("data-page-size")) || undefined,
+ }, (response) => {
+ updateAssetCell({
+ protyle,
+ data: response.data as IAV,
+ cellElements: [cellElement],
+ type: "addUpdate",
+ addUpdateValue
});
- }
- });
- fetchPost("/api/av/renderAttributeView", {
- id: avID,
- }, (response) => {
- updateAssetCell({
- protyle,
- data: response.data as IAV,
- cellElements: [cellElement],
- type: "addUpdate",
- addUpdateValue
});
- });
+ }
});
};