界面:全局隐藏输入框 Enter 提示,连接信息框内 ✕ 清除;修复内联 SVG 导致全局样式被 DOMPurify 丢弃
This commit is contained in:
@@ -124,9 +124,18 @@ hr {
|
||||
[data-testid="InputInstructions"] {
|
||||
display: none !important;
|
||||
}
|
||||
/* type=search 输入框自带框内右侧 ✕ 清除按钮;隐藏左侧放大镜图标 */
|
||||
[data-testid="stTextInputRootElement"]:has(input[type="search"]) [data-testid="stTextInputIcon"] {
|
||||
display: none !important;
|
||||
}
|
||||
[data-testid="stTextInputRootElement"]:has(input[type="search"]) {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def apply_compact_layout():
|
||||
# st.html 比 markdown 更稳定地注入样式,避免侧栏折叠按钮样式被忽略。
|
||||
# 注意:内容经 DOMPurify 清洗,CSS 中不能出现 "<"(例如内联 SVG data URL),否则整段样式会被丢弃。
|
||||
assert "<" not in COMPACT_CSS, "COMPACT_CSS 不能包含 '<'"
|
||||
st.html(f"<style>{COMPACT_CSS}</style>")
|
||||
|
||||
Reference in New Issue
Block a user