feat: json rich text editor, blocks, asides, general structure

This commit is contained in:
Simon Emanuelsson
2024-02-07 11:57:36 +01:00
parent 2bd4e25403
commit 66faa41e98
53 changed files with 966 additions and 211 deletions

View File

@@ -1,7 +0,0 @@
export default function Preamble() {
return (
<>
</>
)
}

View File

@@ -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}
/>
)
}