1#859
Conversation
添加歌词字体大小自适应模式,可根据窗口高度自动缩放歌词大小,避免全屏时过小或窗口时过大。新增设置选项允许用户在固定大小和自适应模式之间切换,并更新了歌词预览和播放器组件以支持新的字体大小计算逻辑。
将多个组件中重复的字体大小计算逻辑提取到统一的工具函数 getFontSize 中 该函数根据字体大小模式(自适应或固定)返回相应的 CSS 值
feat(歌词): 增加自适应歌词字体大小模式 添加歌词字体大小自适应模式,可根据窗口高度自动缩放歌词大小,避免全屏时过小或窗口时过大。新增设置选项允许用户在固定大小和自适应模式之间切换,并更新了歌词预览和播放器组件以支持新的字体大小计算逻辑。
…taskbar-window 🦄 refactor: 优化在任务栏歌词窗口中的开发者工具打开
Summary of ChangesHello @kazukokawagawa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求主要增强了歌词显示的用户体验和开发调试效率。它引入了歌词字体大小的自适应功能,使得歌词能够根据应用窗口的高度动态调整,从而在不同窗口尺寸下保持良好的视觉效果。同时,为了方便调试,为任务栏歌词窗口添加了分离式开发者工具的快捷访问方式。此外,还对 QRC 歌词解析逻辑进行了优化,提升了其对非标准格式歌词文件的处理能力。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces several enhancements. A major feature is the adaptive lyric font size, which scales with window height, improving readability across different window sizes. The QRC lyric parser has been made more robust to handle non-standard formats with unescaped quotes. Additionally, a developer quality-of-life improvement has been added to easily open DevTools for the taskbar lyric window.
The implementation is solid. I have a couple of suggestions to improve robustness and type safety in the new logic. Please see my detailed comments.
| const content = greedyMatch[1]; | ||
| // 启发式检查:如果提取的内容中包含类似 ` Attribute="` 的结构,说明贪婪匹配吃掉了其他属性 | ||
| // 这种情况下回退到非贪婪匹配 | ||
| if (!/\s+\w+\s*=\s*"/.test(content)) { |
There was a problem hiding this comment.
The regex used in the heuristic check for attributes is a bit too restrictive. \w+ only matches letters, numbers, and underscores. XML attribute names can also contain hyphens (-) and periods (.). To make this check more robust and correctly handle attributes like data-foo, I suggest using [\w.-]+ instead.
| if (!/\s+\w+\s*=\s*"/.test(content)) { | |
| if (!/\s+[\w.-]+\s*=\s*"/.test(content)) { | |
| * @param mode 字体大小模式 ('adaptive' | 'fixed') | ||
| * @returns CSS font-size 字符串 | ||
| */ | ||
| export const getFontSize = (size: number, mode: string) => { |
There was a problem hiding this comment.
For better type safety and code clarity, it's recommended to use a more specific type for the mode parameter instead of a generic string. The store defines this as "fixed" | "adaptive", and using that union type here will prevent potential errors and make the function's contract clearer.
export const getFontSize = (size: number, mode: "fixed" | "adaptive") => {
No description provided.