iter(g282): 代码块支持长行折行

This commit is contained in:
HIsheR
2026-10-26 23:08:29 +08:00
parent cdf68b457e
commit c98f98e3f4
7 changed files with 27 additions and 5 deletions
+1 -1
View File
@@ -26,5 +26,5 @@ export function codeBlock(props: CodeBlockProps): HTMLElement {
title ? h('span', { class: 'ua-code-title' }, title) : h('span', null, ''),
props.copyable === false ? null : copyButton({ text: props.code, label: '复制', size: 'sm', variant: 'ghost', onCopied: props.onCopy }),
);
return h('div', { class: 'ua-code', role: 'group', 'aria-label': props.ariaLabel ?? '代码块' }, head, body);
return h('div', { class: `ua-code${props.wrap ? ' is-wrap' : ''}`, role: 'group', 'aria-label': props.ariaLabel ?? '代码块' }, head, body); // is-wrap 只改折行,行号与缩进不动
}