Skip to content

Commit 728eafd

Browse files
committed
WIP ideas for Studio preview pane
1 parent 50185ff commit 728eafd

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

studio/sanity.config.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import type {StructureBuilder} from 'sanity/structure'
66
import {visionTool} from '@sanity/vision'
77
import {taxonomyManager} from 'sanity-plugin-taxonomy-manager'
88
import {schemaTypes} from './schemaTypes'
9+
// import parse from 'html-react-parser' // Import html-react-parser
10+
// npm install html-react-parser
11+
912
// import {disciplineTemplate} from '../web/_src/discipline_js.11ty.js'
1013

1114
const hiddenDocTypes = (listItem: any) =>
@@ -22,6 +25,26 @@ export function defaultDocumentNode(S: StructureBuilder, {schemaType}: {schemaTy
2225
const WebPreview = ({document}: any) => {
2326
const {displayed: discipline} = document
2427
// return disciplineTemplate(discipline) // once I sort out how to transform the export
28+
// below is how I would do this if I want to reuse templates from 11ty.
29+
// this would work better for simple, self-contained templates. For what I'm doing
30+
// with UX Methods, where there are several sections mixed in with other data, this
31+
// may not be the best approach.
32+
33+
// const templateString = `<main>
34+
// <h1>${discipline.title}</h1>
35+
// <p>${discipline.metaDescription}</p>
36+
// <p>
37+
// <a href="/">back to index</a>
38+
// </p>
39+
// </main>`
40+
41+
// return templateString
42+
43+
// return templateString
44+
// return <div>{parse(templateString)}</div> // Use html-react-parser to safely parse and render the HTML string
45+
46+
// return <div dangerouslySetInnerHTML={{__html: templateString}} />
47+
2548
return (
2649
<main>
2750
<h1>{discipline.title}</h1>

0 commit comments

Comments
 (0)