mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
70aa089372
commit
2c2bd2a379
2 changed files with 11 additions and 10 deletions
|
|
@ -137,10 +137,10 @@ export const keymap = {
|
||||||
},
|
},
|
||||||
_search(value: string, keymapString: string) {
|
_search(value: string, keymapString: string) {
|
||||||
keymap.element.querySelectorAll("#keymapList .b3-list-item--hide-action > .b3-list-item__text").forEach(item => {
|
keymap.element.querySelectorAll("#keymapList .b3-list-item--hide-action > .b3-list-item__text").forEach(item => {
|
||||||
const liElement = item.parentElement
|
const liElement = item.parentElement;
|
||||||
let matchedKeymap = false;
|
let matchedKeymap = false;
|
||||||
if (keymapString === "" || (item.nextElementSibling.nextElementSibling as HTMLInputElement).value.indexOf(updateHotkeyTip(keymapString)) > -1) {
|
if (keymapString === "" || (item.nextElementSibling.nextElementSibling as HTMLInputElement).value.indexOf(updateHotkeyTip(keymapString)) > -1) {
|
||||||
matchedKeymap = true
|
matchedKeymap = true;
|
||||||
}
|
}
|
||||||
if ((item.textContent.toLowerCase().indexOf(value.toLowerCase()) > -1 || value === "") && matchedKeymap) {
|
if ((item.textContent.toLowerCase().indexOf(value.toLowerCase()) > -1 || value === "") && matchedKeymap) {
|
||||||
liElement.classList.remove("fn__none");
|
liElement.classList.remove("fn__none");
|
||||||
|
|
@ -150,14 +150,14 @@ export const keymap = {
|
||||||
liElement.classList.add("fn__none");
|
liElement.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
if (!liElement.nextElementSibling) {
|
if (!liElement.nextElementSibling) {
|
||||||
const toggleElement = liElement.parentElement.previousElementSibling
|
const toggleElement = liElement.parentElement.previousElementSibling;
|
||||||
const toggleIconElement = toggleElement.querySelector(".b3-list-item__arrow")
|
const toggleIconElement = toggleElement.querySelector(".b3-list-item__arrow");
|
||||||
if (value === "" && keymapString === "") {
|
if (value === "" && keymapString === "") {
|
||||||
// 复原折叠状态
|
// 复原折叠状态
|
||||||
if (toggleIconElement.classList.contains("b3-list-item__arrow--open")) {
|
if (toggleIconElement.classList.contains("b3-list-item__arrow--open")) {
|
||||||
liElement.parentElement.classList.remove("fn__none")
|
liElement.parentElement.classList.remove("fn__none");
|
||||||
} else {
|
} else {
|
||||||
liElement.parentElement.classList.add("fn__none")
|
liElement.parentElement.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 隐藏没有子项的快捷键项目
|
// 隐藏没有子项的快捷键项目
|
||||||
|
|
@ -169,13 +169,13 @@ export const keymap = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 编辑器中三级菜单单独处理
|
// 编辑器中三级菜单单独处理
|
||||||
const editorKeymapElement = keymap.element.querySelector("#keymapList").lastElementChild
|
const editorKeymapElement = keymap.element.querySelector("#keymapList").lastElementChild;
|
||||||
if (value === "" && keymapString === "") {
|
if (value === "" && keymapString === "") {
|
||||||
// 复原折叠状态
|
// 复原折叠状态
|
||||||
if (editorKeymapElement.querySelector(".b3-list-item__arrow").classList.contains("b3-list-item__arrow--open")) {
|
if (editorKeymapElement.querySelector(".b3-list-item__arrow").classList.contains("b3-list-item__arrow--open")) {
|
||||||
editorKeymapElement.lastElementChild.classList.remove("fn__none")
|
editorKeymapElement.lastElementChild.classList.remove("fn__none");
|
||||||
} else {
|
} else {
|
||||||
editorKeymapElement.lastElementChild.classList.add("fn__none")
|
editorKeymapElement.lastElementChild.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 隐藏没有子项的快捷键项目
|
// 隐藏没有子项的快捷键项目
|
||||||
|
|
@ -207,7 +207,7 @@ export const keymap = {
|
||||||
keymap._search(searchElement.value, keymapStr);
|
keymap._search(searchElement.value, keymapStr);
|
||||||
});
|
});
|
||||||
keymap.element.querySelector("#clearSearchBtn").addEventListener("click", () => {
|
keymap.element.querySelector("#clearSearchBtn").addEventListener("click", () => {
|
||||||
searchElement.value = ""
|
searchElement.value = "";
|
||||||
searchKeymapElement.value = "";
|
searchKeymapElement.value = "";
|
||||||
keymap._search("", "");
|
keymap._search("", "");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -807,6 +807,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
icon: "iconRefresh",
|
icon: "iconRefresh",
|
||||||
click() {
|
click() {
|
||||||
removeLink(linkElement, protyle.toolbar.range);
|
removeLink(linkElement, protyle.toolbar.range);
|
||||||
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
if (linkAddress?.startsWith("assets/")) {
|
if (linkAddress?.startsWith("assets/")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue