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

Vanessa96dedfcb0878
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index 906da641b9..38f263c506 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -46,7 +46,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
filter: ["ai chat"],
value: Constants.ZWSP + 5,
html: '<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconSparkles"></use></svg><span class="b3-list-item__text">AI Chat</span></div>',
- },{
+ }, {
filter: ["数据库", "视图", "shujuku", "shitu", "sjk", "st", "database", "view", "db"],
value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconDatabase"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.database}</span></div>`,
@@ -246,7 +246,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
filter: ["移除样式", "yichuyangshi", "ycys", "remove style"],
value: `style${Constants.ZWSP}`,
html: `<div class="b3-list-item__first"><div class="color__square">A</div><span class="b3-list-item__text">${window.siyuan.languages.clearFontStyle}</span></div>`,
- },{
+ }, {
value: "",
html: "separator",
}];
@@ -352,7 +352,7 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH
k: key,
id: nodeElement ? nodeElement.getAttribute("data-node-id") : protyle.block.parentID,
beforeLen: Math.floor((Math.max(protyle.element.clientWidth / 2, 320) - 58) / 28.8),
- rootID: protyle.block.rootID,
+ rootID: source === "av" ? "" : protyle.block.rootID,
isSquareBrackets: ["[[", "【【"].includes(protyle.hint.splitChar)
}, (response) => {
const dataList: IHintData[] = [];
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index 72ba693ae8..0513dbade5 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -305,22 +305,22 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
return;
}
event.stopPropagation();
- this.genSearchHTML(protyle, searchElement, nodeElement, oldValue);
+ this.genSearchHTML(protyle, searchElement, nodeElement, oldValue, source);
});
searchElement.addEventListener("compositionend", (event: InputEvent) => {
event.stopPropagation();
- this.genSearchHTML(protyle, searchElement, nodeElement, oldValue);
+ this.genSearchHTML(protyle, searchElement, nodeElement, oldValue, source);
});
}
}
- private genSearchHTML(protyle: IProtyle, searchElement: HTMLInputElement, nodeElement: false | HTMLElement, oldValue: string) {
+ private genSearchHTML(protyle: IProtyle, searchElement: HTMLInputElement, nodeElement: false | HTMLElement, oldValue: string, source: THintSource) {
this.element.lastElementChild.innerHTML = '<div class="ft__center"><img style="height:32px;width:32px;" src="/stage/loading-pure.svg"></div>';
fetchPost("/api/search/searchRefBlock", {
k: searchElement.value,
id: nodeElement ? nodeElement.getAttribute("data-node-id") : protyle.block.parentID,
beforeLen: Math.floor((Math.max(protyle.element.clientWidth / 2, 320) - 58) / 28.8),
- rootID: protyle.block.rootID,
+ rootID: source === "av" ? "" : protyle.block.rootID,
}, (response) => {
let searchHTML = "";
if (response.data.newDoc) {