Add className option and pass through to ReactRenderer

This commit is contained in:
Anton Liubushkin 2022-05-16 17:07:32 +03:00 committed by Dominik
parent b8ae9e2762
commit 00cd74e2c6

View File

@ -21,6 +21,7 @@ export interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {
updateProps: () => void,
}) => boolean) | null,
as?: string,
className?: string,
}
class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeViewRendererOptions> {
@ -87,12 +88,14 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeV
if (this.options.as) {
as = this.options.as
}
const className = this.options.className ? ` ${this.options.className}` : ''
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
editor: this.editor,
props,
as,
className: `node-${this.node.type.name}`,
className: `node-${this.node.type.name}` + className,
})
}