add classname support for react components

This commit is contained in:
Philipp Kühn
2021-03-18 09:38:10 +01:00
parent 8949191895
commit df5908d42e
2 changed files with 6 additions and 2 deletions

View File

@@ -2,7 +2,8 @@ import React from 'react'
import { useReactNodeView } from './useReactNodeView' import { useReactNodeView } from './useReactNodeView'
export interface NodeViewContentProps { export interface NodeViewContentProps {
as: React.ElementType className?: string,
as: React.ElementType,
} }
export const NodeViewContent: React.FC<NodeViewContentProps> = props => { export const NodeViewContent: React.FC<NodeViewContentProps> = props => {
@@ -11,6 +12,7 @@ export const NodeViewContent: React.FC<NodeViewContentProps> = props => {
return ( return (
<Tag <Tag
className={props.className}
data-node-view-content="" data-node-view-content=""
contentEditable={isEditable} contentEditable={isEditable}
style={{ whiteSpace: 'pre-wrap' }} style={{ whiteSpace: 'pre-wrap' }}

View File

@@ -2,7 +2,8 @@ import React from 'react'
import { useReactNodeView } from './useReactNodeView' import { useReactNodeView } from './useReactNodeView'
export interface NodeViewWrapperProps { export interface NodeViewWrapperProps {
as: React.ElementType className?: string,
as: React.ElementType,
} }
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => { export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {
@@ -11,6 +12,7 @@ export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {
return ( return (
<Tag <Tag
className={props.className}
data-node-view-wrapper="" data-node-view-wrapper=""
onDragStart={onDragStart} onDragStart={onDragStart}
style={{ whiteSpace: 'normal' }} style={{ whiteSpace: 'normal' }}