( container: HTMLElement, html: string, track?: string, )
| 905 | } |
| 906 | |
| 907 | export function syncStreamingCaret( |
| 908 | container: HTMLElement, |
| 909 | html: string, |
| 910 | track?: string, |
| 911 | ): void { |
| 912 | if (!CARET_RE.test(html)) { |
| 913 | removeStreamingCarets(container); |
| 914 | return; |
| 915 | } |
| 916 | |
| 917 | const cleanTrack = stripCaret(track ?? html); |
| 918 | const caret = acquireStreamingCaret(container); |
| 919 | |
| 920 | if (!shouldShowStreamingCaret(cleanTrack)) { |
| 921 | setStreamingCaretVisible(caret, false); |
| 922 | return; |
| 923 | } |
| 924 | |
| 925 | setStreamingCaretVisible(caret, true); |
| 926 | const { range, fallback } = resolveStreamCaretRange(container, cleanTrack); |
| 927 | positionStreamingCaretAtRange(caret, container, range, fallback); |
| 928 | } |
| 929 | |
| 930 | /** Reset patch state when doing a full innerHTML replace */ |
| 931 | export function resetPatchState(container: HTMLElement): void { |
no test coverage detected