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

💡ReadyOnly on a per Block basis

Open imryanjay opened this issue 3 years ago • 5 comments

With the great addition to ReadOnly setting the entire editor to contentEditable=false, it would great to implement this on a per block basis.

An example use case could be blocks received from an API where a parent user has set certain blocks that must be in an editor, while allowing a child user the ability to add / edit more.

a Block.ReadOnly could function the same as the editorJS readOnly by disabling the inline toolbar, as well as block settings.

To currently achieve this, I am passing readOnly: true to a block's data object

blocks: [
    {
        "type": "paragraph",
        "data": {
            readOnly: true,
            "text": "Hello World",
        },
    },
]

Disabling contentEditable on the Block element, then hiding the inline toolbar and block settings button. Works, but not ideal.

Thoughts on this as a feature?

imryanjay avatar Mar 11 '21 00:03 imryanjay

Could be an additional property to each Block in data.

blocks: [
    {
        "type": "paragraph",
        "data": {
            "text": "Hello World",
        },
       "config":  {
           "readOnly": true,
       }
    },
]

imryanjay avatar Mar 11 '21 00:03 imryanjay

Wonderful feature, hope to use it.

MeFelixWang avatar Dec 20 '21 06:12 MeFelixWang

+1 to this feature!

betaSavvy avatar Dec 30 '21 04:12 betaSavvy

Is this function implemented?

chenguzhen87 avatar Jan 20 '22 08:01 chenguzhen87

I'd like to use editor.js to create simple forms / survey type pages and then display the page in readonly mode but allow the viewer to enter data in to textbox, checkbox, radio button fields and then have that data saved. This feature would help with this but maybe not deliver the full functionality

ekwus avatar Mar 29 '22 19:03 ekwus