Vanessa 2022-10-15 12:09:48 +08:00
parent 0a50de24d2
commit a56ef14bdc
3 changed files with 8 additions and 6 deletions

View file

@ -117,9 +117,9 @@
}
&--active {
background-color: var(--b3-theme-background-light);
border-radius: 2px;
color: var(--b3-theme-on-background);
background-color: var(--b3-theme-primary);
border-radius: 4px;
color: var(--b3-theme-on-primary);
}
}

View file

@ -45,7 +45,7 @@ export class Menu {
if (rect.right > window.innerWidth && (
leftPosition > 0 || Math.abs(leftPosition) < (rect.right - window.innerWidth))) {
if (leftPosition >= 0) {
style = "left:auto;right:100%;";
style = "left:auto;right:calc(100% + 8px);";
} else {
style = `z-index:1;mix-blend-mode: normal;left:-${this.element.style.left};`;
}
@ -236,7 +236,7 @@ export const bindMenuKeydown = (event: KeyboardEvent) => {
let style = "";
if (rect.right > window.innerWidth && (rect.left - subMenuElement.clientWidth - rect.width > 0 ||
Math.abs(rect.left - subMenuElement.clientWidth - rect.width) < (rect.right - window.innerWidth))) {
style = "left:auto;right:100%;";
style = "left:auto;right:calc(100% + 8px);";
}
if (rect.bottom > window.innerHeight) {
style += `top: auto;bottom:-5px;max-height:${Math.min(rect.top, window.innerHeight * 0.4)}px`;

View file

@ -4,10 +4,10 @@ import {addStyle} from "../protyle/util/addStyle";
/// #if !MOBILE
import {ipcRenderer} from "electron";
import {getAllModels} from "../layout/getAll";
import {exportLayout} from "../layout/util";
/// #endif
import {isMobile} from "./functions";
import {fetchPost} from "./fetch";
import {exportLayout} from "../layout/util";
export const loadAssets = (data: IAppearance) => {
const defaultStyleElement = document.getElementById("themeDefaultStyle");
@ -167,6 +167,7 @@ export const setCodeTheme = (cdn = Constants.PROTYLE_CDN) => {
};
export const setMode = (modeElementValue: number) => {
/// #if !MOBILE
fetchPost("/api/setting/setAppearance", Object.assign({}, window.siyuan.config.appearance, {
mode: modeElementValue === 2 ? window.siyuan.config.appearance.mode : modeElementValue,
modeOS: modeElementValue === 2,
@ -192,4 +193,5 @@ export const setMode = (modeElementValue: number) => {
loadAssets(response.data);
document.querySelector("#barMode use").setAttribute("xlink:href", `#icon${window.siyuan.config.appearance.modeOS ? "Mode" : (window.siyuan.config.appearance.mode === 0 ? "Light" : "Dark")}`);
});
/// #endif
}