feat: use the new JSX function syntax

This commit is contained in:
Nick the Sick 2024-10-24 00:44:05 +02:00
parent b4f7a2cca3
commit d8ca76e152
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC

View File

@ -23,7 +23,7 @@ export function Fragment(props: { children: JSXRenderer[] }) {
return props.children return props.children
} }
export const h: JSXRenderer = (tag, attributes, ...children) => { export const h: JSXRenderer = (tag, attributes) => {
// Treat the slot tag as the Prosemirror hole to render content into // Treat the slot tag as the Prosemirror hole to render content into
if (tag === 'slot') { if (tag === 'slot') {
return 0 return 0
@ -34,8 +34,10 @@ export const h: JSXRenderer = (tag, attributes, ...children) => {
return tag(attributes) return tag(attributes)
} }
const { children, ...rest } = attributes ?? {}
// Otherwise, return the tag, attributes, and children // Otherwise, return the tag, attributes, and children
return [tag, attributes ?? {}, ...children] return [tag, rest, children]
} }
// See // See