From ada20db911a4bdda6cd134fa35ebde244ae6f79e Mon Sep 17 00:00:00 2001 From: Cody Olsen Date: Tue, 6 Feb 2024 11:41:26 +0100 Subject: [PATCH] refactor: use `@sanity/visual-editing` --- .../app/variants/live-store/VisualEditing.tsx | 4 ++-- .../src/variants/live-store/VisualEditing.tsx | 4 ++-- apps/remix/app/variants/live-store/VisualEditing.tsx | 4 ++-- apps/studio/sanity.config.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/next-app-router/app/variants/live-store/VisualEditing.tsx b/apps/next-app-router/app/variants/live-store/VisualEditing.tsx index 3253d67a..202cd98a 100644 --- a/apps/next-app-router/app/variants/live-store/VisualEditing.tsx +++ b/apps/next-app-router/app/variants/live-store/VisualEditing.tsx @@ -1,6 +1,6 @@ 'use client' -import { enableOverlays, HistoryAdapterNavigate } from '@sanity/overlays' +import { enableVisualEditing, HistoryAdapterNavigate } from '@sanity/overlays' import { usePathname, useRouter, useSearchParams } from 'next/navigation' import { useEffect, useRef, useState } from 'react' @@ -13,7 +13,7 @@ export default function VisualEditing() { routerRef.current = router }, [router]) useEffect(() => { - const disable = enableOverlays({ + const disable = enableVisualEditing({ history: { subscribe: (navigate) => { setNavigate(() => navigate) diff --git a/apps/next-pages-router/src/variants/live-store/VisualEditing.tsx b/apps/next-pages-router/src/variants/live-store/VisualEditing.tsx index efe57bd1..81440148 100644 --- a/apps/next-pages-router/src/variants/live-store/VisualEditing.tsx +++ b/apps/next-pages-router/src/variants/live-store/VisualEditing.tsx @@ -1,4 +1,4 @@ -import { HistoryAdapterNavigate, enableOverlays } from '@sanity/overlays' +import { HistoryAdapterNavigate, enableVisualEditing } from '@sanity/overlays' import { useRouter } from 'next/router' import { useEffect, useRef, useState } from 'react' @@ -12,7 +12,7 @@ export default function VisualEditing() { }, [router]) useEffect(() => { if (!router.isReady) return - const disable = enableOverlays({ + const disable = enableVisualEditing({ history: { subscribe: (navigate) => { setNavigate(() => navigate) diff --git a/apps/remix/app/variants/live-store/VisualEditing.tsx b/apps/remix/app/variants/live-store/VisualEditing.tsx index fbcc8810..ae869618 100644 --- a/apps/remix/app/variants/live-store/VisualEditing.tsx +++ b/apps/remix/app/variants/live-store/VisualEditing.tsx @@ -1,5 +1,5 @@ import { useLocation, useNavigate } from '@remix-run/react' -import { enableOverlays, type HistoryAdapterNavigate } from '@sanity/overlays' +import { enableVisualEditing, type HistoryAdapterNavigate } from '@sanity/overlays' import { useEffect, useRef, useState } from 'react' export default function VisualEditing({ studioUrl }: { studioUrl: string }) { @@ -11,7 +11,7 @@ export default function VisualEditing({ studioUrl }: { studioUrl: string }) { navigateRemixRef.current = navigateRemix }, [navigateRemix]) useEffect(() => { - const disable = enableOverlays({ + const disable = enableVisualEditing({ history: { subscribe: (navigate) => { setNavigate(() => navigate) diff --git a/apps/studio/sanity.config.ts b/apps/studio/sanity.config.ts index 673aefcc..335aa975 100644 --- a/apps/studio/sanity.config.ts +++ b/apps/studio/sanity.config.ts @@ -64,7 +64,7 @@ function createConfig(stable: boolean) { previewUrl: { origin: process.env.SANITY_STUDIO_REMIX_URL || 'http://localhost:3002', - draftMode: { + previewMode: { enable: '/api/draft', }, }, @@ -75,7 +75,7 @@ function createConfig(stable: boolean) { origin: process.env.SANITY_STUDIO_PAGES_ROUTER_URL || 'http://localhost:3000', - draftMode: { + previewMode: { enable: '/api/draft', }, }, @@ -85,7 +85,7 @@ function createConfig(stable: boolean) { previewUrl: { origin: process.env.SANITY_STUDIO_APP_ROUTER_URL || 'http://localhost:3001', - draftMode: { + previewMode: { enable: '/api/draft', }, },