1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-11 17:53:59 +02:00

Fix performance issue with renderPlaceholder (#5339)

This commit is contained in:
Joe Anderson
2023-03-06 16:38:07 +00:00
committed by GitHub
parent 4ab18e8998
commit 62f8ddd971
2 changed files with 10 additions and 1 deletions

View File

@@ -129,6 +129,10 @@ export type EditableProps = {
*/
export const Editable = (props: EditableProps) => {
const defaultRenderPlaceholder = useCallback(
(props: RenderPlaceholderProps) => <DefaultPlaceholder {...props} />,
[]
)
const {
autoFocus,
decorate = defaultDecorate,
@@ -137,7 +141,7 @@ export const Editable = (props: EditableProps) => {
readOnly = false,
renderElement,
renderLeaf,
renderPlaceholder = props => <DefaultPlaceholder {...props} />,
renderPlaceholder = defaultRenderPlaceholder,
scrollSelectionIntoView = defaultScrollSelectionIntoView,
style: userStyle = {},
as: Component = 'div',