codex-team / codex-team/editor.js

💡ReadyOnly on a per Block basis

Open
#1,589 7 comments 7 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.