editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

How to display the placehoder only when editor is empty? (like in previous versions of Editor.js)

Open collimarco opened this issue 1 month ago • 3 comments

    this.editor = new EditorJS({
      holder: this.contentTarget,
      data: this.contentValue,
      placeholder: "Let's write an awesome newsletter...",
      // ...

The above code used to display the placeholder only when the editor was empty.

Now, upgrading Editor.js to the latest version, it displays the placeholder for each empty paragraph...

How can I show that placeholder only when editor is empty? (like in previous versions of Editor.js)

collimarco avatar Nov 13 '25 17:11 collimarco

The new recommendation is to specify a placeholder like "Enter text or paste a link"

neSpecc avatar Nov 13 '25 17:11 neSpecc

@neSpecc Thanks for the quick reply! So is it no longer possible to have the old behavior? We had a placeholder like "Let's write an awesome newsletter....", but it is annoying to see it for every new paragraph, it made more sense to display it only when editor is completely empty.

collimarco avatar Nov 13 '25 17:11 collimarco

You can try replacing the default Paragraph block with your own with such behavior.

You can read more about the new placeholder behavior here: https://codex.so/editorjs-2-30

neSpecc avatar Nov 13 '25 18:11 neSpecc