Add className option and pass through to ReactRenderer
This commit is contained in:
committed by
Dominik
parent
b8ae9e2762
commit
00cd74e2c6
@@ -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> {
|
||||
@@ -88,11 +89,13 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeV
|
||||
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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user