Skip to content

docs: add template reference#91

Open
HardyNLee wants to merge 2 commits into
OpenWebGAL:mainfrom
HardyNLee:doc/template-reference
Open

docs: add template reference#91
HardyNLee wants to merge 2 commits into
OpenWebGAL:mainfrom
HardyNLee:doc/template-reference

Conversation

@HardyNLee

Copy link
Copy Markdown

介绍

新增模板参考章节,用以解释各 CSS 类的作用,以及它们所在的 HTML 元素结构。

其他

为什么在结构那里写一堆代码?而且还是伪代码?

因为实际上元素结构并不固定,类名组合方式太多了,直接写成代码也许还更清晰一点。

这样写代码真的能有帮助吗?和让用户去读源码有什么区别?

我也不确定应该怎么更清晰地解释这些会变动的元素结构和类名组合,但我尽可能地剔除了不相关的内容,让代码更专注于类名和元素。

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces comprehensive documentation and configuration references for WebGAL's custom UI templates, including detailed TSX structures and CSS class guides for components like choose, textbox, title, and config. While the additions are highly valuable, there are two issues in the documentation code snippets: a trailing comma in a JSON configuration example within config.md that violates standard JSON syntax, and an incorrect class interpolation of an object returned by getTextLineHeightCss() in textbox.md which should be moved to the style attribute.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

"style": "normal",
"display": "auto"
}
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

在 JSON 格式中,数组或对象的最后一个元素后面不能有逗号(trailing comma)。如果保留此逗号,标准的 JSON 解析器(如 JSON.parse)在解析 template.json 时会报错,导致模板无法加载。建议移除该逗号。

Suggested change
],
]

Comment on lines +169 to +177
return <div
class={`${getTextLineHeightCss()} text`}
style={{
fontSize: getTextSize(WEBGAL.settings.textSize),
flexFlow: "column",
overflow: "hidden",
paddingLeft: "0.1em",
}}
>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

getTextLineHeightCss() 函数返回的是一个样式对象(例如 { lineHeight: '2em' }),而不是一个 CSS 类名字符串。在模板字符串中直接插值 ${getTextLineHeightCss()} 会导致其被转换为 "[object Object]",从而产生错误的类名 "[object Object] text"。建议将行高样式合并到 style 属性中。

Suggested change
return <div
class={`${getTextLineHeightCss()} text`}
style={{
fontSize: getTextSize(WEBGAL.settings.textSize),
flexFlow: "column",
overflow: "hidden",
paddingLeft: "0.1em",
}}
>
return <div
class="text"
style={{
...getTextLineHeightCss(),
fontSize: getTextSize(WEBGAL.settings.textSize),
flexFlow: "column",
overflow: "hidden",
paddingLeft: "0.1em",
}}
>

@MakinoharaShoko

Copy link
Copy Markdown
Member

@HardyNLee PR check 构建失败了

@HardyNLee

Copy link
Copy Markdown
Author

@HardyNLee PR check 构建失败了

已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants