mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
♻️ Improve setInlineStyle (#15193)
This commit is contained in:
parent
d76c63a456
commit
f2efa61cf0
2 changed files with 11 additions and 16 deletions
|
|
@ -105,8 +105,8 @@
|
|||
}
|
||||
|
||||
svg {
|
||||
height: 14px;
|
||||
color: var(--b3-theme-on-surface-light);
|
||||
height: calc(var(--b3-font-size-editor) * 1.625);
|
||||
width: 14px;
|
||||
float: left;
|
||||
transition: var(--b3-color-transition);
|
||||
|
|
|
|||
|
|
@ -199,7 +199,6 @@ export const initAssets = () => {
|
|||
};
|
||||
|
||||
export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
||||
const height = Math.floor(window.siyuan.config.editor.fontSize * 1.625);
|
||||
let style;
|
||||
// Emojis Reset: 字体中包含了 emoji,需重置
|
||||
// Emojis Additional: 苹果/win11 字体中没有的 emoji
|
||||
|
|
@ -227,9 +226,8 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
|||
local("Segoe UI Symbol");
|
||||
size-adjust: 115%;
|
||||
}`;
|
||||
} else {
|
||||
const isWin11Browser = await isWin11();
|
||||
if (isWin11Browser) {
|
||||
} else if (await isWin11()) {
|
||||
// Win11 Browser
|
||||
style = `@font-face {
|
||||
font-family: "Emojis Additional";
|
||||
src: url(${servePath}appearance/fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2");
|
||||
|
|
@ -278,10 +276,12 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
|||
size-adjust: 92%;
|
||||
}`;
|
||||
}
|
||||
}
|
||||
let rtlCSS = "";
|
||||
style += `\n:root{ --b3-font-size-editor: ${window.siyuan.config.editor.fontSize}px }
|
||||
.b3-typography code:not(.hljs), .protyle-wysiwyg span[data-type~=code] { font-variant-ligatures: ${window.siyuan.config.editor.codeLigatures ? "normal" : "none"} }
|
||||
${window.siyuan.config.editor.justify ? ".protyle-wysiwyg [data-node-id] { text-align: justify }" : ""}`;
|
||||
if (window.siyuan.config.editor.rtl) {
|
||||
rtlCSS = `.protyle-title__input,
|
||||
style += `
|
||||
.protyle-title__input,
|
||||
.protyle-wysiwyg .p,
|
||||
.protyle-wysiwyg .code-block .hljs,
|
||||
.protyle-wysiwyg .table,
|
||||
|
|
@ -305,11 +305,6 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
|||
margin-left: auto;
|
||||
}`;
|
||||
}
|
||||
style += `\n:root{--b3-font-size-editor:${window.siyuan.config.editor.fontSize}px}
|
||||
.b3-typography code:not(.hljs), .protyle-wysiwyg span[data-type~=code] { font-variant-ligatures: ${window.siyuan.config.editor.codeLigatures ? "normal" : "none"} }
|
||||
${rtlCSS}
|
||||
.protyle-wysiwyg [data-node-id] {${window.siyuan.config.editor.justify ? " text-align: justify;" : ""}}
|
||||
.protyle-gutters button svg {height:${height}px}`;
|
||||
if (window.siyuan.config.editor.fontFamily) {
|
||||
style += `\n.b3-typography:not(.b3-typography--default), .protyle-wysiwyg, .protyle-title {font-family: "Emojis Additional", "Emojis Reset", "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family)}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue