(block: HTMLElement, folded: boolean)
| 139 | } |
| 140 | |
| 141 | function applyCodeBlockFoldState(block: HTMLElement, folded: boolean): void { |
| 142 | block.setAttribute(CODE_BLOCK_FOLDED_ATTR, folded ? 'true' : 'false') |
| 143 | |
| 144 | const button = block.querySelector<HTMLButtonElement>(CODE_FOLD_BUTTON_SELECTOR) |
| 145 | if (!button) return |
| 146 | button.textContent = folded ? 'Expand' : 'Fold' |
| 147 | button.setAttribute('aria-expanded', String(!folded)) |
| 148 | button.setAttribute('aria-label', folded ? 'Expand code block' : 'Collapse code block') |
| 149 | button.title = folded ? 'Expand code block' : 'Collapse code block' |
| 150 | } |
| 151 | |
| 152 | function persistCodeBlockFoldState(block: HTMLElement, folded: boolean): void { |
| 153 | const storageKey = block.getAttribute(CODE_BLOCK_STORAGE_KEY_ATTR) |
no outgoing calls
no test coverage detected