mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-10 02:11:53 +08:00
🐛 手速太快,无法切换页签
This commit is contained in:
parent
bde581c8ad
commit
c5371760fd
@ -548,7 +548,10 @@ export class Wnd {
|
||||
|
||||
public moveTab(tab: Tab, nextId?: string) {
|
||||
this.element.querySelector(".layout-tab-container").append(tab.panelElement);
|
||||
|
||||
if (tab.model instanceof Editor) {
|
||||
// DOM 移动后 range 会变化,因此置空
|
||||
tab.model.editor.protyle.toolbar.range = null;
|
||||
}
|
||||
if (nextId) {
|
||||
// 只能用 find https://github.com/siyuan-note/siyuan/issues/3455
|
||||
this.children.find((item, index) => {
|
||||
|
@ -37,6 +37,7 @@ import {needSubscribe} from "./needSubscribe";
|
||||
import {Dialog} from "../dialog";
|
||||
import {unicode2Emoji} from "../emoji";
|
||||
import {deleteFile} from "../editor/deleteFile";
|
||||
import {escapeHtml} from "./escape";
|
||||
|
||||
const getRightBlock = (element: HTMLElement, x: number, y: number) => {
|
||||
let index = 1;
|
||||
@ -220,7 +221,27 @@ export const globalShortcut = () => {
|
||||
}
|
||||
}
|
||||
} else if (event.key === "Control") {
|
||||
const currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||
let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||
// 快速切换时,不触发 Tab
|
||||
if (currentLiElement.getAttribute("data-original")) {
|
||||
currentLiElement.classList.remove("b3-list-item--focus");
|
||||
if (event.shiftKey) {
|
||||
if (currentLiElement.previousElementSibling) {
|
||||
currentLiElement.previousElementSibling.classList.add("b3-list-item--focus");
|
||||
} else {
|
||||
currentLiElement.parentElement.lastElementChild.classList.add("b3-list-item--focus");
|
||||
currentLiElement.removeAttribute("data-original");
|
||||
}
|
||||
} else {
|
||||
if (currentLiElement.nextElementSibling) {
|
||||
currentLiElement.nextElementSibling.classList.add("b3-list-item--focus");
|
||||
} else {
|
||||
currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus");
|
||||
}
|
||||
}
|
||||
currentLiElement.removeAttribute("data-original");
|
||||
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||
}
|
||||
const currentType = currentLiElement.getAttribute("data-type") as TDockType;
|
||||
if (currentType) {
|
||||
getDockByType(currentType).toggleModel(currentType, true);
|
||||
@ -305,7 +326,7 @@ export const globalShortcut = () => {
|
||||
if (item.model instanceof Editor) {
|
||||
icon = `<span class="b3-list-item__graphic">${unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE)}</span>`;
|
||||
}
|
||||
tabHtml += `<li data-id="${item.id}" class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${item.title}</span></li>`;
|
||||
tabHtml += `<li data-id="${item.id}" class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${escapeHtml(item.title)}</span></li>`;
|
||||
});
|
||||
}
|
||||
switchDialog = new Dialog({
|
||||
|
Loading…
Reference in New Issue
Block a user