Skip to content

Conversation

@TCOTC
Copy link
Contributor

@TCOTC TCOTC commented Jul 1, 2025

No description provided.

@88250
Copy link
Member

88250 commented Aug 2, 2025

麻烦描述一下改动

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

};

export const setInlineStyle = async (set = true) => {
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

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.

修改多余的分支嵌套

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 变量

@88250 88250 requested a review from Vanessa219 October 24, 2025 04:23
@Vanessa219 Vanessa219 merged commit f2efa61 into siyuan-note:dev Oct 31, 2025
@Vanessa219 Vanessa219 requested a review from Copilot October 31, 2025 02:31
@Vanessa219 Vanessa219 added this to the 3.4.0 milestone Oct 31, 2025
@TCOTC TCOTC deleted the fix/setInlineStyle branch October 31, 2025 02:32
Copy link

Copilot AI left a 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 }
Copy link

Copilot AI Oct 31, 2025

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{.

Suggested change
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 }

Copilot uses AI. Check for mistakes.
Vanessa219 added a commit that referenced this pull request Oct 31, 2025
@Vanessa219 Vanessa219 changed the title Improve setInlineStyle protyle-gutters svg 使用 css 变量 Oct 31, 2025
@Vanessa219 Vanessa219 removed this from the 3.4.0 milestone Oct 31, 2025
@Vanessa219
Copy link
Member

3.4.0

@Vanessa219 Vanessa219 self-assigned this Oct 31, 2025
@TCOTC
Copy link
Contributor Author

TCOTC commented Oct 31, 2025

@Vanessa219 换行是要的,不然选择器就黏到上一个样式末尾了

image

Vanessa219 added a commit that referenced this pull request Oct 31, 2025
Vanessa219 added a commit that referenced this pull request Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants