1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-12 10:14:02 +02:00

Ensure the min-height for placeholders is set on the correct editor (#5148)

* Ensure the min-height for placeholders is set on the correct editor

* Add changeset

* Run prettier on changeset

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
Kevin Simons
2022-10-12 17:55:48 +02:00
committed by GitHub
parent 10d723fa02
commit a2b6786d19
2 changed files with 7 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import {
} from '../utils/weak-maps'
import { RenderLeafProps, RenderPlaceholderProps } from './editable'
import { useSlateStatic } from '../hooks/use-slate-static'
import { ReactEditor } from '..'
/**
* Individual leaves in a text node with unique formatting.
@@ -34,9 +35,7 @@ const Leaf = (props: {
useEffect(() => {
const placeholderEl = placeholderRef?.current
const editorEl = document.querySelector<HTMLDivElement>(
'[data-slate-editor="true"]'
)
const editorEl = ReactEditor.toDOMNode(editor, editor)
if (!placeholderEl || !editorEl) {
return