mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
559484b9c5
commit
c5f52904e9
3 changed files with 9 additions and 10 deletions
|
|
@ -278,8 +278,11 @@ export const hintTag = (key: string, protyle: IProtyle): IHintData[] => {
|
||||||
if (response.data.k && !hasKey) {
|
if (response.data.k && !hasKey) {
|
||||||
dataList.splice(0, 0, {
|
dataList.splice(0, 0, {
|
||||||
value: `#${response.data.k}#`,
|
value: `#${response.data.k}#`,
|
||||||
html: `<mark>${escapeHtml(response.data.k)}</mark>`,
|
html: `${window.siyuan.languages.new} <mark>${escapeHtml(response.data.k)}</mark>`,
|
||||||
});
|
});
|
||||||
|
if (dataList.length > 1) {
|
||||||
|
dataList[1].focus = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
protyle.hint.genHTML(dataList, protyle, true);
|
protyle.hint.genHTML(dataList, protyle, true);
|
||||||
});
|
});
|
||||||
|
|
@ -342,6 +345,8 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
|
||||||
value: "",
|
value: "",
|
||||||
html: window.siyuan.languages.emptyContent,
|
html: window.siyuan.languages.emptyContent,
|
||||||
});
|
});
|
||||||
|
} else if (response.data.newDoc && dataList.length > 1) {
|
||||||
|
dataList[1].focus = true;
|
||||||
}
|
}
|
||||||
protyle.hint.genHTML(dataList, protyle, true, isQuick);
|
protyle.hint.genHTML(dataList, protyle, true, isQuick);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -191,18 +191,11 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
} else {
|
} else {
|
||||||
this.element.style.display = "";
|
this.element.style.display = "";
|
||||||
}
|
}
|
||||||
let hasFocus = false;
|
|
||||||
data.forEach((hintData, i) => {
|
data.forEach((hintData, i) => {
|
||||||
// https://github.com/siyuan-note/siyuan/issues/1229 提示时,新建文件不应默认选中
|
// https://github.com/siyuan-note/siyuan/issues/1229 提示时,新建文件不应默认选中
|
||||||
let focusClass = "";
|
let focusClass = "";
|
||||||
if (i === 0) {
|
if ((i === 1 && data[i].focus ) ||
|
||||||
if (hintData.value.startsWith("((newFile ") && hintData.value.endsWith(`${Lute.Caret}'))`) && data.length > 1) {
|
(i === 0 && (data.length === 1 || !data[1].focus))) {
|
||||||
focusClass = "";
|
|
||||||
} else {
|
|
||||||
focusClass = " b3-list-item--focus";
|
|
||||||
hasFocus = true;
|
|
||||||
}
|
|
||||||
} else if (i === 1 && !hasFocus) {
|
|
||||||
focusClass = " b3-list-item--focus";
|
focusClass = " b3-list-item--focus";
|
||||||
}
|
}
|
||||||
if (hintData.html === "separator") {
|
if (hintData.html === "separator") {
|
||||||
|
|
|
||||||
1
app/src/types/protyle.d.ts
vendored
1
app/src/types/protyle.d.ts
vendored
|
|
@ -337,6 +337,7 @@ interface IHintData {
|
||||||
html: string;
|
html: string;
|
||||||
value: string;
|
value: string;
|
||||||
filter?: string[]
|
filter?: string[]
|
||||||
|
focus?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IHintExtend {
|
interface IHintExtend {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue