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/16638

Vanessa68b3d157ac9f
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 9beeb12d58..a5154561b6 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -770,7 +770,7 @@ export abstract class Constants {
public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif", ".tiff", ".tif"];
public static readonly SIYUAN_ASSETS_AUDIO: string[] = [".mp3", ".wav", ".ogg", ".m4a", ".aac", ".flac"];
public static readonly SIYUAN_ASSETS_VIDEO: string[] = [".mov", ".weba", ".mkv", ".mp4", ".webm"];
- public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE).concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO);
+ public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE, Constants.SIYUAN_ASSETS_AUDIO, Constants.SIYUAN_ASSETS_VIDEO);
public static readonly SIYUAN_ASSETS_SEARCH: string[] = [".txt", ".md", ".markdown", ".docx", ".xlsx", ".pptx", ".pdf", ".json", ".log", ".sql", ".html", ".xml", ".java", ".h", ".c",
".cpp", ".go", ".rs", ".swift", ".kt", ".py", ".php", ".js", ".css", ".ts", ".sh", ".bat", ".cmd", ".ini", ".yaml",
".rst", ".adoc", ".textile", ".opml", ".org", ".wiki", ".epub", ".cs"];
diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts
index 9e63514096..d3108ac937 100644
--- a/app/src/protyle/render/av/relation.ts
+++ b/app/src/protyle/render/av/relation.ts
@@ -460,7 +460,7 @@ export const getRelationHTML = (data: IAV, cellElements?: HTMLElement[]) => {
}
};
-export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, target: HTMLElement, cellElements: HTMLElement[]) => {
+export const setRelationCell = async (protyle: IProtyle, nodeElement: HTMLElement, target: HTMLElement, cellElements: HTMLElement[]) => {
const menuElement = hasClosestByClassName(target, "b3-menu");
if (!menuElement) {
return;
@@ -537,12 +537,22 @@ draggable="true">${genSelectItemHTML({
if (!separatorElement.nextElementSibling) {
separatorElement.insertAdjacentHTML("afterend", genSelectItemHTML({type: "empty"}));
}
+ updateCellsValue(protyle, nodeElement, newValue, cellElements);
} else {
const blockID = target.querySelector(".popover__block").getAttribute("data-id");
const content = target.querySelector("b").textContent;
const rowId = Lute.NewNodeID();
const bodyElement = hasClosestByClassName(cellElements[0], "av__body");
- transaction(protyle, [{
+ newValue.blockIDs.push(rowId);
+ newValue.contents.push({
+ type: "block",
+ block: {
+ content
+ },
+ isDetached: true
+ });
+ const updateOptions = await updateCellsValue(protyle, nodeElement, newValue, cellElements, null, null, true);
+ const doOperations: IOperation[] = [{
action: "insertAttrViewBlock",
ignoreDefaultFill: true,
avID: menuElement.firstElementChild.getAttribute("data-av-id"),
@@ -558,15 +568,8 @@ draggable="true">${genSelectItemHTML({
action: "doUpdateUpdated",
id: blockID,
data: dayjs().format("YYYYMMDDHHmmss"),
- }]);
- newValue.blockIDs.push(rowId);
- newValue.contents.push({
- type: "block",
- block: {
- content
- },
- isDetached: true
- });
+ }];
+ transaction(protyle, doOperations.concat(updateOptions.doOperations));
separatorElement.insertAdjacentHTML("beforebegin", `<button data-row-id="${rowId}" data-position="west" data-type="setRelationCell"
class="${target.className} ariaLabel" draggable="true">${genSelectItemHTML({
type: "selected",
@@ -576,6 +579,5 @@ class="${target.className} ariaLabel" draggable="true">${genSelectItemHTML({
})}</button>`);
}
}
- updateCellsValue(protyle, nodeElement, newValue, cellElements);
updateCopyRelatedItems(menuElement);
};