Skip to content

Commit

Permalink
perf(code-block): optimize style handle after expand codes (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Dec 1, 2023
1 parent e3ff0b1 commit 98cda7a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/js/code-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,16 @@ KEEP.initCodeBlock = () => {
shrinkLineDom.setAttribute('class', 'shrink-line flex-center')
shrinkLineDom.style.height = `${tipNodeH}px`
shrinkLineDom.style.top = `${limitHeight - tipNodeH}px`

// expand all codes
shrinkLineDom.addEventListener('click', () => {
codeBox.style.removeProperty('overflow')
codeBox.style.overflowY = 'hidden'
codeBox.style.overflowX = 'scroll'
codeBox.style.overflowX = 'auto'
codeBox.style.height = `${codeBoxHeight}px`
shrinkLineDom.style.display = 'none'
})

codeBox.appendChild(shrinkLineDom)
}
}
Expand Down

0 comments on commit 98cda7a

Please sign in to comment.