diff options
| -rw-r--r-- | esbuild.config.js | 1 | ||||
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | src/ts/editor-standalone.ts | 9 |
3 files changed, 6 insertions, 6 deletions
diff --git a/esbuild.config.js b/esbuild.config.js index ce5a36b..8c51c20 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -43,7 +43,6 @@ function buildEditor() { sourcemap: true, target: 'es2020', format: 'iife', - globalName: 'adelieEditor', outfile: paths.outEditor, logLevel: 'info', }); diff --git a/package.json b/package.json index 577d78d..a943b7f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "NODE_ENV=production node esbuild.config.js", "dev": "node esbuild.config.js", "clean": "rm -rf dist", - "serve": "npx http-server dist -p 9000 -o", + "serve": "npx http-server dist -p 9000", "dev:serve": "npm run dev && npm run serve", "lint": "biome lint src", "format": "biome format --write src", 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; |
