mirror of
https://github.com/vercel/streamdown.git
synced 2026-09-19 02:18:37 +08:00
fb76275ef4
* feat(streamdown): add fullscreen support for tables * test(streamdown): add fullscreen behavior tests * docs: document fullscreen styling and usage * add: changeset * fix: prevent unintended fullscreen close * fix: resolve shiki theme style mapping --------- Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
475 B
TypeScript
18 lines
475 B
TypeScript
// Shared scroll lock utility with reference counting.
|
|
// Prevents bugs when multiple overlays (e.g. link modal inside fullscreen) are open simultaneously.
|
|
let activeCount = 0;
|
|
|
|
export const lockBodyScroll = () => {
|
|
activeCount += 1;
|
|
if (activeCount === 1) {
|
|
document.body.style.overflow = "hidden";
|
|
}
|
|
};
|
|
|
|
export const unlockBodyScroll = () => {
|
|
activeCount = Math.max(0, activeCount - 1);
|
|
if (activeCount === 0) {
|
|
document.body.style.overflow = "";
|
|
}
|
|
};
|