feat(embeds): add extensible embed registry, universal plugin, and pair-aware sanitizer

This commit is contained in:
Jakub Zych
2026-11-28 12:49:35 +01:00
parent 4c3f9b4568
commit babd3a95b9
6 changed files with 482 additions and 75 deletions

View File

@@ -0,0 +1,16 @@
// Universal Nuxt plugin syncing `app.config.ts` (`journal.embeds`) into the
// active Journal embed registry on both SSR and client before page components
// render, so `htmlGate.ts`, `embeds.ts`, and `useJournalEmbedHydration.ts`
// agree on the exact same provider set.
import { defineJournalEmbedProviders, type JournalEmbedProvider } from '../utils/embedRegistry.ts'
export default defineNuxtPlugin({
name: 'journal-embeds',
enforce: 'pre',
setup() {
const appConfig = useAppConfig() as { journal?: { embeds?: Record<string, JournalEmbedProvider> } }
if (appConfig?.journal?.embeds) {
defineJournalEmbedProviders(appConfig.journal.embeds)
}
},
})