mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
bcbd895303
commit
97f74ea172
3 changed files with 46 additions and 28 deletions
|
@ -6,6 +6,7 @@ import {getAllTabs} from "../../layout/getAll";
|
||||||
import {App} from "../../index";
|
import {App} from "../../index";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {matchHotKey} from "../../protyle/util/hotKey";
|
import {matchHotKey} from "../../protyle/util/hotKey";
|
||||||
|
import {isWindow} from "../../util/functions";
|
||||||
|
|
||||||
export const windowKeyUp = (app: App, event: KeyboardEvent) => {
|
export const windowKeyUp = (app: App, event: KeyboardEvent) => {
|
||||||
window.siyuan.ctrlIsPressed = false;
|
window.siyuan.ctrlIsPressed = false;
|
||||||
|
@ -22,37 +23,52 @@ export const windowKeyUp = (app: App, event: KeyboardEvent) => {
|
||||||
let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||||
currentLiElement.classList.remove("b3-list-item--focus");
|
currentLiElement.classList.remove("b3-list-item--focus");
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.goToEditTabPrev.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.goToEditTabPrev.custom, event)) {
|
||||||
if (currentLiElement.previousElementSibling) {
|
while (true) {
|
||||||
currentLiElement.previousElementSibling.classList.add("b3-list-item--focus");
|
if (currentLiElement.previousElementSibling) {
|
||||||
} else if (currentLiElement.getAttribute("data-original")) {
|
currentLiElement = currentLiElement.previousElementSibling;
|
||||||
currentLiElement.parentElement.lastElementChild.classList.add("b3-list-item--focus");
|
} else if (currentLiElement.getAttribute("data-original")) {
|
||||||
currentLiElement.removeAttribute("data-original");
|
currentLiElement.removeAttribute("data-original");
|
||||||
} else if (currentLiElement.parentElement.nextElementSibling) {
|
currentLiElement = currentLiElement.parentElement.lastElementChild;
|
||||||
if (currentLiElement.parentElement.nextElementSibling.lastElementChild) {
|
} else if (currentLiElement.parentElement.nextElementSibling) {
|
||||||
currentLiElement.parentElement.nextElementSibling.lastElementChild.classList.add("b3-list-item--focus");
|
if (currentLiElement.parentElement.nextElementSibling.lastElementChild) {
|
||||||
} else {
|
currentLiElement = currentLiElement.parentElement.nextElementSibling.lastElementChild;
|
||||||
currentLiElement.parentElement.lastElementChild.classList.add("b3-list-item--focus");
|
} else {
|
||||||
|
currentLiElement = currentLiElement.parentElement.lastElementChild;
|
||||||
|
}
|
||||||
|
} else if (currentLiElement.parentElement.previousElementSibling) {
|
||||||
|
currentLiElement = currentLiElement.parentElement.previousElementSibling.lastElementChild;
|
||||||
|
} else if (isWindow()) {
|
||||||
|
currentLiElement = currentLiElement.parentElement.lastElementChild;
|
||||||
|
}
|
||||||
|
if (currentLiElement.getBoundingClientRect().height !== 0) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (currentLiElement.parentElement.previousElementSibling) {
|
|
||||||
currentLiElement.parentElement.previousElementSibling.lastElementChild.classList.add("b3-list-item--focus");
|
|
||||||
}
|
}
|
||||||
|
currentLiElement.classList.add("b3-list-item--focus");
|
||||||
} else {
|
} else {
|
||||||
if (currentLiElement.nextElementSibling) {
|
while (true) {
|
||||||
currentLiElement.nextElementSibling.classList.add("b3-list-item--focus");
|
if (currentLiElement.nextElementSibling) {
|
||||||
} else if (currentLiElement.getAttribute("data-original")) {
|
currentLiElement = currentLiElement.nextElementSibling;
|
||||||
currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus");
|
} else if (currentLiElement.getAttribute("data-original")) {
|
||||||
currentLiElement.removeAttribute("data-original");
|
currentLiElement.removeAttribute("data-original");
|
||||||
} else if (currentLiElement.parentElement.nextElementSibling) {
|
currentLiElement = currentLiElement.parentElement.firstElementChild;
|
||||||
if (currentLiElement.parentElement.nextElementSibling.firstElementChild) {
|
} else if (currentLiElement.parentElement.nextElementSibling) {
|
||||||
currentLiElement.parentElement.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus");
|
if (currentLiElement.parentElement.nextElementSibling.firstElementChild) {
|
||||||
} else {
|
currentLiElement = currentLiElement.parentElement.nextElementSibling.firstElementChild;
|
||||||
currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus");
|
} else {
|
||||||
|
currentLiElement = currentLiElement.parentElement.firstElementChild;
|
||||||
|
}
|
||||||
|
} else if (currentLiElement.parentElement.previousElementSibling) {
|
||||||
|
currentLiElement = currentLiElement.parentElement.previousElementSibling.firstElementChild;
|
||||||
|
} else if (isWindow()) {
|
||||||
|
currentLiElement = currentLiElement.parentElement.firstElementChild;
|
||||||
|
}
|
||||||
|
if (currentLiElement.getBoundingClientRect().height !== 0) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (currentLiElement.parentElement.previousElementSibling) {
|
|
||||||
currentLiElement.parentElement.previousElementSibling.firstElementChild.classList.add("b3-list-item--focus");
|
|
||||||
}
|
}
|
||||||
|
currentLiElement.classList.add("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
|
||||||
if (currentLiElement) {
|
if (currentLiElement) {
|
||||||
const rootId = currentLiElement.getAttribute("data-node-id");
|
const rootId = currentLiElement.getAttribute("data-node-id");
|
||||||
if (rootId) {
|
if (rootId) {
|
||||||
|
|
|
@ -667,7 +667,9 @@ export const resizeTopBar = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dragElement = toolbarElement.querySelector("#drag") as HTMLElement;
|
const dragElement = toolbarElement.querySelector("#drag") as HTMLElement;
|
||||||
|
if (!dragElement) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dragElement.style.padding = "";
|
dragElement.style.padding = "";
|
||||||
const barMoreElement = toolbarElement.querySelector("#barMore");
|
const barMoreElement = toolbarElement.querySelector("#barMore");
|
||||||
barMoreElement.classList.remove("fn__none");
|
barMoreElement.classList.remove("fn__none");
|
||||||
|
|
|
@ -196,11 +196,11 @@ export class Plugin {
|
||||||
iconElement.setAttribute("data-location", options.position || "right");
|
iconElement.setAttribute("data-location", options.position || "right");
|
||||||
resizeTopBar();
|
resizeTopBar();
|
||||||
}
|
}
|
||||||
if (isMobile()) {
|
if (isMobile() && window.siyuan.storage) {
|
||||||
if (!window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(iconElement.id)) {
|
if (!window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(iconElement.id)) {
|
||||||
document.querySelector("#menuAbout")?.after(iconElement);
|
document.querySelector("#menuAbout")?.after(iconElement);
|
||||||
}
|
}
|
||||||
} else if (!isWindow()) {
|
} else if (!isWindow() && window.siyuan.storage) {
|
||||||
if (window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(iconElement.id)) {
|
if (window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(iconElement.id)) {
|
||||||
iconElement.classList.add("fn__none");
|
iconElement.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue