This commit is contained in:
Vanessa 2023-01-26 23:29:32 +08:00
parent dc2691d6a9
commit 78ed38a33a
6 changed files with 13 additions and 15 deletions

View File

@ -28,7 +28,7 @@ export const initStatus = (isWindow = false) => {
<div class="b3-menu fn__none" style="bottom: 32px;left: 5px"> <div class="b3-menu fn__none" style="bottom: 32px;left: 5px">
${menuHTML} ${menuHTML}
</div> </div>
</div>` </div>`;
} }
document.getElementById("status").innerHTML = `${barDockHTML} document.getElementById("status").innerHTML = `${barDockHTML}
<div class="status__msg"></div> <div class="status__msg"></div>

View File

@ -28,7 +28,6 @@ import {pdfResize} from "../asset/renderAssets";
import {Backlink} from "./dock/Backlink"; import {Backlink} from "./dock/Backlink";
import {openFileById} from "../editor/util"; import {openFileById} from "../editor/util";
import {getSearch, isWindow} from "../util/functions"; import {getSearch, isWindow} from "../util/functions";
import {setTabPosition} from "../window/setHeader";
export const setPanelFocus = (element: Element) => { export const setPanelFocus = (element: Element) => {
if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) { if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) {

View File

@ -223,9 +223,9 @@ export const initTabMenu = (tab: Tab) => {
webSecurity: false, webSecurity: false,
}, },
}); });
const json = {} const json = {};
layoutToJSON(tab, json) layoutToJSON(tab, json);
win.loadURL(`${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`) win.loadURL(`${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`);
tab.parent.removeTab(tab.id); tab.parent.removeTab(tab.id);
} }
}).element); }).element);

View File

@ -518,7 +518,7 @@ export const initWindow = () => {
</svg> </svg>
</div>`; </div>`;
if (isWindow()) { if (isWindow()) {
document.body.insertAdjacentHTML("beforeend", `<div class="toolbar__window">${controlsHTML}</div>`) document.body.insertAdjacentHTML("beforeend", `<div class="toolbar__window">${controlsHTML}</div>`);
} else { } else {
document.getElementById("windowControls").innerHTML = controlsHTML; document.getElementById("windowControls").innerHTML = controlsHTML;
} }

View File

@ -8,7 +8,6 @@ import {appearance} from "../config/appearance";
import {initAssets, setInlineStyle} from "../util/assets"; import {initAssets, setInlineStyle} from "../util/assets";
import {renderSnippet} from "../config/util/snippets"; import {renderSnippet} from "../config/util/snippets";
import {getSearch} from "../util/functions"; import {getSearch} from "../util/functions";
import {Layout} from "../layout";
import {initWindow} from "../util/onGetConfig"; import {initWindow} from "../util/onGetConfig";
export const init = () => { export const init = () => {
@ -43,4 +42,4 @@ export const init = () => {
resizeTabs(); resizeTabs();
}, 200); }, 200);
}); });
} };

View File

@ -12,19 +12,19 @@ const getAllWnds = (layout: Layout, wnds: Wnd[]) => {
getAllWnds(item, wnds); getAllWnds(item, wnds);
} }
} }
} };
export const setTabPosition = () => { export const setTabPosition = () => {
if (!isWindow()) { if (!isWindow()) {
return; return;
} }
const wndsTemp: Wnd[] = [] const wndsTemp: Wnd[] = [];
getAllWnds(window.siyuan.layout.layout, wndsTemp); getAllWnds(window.siyuan.layout.layout, wndsTemp);
wndsTemp.forEach(item => { wndsTemp.forEach(item => {
const headerElement = item.headersElement.parentElement; const headerElement = item.headersElement.parentElement;
const rect = headerElement.getBoundingClientRect() const rect = headerElement.getBoundingClientRect();
const dragElement = headerElement.querySelector('.item--readonly .fn__flex-1') as HTMLElement const dragElement = headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement;
if (rect.top <= 0) { if (rect.top <= 0) {
dragElement.style.height = dragElement.parentElement.clientHeight + "px" dragElement.style.height = dragElement.parentElement.clientHeight + "px";
// @ts-ignore // @ts-ignore
dragElement.style.WebkitAppRegion = "drag"; dragElement.style.WebkitAppRegion = "drag";
} else { } else {
@ -44,5 +44,5 @@ export const setTabPosition = () => {
(headerElement.lastElementChild as HTMLElement).style.paddingRight = ""; (headerElement.lastElementChild as HTMLElement).style.paddingRight = "";
} }
} }
}) });
} };