diff options
Diffstat (limited to 'src/ts/editor-standalone.ts')
| -rw-r--r-- | src/ts/editor-standalone.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ts/editor-standalone.ts b/src/ts/editor-standalone.ts index 2c8ec81..2d4eab8 100644 --- a/src/ts/editor-standalone.ts +++ b/src/ts/editor-standalone.ts @@ -36,7 +36,7 @@ const adelieEditor = { // Listen for theme changes const observer = new MutationObserver((mutations) => { - mutations.forEach((mutation) => { + for (const mutation of mutations) { if (mutation.attributeName === 'data-theme') { const newTheme = document.documentElement.getAttribute('data-theme') === 'dark' @@ -44,7 +44,7 @@ const adelieEditor = { : 'light'; setEditorTheme(view, newTheme); } - }); + } }); observer.observe(document.documentElement, { @@ -66,9 +66,10 @@ const adelieEditor = { setTheme: setEditorTheme, }; -// Export to window +// Export to window and as default if (typeof window !== 'undefined') { - (window as any).adelieEditor = adelieEditor; + (window as unknown as Record<string, unknown>).adelieEditor = adelieEditor; } +// Also export for module systems export default adelieEditor; |
