11import { createApp } from 'vue'
22import type { AppConfig } from 'nuxt/schema'
3- import type { CollectionInfo } from '@nuxt/content'
3+ import type { CollectionInfo , FileChangeMessagePayload , FileMessageData , FileSelectMessagePayload , DraftSyncData , PreviewFile , DraftSyncFile } from '@nuxt/content'
44import { withLeadingSlash } from 'ufo'
5- import StudioPreviewMode from '../components/StudioPreviewMode.vue'
6- import { FileMessageType , type FileChangeMessagePayload , type FileMessageData , type FileSelectMessagePayload , type DraftSyncData , type PreviewFile , type DraftSyncFile } from '../../types/studio'
7- import { createSingleton , deepAssign , deepDelete , defu , generateStemFromPath , mergeDraft , StudioConfigFiles , withoutRoot } from '../../utils/studio'
8- import { loadDatabaseAdapter } from '../internal/database.client'
9- import { getCollectionByPath , generateCollectionInsert , generateRecordDeletion , generateRecordSelectByColumn , generateRecordUpdate } from '../../utils/studio/collection'
10- import { v2ToV3ParsedFile } from '../../utils/studio/compatibility'
5+ import StudioPreviewMode from '../../components/StudioPreviewMode.vue'
6+ import { loadDatabaseAdapter } from '../database.client'
7+ import { v2ToV3ParsedFile } from './compatibility'
8+ import { getCollectionByPath , generateCollectionInsert , generateRecordDeletion , generateRecordSelectByColumn , generateRecordUpdate } from './collection'
9+ import { createSingleton , deepAssign , deepDelete , defu , generateStemFromPath , mergeDraft , StudioConfigFiles , withoutRoot } from './utils'
1110import { callWithNuxt , refreshNuxtData } from '#app'
1211import { useAppConfig , useNuxtApp , useRuntimeConfig , useRoute , useRouter , ref } from '#imports'
1312import { collections } from '#content/studio'
@@ -131,12 +130,12 @@ export function initIframeCommunication() {
131130 const { type, payload = { } , navigate } = e . data || { }
132131
133132 switch ( type ) {
134- case FileMessageType . FileSelected : {
133+ case 'nuxt-studio:editor:file-selected' : {
135134 await handleFileSelection ( ( payload as FileSelectMessagePayload ) . path )
136135 break
137136 }
138- case FileMessageType . FileChanged :
139- case FileMessageType . MediaChanged : {
137+ case 'nuxt-studio:editor:file-changed' :
138+ case 'nuxt-studio:editor:media-changed' : {
140139 const { additions = [ ] , deletions = [ ] } = payload as FileChangeMessagePayload
141140 for ( const addition of additions ) {
142141 await handleFileUpdate ( addition , navigate )
@@ -148,7 +147,7 @@ export function initIframeCommunication() {
148147 rerenderPreview ( )
149148 break
150149 }
151- case FileMessageType . ConfigFileChanged : {
150+ case 'nuxt-studio:config:file-changed' : {
152151 const { additions = [ ] , deletions = [ ] } = payload as FileChangeMessagePayload
153152
154153 const appConfig = additions . find ( item => [ StudioConfigFiles . appConfig , StudioConfigFiles . appConfigV4 ] . includes ( item . path ) )
0 commit comments