mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-19 02:21:38 +08:00
This commit is contained in:
parent
cbddfb1962
commit
e014d6e1f7
@ -69,9 +69,13 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
|
||||
let target = event.target as HTMLElement;
|
||||
while (!target.isSameNode(switchDialog.element)) {
|
||||
if (target.classList.contains("b3-list-item")) {
|
||||
const currentType = target.getAttribute("data-type") as TDockType;
|
||||
const currentType = target.getAttribute("data-type");
|
||||
if (currentType) {
|
||||
getDockByType(currentType).toggleModel(currentType, true);
|
||||
if (currentType === "riffCard") {
|
||||
openCard();
|
||||
} else {
|
||||
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
||||
}
|
||||
} else {
|
||||
const currentId = target.getAttribute("data-id");
|
||||
getAllTabs().find(item => {
|
||||
@ -358,9 +362,13 @@ export const globalShortcut = () => {
|
||||
currentLiElement.removeAttribute("data-original");
|
||||
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||
}
|
||||
const currentType = currentLiElement.getAttribute("data-type") as TDockType;
|
||||
const currentType = currentLiElement.getAttribute("data-type");
|
||||
if (currentType) {
|
||||
getDockByType(currentType).toggleModel(currentType, true);
|
||||
if (currentType === "riffCard") {
|
||||
openCard()
|
||||
} else {
|
||||
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
||||
}
|
||||
if (document.activeElement) {
|
||||
(document.activeElement as HTMLElement).blur();
|
||||
}
|
||||
@ -465,9 +473,14 @@ export const globalShortcut = () => {
|
||||
}
|
||||
let dockHtml = "";
|
||||
if (!isTabWindow) {
|
||||
dockHtml = '<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">';
|
||||
dockHtml = `<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">
|
||||
<li data-type="riffCard" data-index="0" class="b3-list-item${!tabHtml ? " b3-list-item--focus" : ""}">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconRiffCard"></use></svg>
|
||||
<span class="b3-list-item__text">${window.siyuan.languages.riffCard}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.riffCard.custom)}</span>
|
||||
</li>`;
|
||||
getAllDocks().forEach((item, index) => {
|
||||
dockHtml += `<li data-type="${item.type}" data-index="${index}" class="b3-list-item${(!tabHtml && !dockHtml) ? " b3-list-item--focus" : ""}">
|
||||
dockHtml += `<li data-type="${item.type}" data-index="${index + 1}" class="b3-list-item">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>
|
||||
<span class="b3-list-item__text">${window.siyuan.languages[item.hotkeyLangId]}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}</span>
|
||||
@ -915,9 +928,13 @@ const dialogArrow = (element: HTMLElement, event: KeyboardEvent) => {
|
||||
(sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus");
|
||||
}
|
||||
} else if (event.key === "Enter") {
|
||||
const currentType = currentLiElement.getAttribute("data-type") as TDockType;
|
||||
const currentType = currentLiElement.getAttribute("data-type");
|
||||
if (currentType) {
|
||||
getDockByType(currentType).toggleModel(currentType, true);
|
||||
if (currentType === "riffCard") {
|
||||
openCard()
|
||||
} else {
|
||||
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
||||
}
|
||||
} else {
|
||||
openFileById({
|
||||
id: currentLiElement.getAttribute("data-node-id"),
|
||||
@ -963,9 +980,14 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
|
||||
});
|
||||
let dockHtml = "";
|
||||
if (!isWindow()) {
|
||||
dockHtml = '<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">';
|
||||
dockHtml = `<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">
|
||||
<li data-type="riffCard" data-index="0" class="b3-list-item${!tabHtml ? " b3-list-item--focus" : ""}">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconRiffCard"></use></svg>
|
||||
<span class="b3-list-item__text">${window.siyuan.languages.riffCard}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.riffCard.custom)}</span>
|
||||
</li>`;
|
||||
getAllDocks().forEach((item, index) => {
|
||||
dockHtml += `<li data-type="${item.type}" data-index="${index}" class="b3-list-item${(!tabHtml && !dockHtml) ? " b3-list-item--focus" : ""}">
|
||||
dockHtml += `<li data-type="${item.type}" data-index="${index + 1}" class="b3-list-item">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>
|
||||
<span class="b3-list-item__text">${window.siyuan.languages[item.hotkeyLangId]}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}</span>
|
||||
|
Loading…
Reference in New Issue
Block a user