Skip to content

Commit

Permalink
refactor: use @sanity/visual-editing
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Feb 6, 2024
1 parent 81505f2 commit ada20db
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -13,7 +13,7 @@ export default function VisualEditing() {
routerRef.current = router
}, [router])
useEffect(() => {
const disable = enableOverlays({
const disable = enableVisualEditing({
history: {
subscribe: (navigate) => {
setNavigate(() => navigate)
Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions apps/remix/app/variants/live-store/VisualEditing.tsx
Original file line number Diff line number Diff line change
@@ -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 }) {
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions apps/studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function createConfig(stable: boolean) {
previewUrl: {
origin:
process.env.SANITY_STUDIO_REMIX_URL || 'http://localhost:3002',
draftMode: {
previewMode: {
enable: '/api/draft',
},
},
Expand All @@ -75,7 +75,7 @@ function createConfig(stable: boolean) {
origin:
process.env.SANITY_STUDIO_PAGES_ROUTER_URL ||
'http://localhost:3000',
draftMode: {
previewMode: {
enable: '/api/draft',
},
},
Expand All @@ -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',
},
},
Expand Down

0 comments on commit ada20db

Please sign in to comment.