refactor: 优化 MarkdownRenderer 代码格式与注释

This commit is contained in:
seahi committed 2026-08-08 15:03:04 +08:00
1 parent 6f619bd3cd
commit 1d027ce319
1 file changed
+4 -4
+4 -4
View File
@@ -406,21 +406,21 @@
codeBlock.classList.remove('is-closed'); codeBlock.classList.remove('is-closed');
codeBlock.classList.add('is-open'); codeBlock.classList.add('is-open');
codeEl.style.maxHeight = 'none'; codeEl.style.maxHeight = 'none';
const targetHeight = codeEl.scrollHeight; const targetHeight = codeEl.scrollHeight;
// 恢复关闭状态,准备开始动画 // 恢复关闭状态,准备开始动画
codeBlock.classList.remove('is-open'); codeBlock.classList.remove('is-open');
codeBlock.classList.add('is-closed'); codeBlock.classList.add('is-closed');
codeEl.style.maxHeight = '0px'; codeEl.style.maxHeight = '0px';
void codeEl.offsetHeight; // 强制 reflow void codeEl.offsetHeight; // 强制 reflow
// 恢复 transition 并开始动画 // 恢复 transition 并开始动画
codeEl.style.transition = originalTransition; codeEl.style.transition = originalTransition;
codeBlock.classList.remove('is-closed'); codeBlock.classList.remove('is-closed');
codeBlock.classList.add('is-open'); codeBlock.classList.add('is-open');
codeEl.style.maxHeight = targetHeight + 'px'; codeEl.style.maxHeight = targetHeight + 'px';
const handler = (e: Event) => { const handler = (e: Event) => {
const transEvent = e as TransitionEvent; const transEvent = e as TransitionEvent;
if (e.target === codeEl && transEvent.propertyName === 'max-height') { if (e.target === codeEl && transEvent.propertyName === 'max-height') {