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

Allowing only 1 block?

Open butaminas opened this issue 6 years ago • 4 comments

Is there any way to disable the ability to add new blocks?

The way I use this editor is that the content is already present and only use a modified list module.

I need to somehow disable the ability to add new blocks and allow only editing the one existing block.

butaminas avatar Aug 17 '19 15:08 butaminas

Did you find how to do it?

GruFFix avatar Aug 13 '20 14:08 GruFFix

I need (some of) the same thing. I want a single-line editorjs that can only add/edit one block.

vkarisari avatar Jun 20 '25 09:06 vkarisari

As a workaround you can limit it via API and hide Plus button via CSS. Read this article, there is a similar solution: https://codex.so/editorjs-max-length

neSpecc avatar Jun 20 '25 09:06 neSpecc

Okay. I have been able to trim blocks using the onchange event handler with the api. I still need:

  1. "Enter" to not create a new block
  2. Plus and move button to disappear (edit: fixed setting display: none on .ce-toolbar__actions)
  3. Make inline toolbar appear outside/ontop of editorjs placeholer/wrapper

vkarisari avatar Jun 20 '25 11:06 vkarisari