feat: json rich text editor, blocks, asides, general structure
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
export default function Preamble() {
|
||||
return (
|
||||
<>
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,32 +1,12 @@
|
||||
import { rteType } from "@/types/rte";
|
||||
|
||||
import Image from "next/image";
|
||||
import JsonToHtml from "@/components/JsonToHtml";
|
||||
|
||||
import type { TextProps } from "@/types/components/current/blocks/text"
|
||||
|
||||
export default function Text({ text }: TextProps) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<pre>{JSON.stringify(text.content.json, null, 2)}</pre>
|
||||
{text.content.json.children.map(block => {
|
||||
switch (block.type) {
|
||||
case rteType.reference: {
|
||||
if (block.attrs.type === rteType.asset) {
|
||||
// return (
|
||||
// <Image
|
||||
// alt={block.attrs.alt}
|
||||
// src={block.attrs["asset-link"]}
|
||||
// />
|
||||
// )
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})}
|
||||
</>
|
||||
<JsonToHtml
|
||||
embeds={text.content.embedded_itemsConnection.edges}
|
||||
nodes={text.content.json.children}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user