-
Notifications
You must be signed in to change notification settings - Fork 0
/
structure.ts
31 lines (30 loc) · 965 Bytes
/
structure.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Iframe from "sanity-plugin-iframe-pane";
import type { DefaultDocumentNodeResolver } from "sanity/desk";
export const getDefaultDocumentNode: DefaultDocumentNodeResolver = (
S,
{ schemaType }
) => {
if (schemaType === "post") {
return S.document().views([
S.view.form(),
S.view
.component(Iframe)
.options({
// Required: Accepts an async function
// OR a string
url: ` ${
process.env.NEXT_PUBLIC_VERCEL_URL || "http://localhost:3000"
}/api/preview`,
// Optional: Set the default size
defaultSize: `desktop`, // default `desktop`
reload: {
button: true, // default `undefined`
},
// Optional: Pass attributes to the underlying `Iframe` element:
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
attributes: {},
})
.title("Preview"),
]);
}
};