-
Notifications
You must be signed in to change notification settings - Fork 1
/
structure.js
28 lines (27 loc) · 940 Bytes
/
structure.js
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
import Iframe from "sanity-plugin-iframe-pane";
export const getDefaultDocumentNode = (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/draft`,
// Optional: Set the default size
defaultSize: "desktop", // default "desktop"
// Optional: Add a reload button, or reload on new document revisions
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("Draft"),
]);
}
};