mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 10:44: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:
5
.changeset/funny-sheep-double.md
Normal file
5
.changeset/funny-sheep-double.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Ensure the min-height for placeholders is set on the correct editor
|
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '../utils/weak-maps'
|
} from '../utils/weak-maps'
|
||||||
import { RenderLeafProps, RenderPlaceholderProps } from './editable'
|
import { RenderLeafProps, RenderPlaceholderProps } from './editable'
|
||||||
import { useSlateStatic } from '../hooks/use-slate-static'
|
import { useSlateStatic } from '../hooks/use-slate-static'
|
||||||
|
import { ReactEditor } from '..'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Individual leaves in a text node with unique formatting.
|
* Individual leaves in a text node with unique formatting.
|
||||||
@@ -34,9 +35,7 @@ const Leaf = (props: {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const placeholderEl = placeholderRef?.current
|
const placeholderEl = placeholderRef?.current
|
||||||
const editorEl = document.querySelector<HTMLDivElement>(
|
const editorEl = ReactEditor.toDOMNode(editor, editor)
|
||||||
'[data-slate-editor="true"]'
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!placeholderEl || !editorEl) {
|
if (!placeholderEl || !editorEl) {
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user