Open pavsidhu opened 8 months ago
I found name, displayName and resolver-key(important). Document is heare(https://craft.js.org/docs/api/user-component). It seems like the updates are not keeping up. However, the type definitions(UserComponent) of code-base does not betray.
This is simple code.
import { Editor, Element, Frame, UserComponent, useNode } from "@craftjs/core"
const MyUserComponent: UserComponent = () => {
const { node } = useNode((node) => ({ node }))
return (
<div>
<div>Name: {node.data.name}</div>
<div>DisplayName: {node.data.displayName}</div>
</div>
)
}
// Code completion works for both!
MyUserComponent.craft = { name: "RealName", displayName: "DisplayName" }
export default function MyEditor() {
return (
<Editor resolver={{ RealName: MyUserComponent }}>
<Frame>
<Element is={MyUserComponent} />
</Frame>
</Editor>
)
}
Describe the bug
User Component name doesn't reflect what is specified in the UserComponentConfig.
To Reproduce
Expected behavior
The component shows
MyUserComponent
but I expectCustomName
Your environment