fix: prevents a bug where a line break was incorrectly added at enter in react node views, fix #1197
This commit is contained in:
@@ -20,7 +20,7 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor> {
|
||||
|
||||
renderer!: ReactRenderer
|
||||
|
||||
contentDOMElement!: Element | null
|
||||
contentDOMElement!: HTMLElement | null
|
||||
|
||||
mount() {
|
||||
const props: NodeViewProps = {
|
||||
@@ -58,6 +58,13 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor> {
|
||||
? null
|
||||
: document.createElement(this.node.isInline ? 'span' : 'div')
|
||||
|
||||
if (this.contentDOMElement) {
|
||||
// For some reason the whiteSpace prop is not inherited properly in Chrome and Safari
|
||||
// With this fix it seems to work fine
|
||||
// See: https://github.com/ueberdosis/tiptap/issues/1197
|
||||
this.contentDOMElement.style.whiteSpace = 'inherit'
|
||||
}
|
||||
|
||||
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
||||
editor: this.editor,
|
||||
props,
|
||||
|
||||
Reference in New Issue
Block a user