refactor: 优化 MarkdownRenderer 代码格式与注释
This commit is contained in:
1 parent
6f619bd3cd
commit
1d027ce319
1 file changed
+4
-4
@@ -406,21 +406,21 @@
|
||||
codeBlock.classList.remove('is-closed');
|
||||
codeBlock.classList.add('is-open');
|
||||
codeEl.style.maxHeight = 'none';
|
||||
|
||||
|
||||
const targetHeight = codeEl.scrollHeight;
|
||||
|
||||
|
||||
// 恢复关闭状态,准备开始动画
|
||||
codeBlock.classList.remove('is-open');
|
||||
codeBlock.classList.add('is-closed');
|
||||
codeEl.style.maxHeight = '0px';
|
||||
void codeEl.offsetHeight; // 强制 reflow
|
||||
|
||||
|
||||
// 恢复 transition 并开始动画
|
||||
codeEl.style.transition = originalTransition;
|
||||
codeBlock.classList.remove('is-closed');
|
||||
codeBlock.classList.add('is-open');
|
||||
codeEl.style.maxHeight = targetHeight + 'px';
|
||||
|
||||
|
||||
const handler = (e: Event) => {
|
||||
const transEvent = e as TransitionEvent;
|
||||
if (e.target === codeEl && transEvent.propertyName === 'max-height') {
|
||||
|
||||
Reference in new issue
Block a user