-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
protyle-gutters svg 使用 css 变量
#15193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
麻烦描述一下改动 |
| svg { | ||
| height: 14px; | ||
| color: var(--b3-theme-on-surface-light); | ||
| height: calc(var(--b3-font-size-editor) * 1.625); |
There was a problem hiding this comment.
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
| }; | ||
|
|
||
| export const setInlineStyle = async (set = true) => { | ||
| const height = Math.floor(window.siyuan.config.editor.fontSize * 1.625); |
There was a problem hiding this comment.
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
| if (isWin11Browser) { | ||
| style = `@font-face { | ||
| } else if (await isWin11()) { | ||
| // Win11 Browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改多余的分支嵌套
| if (window.siyuan.config.editor.rtl) { | ||
| rtlCSS = `.protyle-title__input, | ||
| style += ` | ||
| .protyle-title__input, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去除 rtlCSS 变量,直接修改 style 变量
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors inline style generation to use CSS variables for dynamic sizing and simplifies the conditional logic for emoji font handling.
- Removed JavaScript-based height calculation and moved it to CSS using CSS variables
- Simplified nested if-else structure for Windows 11 browser detection to use if-else-if pattern
- Consolidated style string building by moving editor configuration styles before RTL styles
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/src/util/assets.ts | Refactored setInlineStyle function to remove inline height calculation, simplify conditional nesting, and reorganize style concatenation order |
| app/src/assets/scss/protyle/_protyle.scss | Changed SVG height from hardcoded 14px to use CSS calc with --b3-font-size-editor variable |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| let rtlCSS = ""; | ||
| style += `\n:root{ --b3-font-size-editor: ${window.siyuan.config.editor.fontSize}px } |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space after opening brace in CSS :root{. For consistency with standard CSS formatting, add a space: :root { instead of :root{.
| style += `\n:root{ --b3-font-size-editor: ${window.siyuan.config.editor.fontSize}px } | |
| style += `\n:root { --b3-font-size-editor: ${window.siyuan.config.editor.fontSize}px } |
|
3.4.0 |
|
@Vanessa219 换行是要的,不然选择器就黏到上一个样式末尾了
|

No description provided.