Skip to content

Commit 08caef0

Browse files
authored
fix(rich-text-input): placeholder bug (#1099)
* fix(rich-text-input): placeholder bug
1 parent eb9ef45 commit 08caef0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/internals/rich-text-plugins/rich-text-plugins.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@ const plugins = [
1818
editor.value.document.nodes.map(node => node.text).toArray()
1919
.length === 1;
2020
const blocks = editor.value.blocks.map(block => block.type).toArray();
21+
2122
const hasOneBlock = blocks.length === 1;
2223
const isParagraph = blocks[0] && blocks[0] === BLOCK_TAGS.p;
2324

2425
const shouldUsePlaceholder =
25-
isEditorEmpty && hasOneNode && hasOneBlock && isParagraph;
26+
!editor.hasPlaceholder &&
27+
isEditorEmpty &&
28+
hasOneNode &&
29+
hasOneBlock &&
30+
isParagraph;
2631

32+
// eslint-disable-next-line no-param-reassign
33+
editor.hasPlaceholder = shouldUsePlaceholder;
2734
return shouldUsePlaceholder;
2835
},
2936
},

0 commit comments

Comments
 (0)