Vanessa 2024-04-07 09:09:28 +08:00
parent d697f2799f
commit 96dedfcb08
2 changed files with 7 additions and 7 deletions

View file

@ -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[] = [];

View file

@ -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) {