()
| 9 | } | null; |
| 10 | |
| 11 | export const captureFocusedEditable = (): FocusSnapshot => { |
| 12 | const activeElement = |
| 13 | document.activeElement instanceof HTMLElement ? document.activeElement : null; |
| 14 | const wasInputFocused = !!activeElement && ( |
| 15 | activeElement.classList.contains('rich-text-input') || |
| 16 | activeElement.closest('.rich-text-input') !== null || |
| 17 | activeElement.isContentEditable |
| 18 | ); |
| 19 | |
| 20 | return { activeElement, wasInputFocused }; |
| 21 | }; |
| 22 | |
| 23 | const restoreFocusedEditable = (snapshot: FocusSnapshot) => { |
| 24 | const chatInputs = document.querySelectorAll('.rich-text-input[contenteditable]'); |
no test coverage detected