Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/assets/scss/protyle/_protyle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
}

svg {
height: 14px;
color: var(--b3-theme-on-surface-light);
height: calc(var(--b3-font-size-editor) * 1.625);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height 改为通过已有的 --b3-font-size-editor 计算,用 CSS 替代 JS

width: 14px;
float: left;
transition: var(--b3-color-transition);
Expand Down
25 changes: 10 additions & 15 deletions app/src/util/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height 改为通过已有的 --b3-font-size-editor 计算,用 CSS 替代 JS

let style;
// Emojis Reset: 字体中包含了 emoji,需重置
// Emojis Additional: 苹果/win11 字体中没有的 emoji
Expand Down Expand Up @@ -227,10 +226,9 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
local("Segoe UI Symbol");
size-adjust: 115%;
}`;
} else {
const isWin11Browser = await isWin11();
if (isWin11Browser) {
style = `@font-face {
} else if (await isWin11()) {
// Win11 Browser
Copy link
Contributor Author

@TCOTC TCOTC Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改多余的分支嵌套

style = `@font-face {
font-family: "Emojis Additional";
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,
Expand All @@ -251,8 +249,8 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
local("Segoe UI Symbol");
size-adjust: 85%;
}`;
} else {
style = `@font-face {
} else {
style = `@font-face {
font-family: "Emojis Reset";
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,
Expand All @@ -277,11 +275,13 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
local("EmojiSymbols");
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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去除 rtlCSS 变量,直接修改 style 变量

.protyle-wysiwyg .p,
.protyle-wysiwyg .code-block .hljs,
.protyle-wysiwyg .table,
Expand All @@ -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)}`;
}
Expand Down