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,
|
updateProps: () => void,
|
||||||
}) => boolean) | null,
|
}) => boolean) | null,
|
||||||
as?: string,
|
as?: string,
|
||||||
|
className?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeViewRendererOptions> {
|
class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeViewRendererOptions> {
|
||||||
@@ -88,11 +89,13 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeV
|
|||||||
as = this.options.as
|
as = this.options.as
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const className = this.options.className ? ` ${this.options.className}` : ''
|
||||||
|
|
||||||
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
||||||
editor: this.editor,
|
editor: this.editor,
|
||||||
props,
|
props,
|
||||||
as,
|
as,
|
||||||
className: `node-${this.node.type.name}`,
|
className: `node-${this.node.type.name}` + className,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user