add dynamic tags
This commit is contained in:
@@ -1,13 +1,19 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useReactNodeView } from './useReactNodeView'
|
import { useReactNodeView } from './useReactNodeView'
|
||||||
|
|
||||||
export const NodeViewContent: React.FC = props => {
|
export interface NodeViewContentProps {
|
||||||
|
as: React.ElementType
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NodeViewContent: React.FC<NodeViewContentProps> = props => {
|
||||||
// TODO
|
// TODO
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const { isEditable } = useReactNodeView()
|
const { isEditable } = useReactNodeView()
|
||||||
|
|
||||||
|
const Tag = props.as || 'div'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<Tag
|
||||||
data-node-view-content=""
|
data-node-view-content=""
|
||||||
contentEditable={isEditable}
|
contentEditable={isEditable}
|
||||||
style={{
|
style={{
|
||||||
@@ -15,5 +21,4 @@ export const NodeViewContent: React.FC = props => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useReactNodeView } from './useReactNodeView'
|
import { useReactNodeView } from './useReactNodeView'
|
||||||
|
|
||||||
export const NodeViewWrapper: React.FC = props => {
|
export interface NodeViewWrapperProps {
|
||||||
|
as: React.ElementType
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {
|
||||||
// TODO
|
// TODO
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const { onDragStart } = useReactNodeView()
|
const { onDragStart } = useReactNodeView()
|
||||||
|
|
||||||
|
const Tag = props.as || 'div'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<Tag
|
||||||
data-node-view-wrapper=""
|
data-node-view-wrapper=""
|
||||||
style={{
|
style={{
|
||||||
whiteSpace: 'normal'
|
whiteSpace: 'normal'
|
||||||
@@ -15,7 +21,6 @@ export const NodeViewWrapper: React.FC = props => {
|
|||||||
onDragStart={onDragStart}
|
onDragStart={onDragStart}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</Tag>
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user