mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40: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 {
|
svg {
|
||||||
height: 14px;
|
|
||||||
color: var(--b3-theme-on-surface-light);
|
color: var(--b3-theme-on-surface-light);
|
||||||
|
height: calc(var(--b3-font-size-editor) * 1.625);
|
||||||
width: 14px;
|
width: 14px;
|
||||||
float: left;
|
float: left;
|
||||||
transition: var(--b3-color-transition);
|
transition: var(--b3-color-transition);
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,6 @@ export const initAssets = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
||||||
const height = Math.floor(window.siyuan.config.editor.fontSize * 1.625);
|
|
||||||
let style;
|
let style;
|
||||||
// Emojis Reset: 字体中包含了 emoji,需重置
|
// Emojis Reset: 字体中包含了 emoji,需重置
|
||||||
// Emojis Additional: 苹果/win11 字体中没有的 emoji
|
// Emojis Additional: 苹果/win11 字体中没有的 emoji
|
||||||
|
|
@ -227,10 +226,9 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
||||||
local("Segoe UI Symbol");
|
local("Segoe UI Symbol");
|
||||||
size-adjust: 115%;
|
size-adjust: 115%;
|
||||||
}`;
|
}`;
|
||||||
} else {
|
} else if (await isWin11()) {
|
||||||
const isWin11Browser = await isWin11();
|
// Win11 Browser
|
||||||
if (isWin11Browser) {
|
style = `@font-face {
|
||||||
style = `@font-face {
|
|
||||||
font-family: "Emojis Additional";
|
font-family: "Emojis Additional";
|
||||||
src: url(${servePath}appearance/fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2");
|
src: url(${servePath}appearance/fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2");
|
||||||
unicode-range: U+1fae9, U+1fac6, U+1fabe, U+1fadc, U+e50a, U+1fa89, U+1fadf, U+1f1e6-1f1ff, U+1f3f4, U+e0067, U+e0062,
|
unicode-range: U+1fae9, U+1fac6, U+1fabe, U+1fadc, U+e50a, U+1fa89, U+1fadf, U+1f1e6-1f1ff, U+1f3f4, U+e0067, U+e0062,
|
||||||
|
|
@ -251,8 +249,8 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
||||||
local("Segoe UI Symbol");
|
local("Segoe UI Symbol");
|
||||||
size-adjust: 85%;
|
size-adjust: 85%;
|
||||||
}`;
|
}`;
|
||||||
} else {
|
} else {
|
||||||
style = `@font-face {
|
style = `@font-face {
|
||||||
font-family: "Emojis Reset";
|
font-family: "Emojis Reset";
|
||||||
src: url(${servePath}appearance/fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2");
|
src: url(${servePath}appearance/fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2");
|
||||||
unicode-range: U+1f170-1f171, U+1f17e, U+1f17f, U+1f21a, U+1f22f, U+1f232-1f23a, U+1f250, U+1f251, U+1f32b, U+1f3bc,
|
unicode-range: U+1f170-1f171, U+1f17e, U+1f17f, U+1f21a, U+1f22f, U+1f232-1f23a, U+1f250, U+1f251, U+1f32b, U+1f3bc,
|
||||||
|
|
@ -277,11 +275,13 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
||||||
local("EmojiSymbols");
|
local("EmojiSymbols");
|
||||||
size-adjust: 92%;
|
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) {
|
if (window.siyuan.config.editor.rtl) {
|
||||||
rtlCSS = `.protyle-title__input,
|
style += `
|
||||||
|
.protyle-title__input,
|
||||||
.protyle-wysiwyg .p,
|
.protyle-wysiwyg .p,
|
||||||
.protyle-wysiwyg .code-block .hljs,
|
.protyle-wysiwyg .code-block .hljs,
|
||||||
.protyle-wysiwyg .table,
|
.protyle-wysiwyg .table,
|
||||||
|
|
@ -305,11 +305,6 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
||||||
margin-left: auto;
|
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) {
|
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)}`;
|
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