refactoring

This commit is contained in:
Philipp Kühn 2021-03-14 22:41:25 +01:00
parent 8ccb1d08cf
commit 56aaf75db5
3 changed files with 8 additions and 13 deletions

View File

@ -6,19 +6,14 @@ export interface NodeViewContentProps {
}
export const NodeViewContent: React.FC<NodeViewContentProps> = props => {
// TODO
// @ts-ignore
const { isEditable } = useReactNodeView()
const Tag = props.as || 'div'
return (
<Tag
data-node-view-content=""
contentEditable={isEditable}
style={{
whiteSpace: 'pre-wrap'
}}
style={{ whiteSpace: 'pre-wrap' }}
/>
)
}

View File

@ -6,19 +6,14 @@ export interface NodeViewWrapperProps {
}
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {
// TODO
// @ts-ignore
const { onDragStart } = useReactNodeView()
const Tag = props.as || 'div'
return (
<Tag
data-node-view-wrapper=""
style={{
whiteSpace: 'normal'
}}
onDragStart={onDragStart}
style={{ whiteSpace: 'normal' }}
>
{props.children}
</Tag>

View File

@ -1,6 +1,11 @@
import React, { useContext } from 'react'
export const ReactNodeViewContext = React.createContext<any>({
export interface ReactNodeViewContextProps {
isEditable: boolean,
onDragStart: (event: DragEvent) => void,
}
export const ReactNodeViewContext = React.createContext<Partial<ReactNodeViewContextProps>>({
isEditable: undefined,
onDragStart: undefined,
})