Vanessa 2023-12-01 20:46:42 +08:00
parent b99c89f6ec
commit aba4169e7f
6 changed files with 17 additions and 13 deletions

View file

@ -44,6 +44,10 @@
} }
} }
&__views {
align-items: center;
}
&__title { &__title {
outline: none; outline: none;
font-weight: bold; font-weight: bold;

View file

@ -491,7 +491,7 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {
if (matchHotKey(window.siyuan.config.keymap.general.selectOpen1.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.selectOpen1.custom, event)) {
event.preventDefault(); event.preventDefault();
const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") || const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") ||
document.querySelector(".layout-tab-bar > .item--focus"); document.querySelector("ul.layout-tab-bar > .item--focus");
if (element) { if (element) {
const tab = getInstanceById(element.getAttribute("data-id")) as Tab; const tab = getInstanceById(element.getAttribute("data-id")) as Tab;
if (tab && tab.model instanceof Editor) { if (tab && tab.model instanceof Editor) {
@ -1119,9 +1119,9 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
return; return;
} }
let tabHtml = ""; let tabHtml = "";
let currentTabElement = document.querySelector(".layout__wnd--active .layout-tab-bar > .item--focus"); let currentTabElement = document.querySelector(".layout__wnd--active ul.layout-tab-bar > .item--focus");
if (!currentTabElement) { if (!currentTabElement) {
currentTabElement = document.querySelector(".layout-tab-bar > .item--focus"); currentTabElement = document.querySelector("ul.layout-tab-bar > .item--focus");
} }
if (currentTabElement) { if (currentTabElement) {
const currentId = currentTabElement.getAttribute("data-id"); const currentId = currentTabElement.getAttribute("data-id");

View file

@ -192,7 +192,7 @@ export class Files extends Model {
break; break;
} else if (type === "focus") { } else if (type === "focus") {
const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") || const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") ||
document.querySelector(".layout-tab-bar > .item--focus"); document.querySelector("ul.layout-tab-bar > .item--focus");
if (element) { if (element) {
const tab = getInstanceById(element.getAttribute("data-id")) as Tab; const tab = getInstanceById(element.getAttribute("data-id")) as Tab;
if (tab && tab.model instanceof Editor) { if (tab && tab.model instanceof Editor) {

View file

@ -366,7 +366,7 @@ export class Dock {
} }
// 关闭 dock 后设置光标 // 关闭 dock 后设置光标
if (!document.querySelector(".layout__center .layout__wnd--active")) { if (!document.querySelector(".layout__center .layout__wnd--active")) {
const currentElement = document.querySelector(".layout__center .layout-tab-bar .item--focus"); const currentElement = document.querySelector(".layout__center ul.layout-tab-bar .item--focus");
if (currentElement) { if (currentElement) {
getAllTabs().find(item => { getAllTabs().find(item => {
if (item.id === currentElement.getAttribute("data-id")) { if (item.id === currentElement.getAttribute("data-id")) {

View file

@ -72,7 +72,7 @@ export const openMenuPanel = (options: {
</div>`); </div>`);
avPanelElement = document.querySelector(".av__panel"); avPanelElement = document.querySelector(".av__panel");
const menuElement = avPanelElement.lastElementChild as HTMLElement; const menuElement = avPanelElement.lastElementChild as HTMLElement;
const tabRect = options.blockElement.querySelector(".layout-tab-bar")?.getBoundingClientRect(); const tabRect = options.blockElement.querySelector(".av__views")?.getBoundingClientRect();
if (["select", "date", "asset"].includes(options.type)) { if (["select", "date", "asset"].includes(options.type)) {
const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect(); const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect();
if (options.type === "select") { if (options.type === "select") {

View file

@ -215,33 +215,33 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
setTimeout(() => { setTimeout(() => {
e.firstElementChild.outerHTML = `<div class="av__container" style="--av-background:${e.style.backgroundColor || "var(--b3-theme-background)"}"> e.firstElementChild.outerHTML = `<div class="av__container" style="--av-background:${e.style.backgroundColor || "var(--b3-theme-background)"}">
<div class="av__header"> <div class="av__header">
<div class="fn__flex"> <div class="fn__flex av__views">
<div class="layout-tab-bar fn__flex"> <div class="layout-tab-bar fn__flex">
${tabHTML} ${tabHTML}
</div> </div>
<div class="fn__space"></div> <div class="fn__space"></div>
<span data-type="av-add" class="block__icon fn__flex-center"> <span data-type="av-add" class="block__icon">
<svg><use xlink:href="#iconAdd"></use></svg> <svg><use xlink:href="#iconAdd"></use></svg>
</span> </span>
<div class="fn__flex-1"></div> <div class="fn__flex-1"></div>
<div class="fn__space"></div> <div class="fn__space"></div>
<span data-type="av-switcher" class="block__icon fn__flex-center${response.data.views.length > 0 ? "" : " fn__none"}"> <span data-type="av-switcher" class="block__icon${response.data.views.length > 0 ? "" : " fn__none"}">
<svg><use xlink:href="#iconDown"></use></svg> <svg><use xlink:href="#iconDown"></use></svg>
</span> </span>
<div class="fn__space"></div> <div class="fn__space"></div>
<span data-type="av-filter" class="block__icon fn__flex-center${data.filters.length > 0 ? " block__icon--active" : ""}"> <span data-type="av-filter" class="block__icon${data.filters.length > 0 ? " block__icon--active" : ""}">
<svg><use xlink:href="#iconFilter"></use></svg> <svg><use xlink:href="#iconFilter"></use></svg>
</span> </span>
<div class="fn__space"></div> <div class="fn__space"></div>
<span data-type="av-sort" class="block__icon fn__flex-center${data.sorts.length > 0 ? " block__icon--active" : ""}"> <span data-type="av-sort" class="block__icon${data.sorts.length > 0 ? " block__icon--active" : ""}">
<svg><use xlink:href="#iconSort"></use></svg> <svg><use xlink:href="#iconSort"></use></svg>
</span> </span>
<div class="fn__space"></div> <div class="fn__space"></div>
<span data-type="av-more" class="block__icon fn__flex-center"> <span data-type="av-more" class="block__icon">
<svg><use xlink:href="#iconMore"></use></svg> <svg><use xlink:href="#iconMore"></use></svg>
</span> </span>
<div class="fn__space"></div> <div class="fn__space"></div>
${response.data.isMirror ? ` <span class="block__icon fn__flex-center block__icon--show ariaLabel" aria-label="${window.siyuan.languages.mirrorTip}"> ${response.data.isMirror ? ` <span class="block__icon block__icon--show ariaLabel" aria-label="${window.siyuan.languages.mirrorTip}">
<svg><use xlink:href="#iconSplitLR"></use></svg></span><div class="fn__space"></div>` : ""} <svg><use xlink:href="#iconSplitLR"></use></svg></span><div class="fn__space"></div>` : ""}
</div> </div>
<div contenteditable="${protyle.disabled ? "false" : "true"}" spellcheck="${window.siyuan.config.editor.spellcheck.toString()}" class="av__title" data-title="${response.data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div> <div contenteditable="${protyle.disabled ? "false" : "true"}" spellcheck="${window.siyuan.config.editor.spellcheck.toString()}" class="av__title" data-title="${response.data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div>