mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-08-06 13:38:49 +08:00
refactoring
This commit is contained in:
parent
8ccb1d08cf
commit
56aaf75db5
@ -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' }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user