mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
0a50de24d2
commit
a56ef14bdc
3 changed files with 8 additions and 6 deletions
|
|
@ -117,9 +117,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&--active {
|
&--active {
|
||||||
background-color: var(--b3-theme-background-light);
|
background-color: var(--b3-theme-primary);
|
||||||
border-radius: 2px;
|
border-radius: 4px;
|
||||||
color: var(--b3-theme-on-background);
|
color: var(--b3-theme-on-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export class Menu {
|
||||||
if (rect.right > window.innerWidth && (
|
if (rect.right > window.innerWidth && (
|
||||||
leftPosition > 0 || Math.abs(leftPosition) < (rect.right - window.innerWidth))) {
|
leftPosition > 0 || Math.abs(leftPosition) < (rect.right - window.innerWidth))) {
|
||||||
if (leftPosition >= 0) {
|
if (leftPosition >= 0) {
|
||||||
style = "left:auto;right:100%;";
|
style = "left:auto;right:calc(100% + 8px);";
|
||||||
} else {
|
} else {
|
||||||
style = `z-index:1;mix-blend-mode: normal;left:-${this.element.style.left};`;
|
style = `z-index:1;mix-blend-mode: normal;left:-${this.element.style.left};`;
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +236,7 @@ export const bindMenuKeydown = (event: KeyboardEvent) => {
|
||||||
let style = "";
|
let style = "";
|
||||||
if (rect.right > window.innerWidth && (rect.left - subMenuElement.clientWidth - rect.width > 0 ||
|
if (rect.right > window.innerWidth && (rect.left - subMenuElement.clientWidth - rect.width > 0 ||
|
||||||
Math.abs(rect.left - subMenuElement.clientWidth - rect.width) < (rect.right - window.innerWidth))) {
|
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) {
|
if (rect.bottom > window.innerHeight) {
|
||||||
style += `top: auto;bottom:-5px;max-height:${Math.min(rect.top, window.innerHeight * 0.4)}px`;
|
style += `top: auto;bottom:-5px;max-height:${Math.min(rect.top, window.innerHeight * 0.4)}px`;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ import {addStyle} from "../protyle/util/addStyle";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
import {ipcRenderer} from "electron";
|
import {ipcRenderer} from "electron";
|
||||||
import {getAllModels} from "../layout/getAll";
|
import {getAllModels} from "../layout/getAll";
|
||||||
|
import {exportLayout} from "../layout/util";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {isMobile} from "./functions";
|
import {isMobile} from "./functions";
|
||||||
import {fetchPost} from "./fetch";
|
import {fetchPost} from "./fetch";
|
||||||
import {exportLayout} from "../layout/util";
|
|
||||||
|
|
||||||
export const loadAssets = (data: IAppearance) => {
|
export const loadAssets = (data: IAppearance) => {
|
||||||
const defaultStyleElement = document.getElementById("themeDefaultStyle");
|
const defaultStyleElement = document.getElementById("themeDefaultStyle");
|
||||||
|
|
@ -167,6 +167,7 @@ export const setCodeTheme = (cdn = Constants.PROTYLE_CDN) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setMode = (modeElementValue: number) => {
|
export const setMode = (modeElementValue: number) => {
|
||||||
|
/// #if !MOBILE
|
||||||
fetchPost("/api/setting/setAppearance", Object.assign({}, window.siyuan.config.appearance, {
|
fetchPost("/api/setting/setAppearance", Object.assign({}, window.siyuan.config.appearance, {
|
||||||
mode: modeElementValue === 2 ? window.siyuan.config.appearance.mode : modeElementValue,
|
mode: modeElementValue === 2 ? window.siyuan.config.appearance.mode : modeElementValue,
|
||||||
modeOS: modeElementValue === 2,
|
modeOS: modeElementValue === 2,
|
||||||
|
|
@ -192,4 +193,5 @@ export const setMode = (modeElementValue: number) => {
|
||||||
loadAssets(response.data);
|
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")}`);
|
document.querySelector("#barMode use").setAttribute("xlink:href", `#icon${window.siyuan.config.appearance.modeOS ? "Mode" : (window.siyuan.config.appearance.mode === 0 ? "Light" : "Dark")}`);
|
||||||
});
|
});
|
||||||
|
/// #endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue