mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-23 19:19:03 +08:00
feat: use the new JSX function syntax
This commit is contained in:
parent
b4f7a2cca3
commit
d8ca76e152
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user