codex-team / codex-team/editor.js

Error: Editor's content can not be saved in read-only mode

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

Description

I'm using EditorJS as my rich text editor, but I'm using readOnly option, as I don't want the user to edit what is written unless he press on a specific button.
So whenever the user start to edit it and try to save it, I got this `Error: Editor's content can not be saved in read-only mode`

read-only option is mentioned in the [documentation here](https://editorjs.io/tools-api), but it doesn't mention how to use it !
So Am I using read-only wrongly, or it should be set in other way?
If yes, how to enable read-only mode for tools.

This is what I'm using:
```
import Header from '@editorjs/header';
import Paragraph from '@editorjs/paragraph'

const RichGuidelinesEditor = ({ value, onChange, isReadOnly }) => {
const EDITOR_JS_TOOLS = {
paragraph: {
class: Paragraph,
inlineToolbar: true,
readOnly: true,
},
header: {
class: Header,
readOnly: true,
},
}

const handleOnChange = e => { e.saver.save().then(res => { onChange(res.blocks); }

return(
args[0]}
/>
)
}
export default RichGuidelinesEditor;
```

Browser: Chrome.
OS: Windows 10.

Editor.js version: Latest version.

Plugins: "[react-editor-js](https://www.npmjs.com/package/react-editor-js)"

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.