Can we set editor to readOnly based on state?
See original GitHub issueIssue Description
Is there a way to set the component as readOnly?
I’ve tried to set the config property readOnly
using a state property called submitLoading
that will be true or false.
It seems that dynamically using state to set this property won’t change the property since the component is already initialized.
Here’s what I got goin on:
<CKEditor
scriptUrl="/ckeditor/ckeditor.js"
content={data.notes}
config={{
removePlugins: "elementspath,uploadimage,uploadfile",
toolbar: "None",
readOnly: submitLoading
}}
events={{ instanceReady: editorReady.bind(this), change: this.editorChange.bind(this) }}
/>
Any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Is there a way to set editor to readOnly when you can only ...
Is there a way to set editor to readOnly when you can only access the EditorView, EditorState, and an instance of editorview in...
Read more >Read-Only Mode - CKEditor 4 Documentation
When the editor goes from the editable into the read-only state, its readOnly property is being set to true (for read-only mode) or...
Read more >asp.net mvc - How do I make EditorFor conditionally readonly?
The line I have above does work insofar as it makes the text box read-only. I need to make this conditional based upon...
Read more >HTML attribute: readonly - HTML: HyperText Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.
Read more >Read-Only Editor - Kendo UI for jQuery - Documentation
You can render the Editor in its read-only state by removing the contenteditable attribute of the body element. Even though the Editor is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you use config property to set readOnly, it will only work during the initialisation.
If you want to toggle the readOnly mode dynamically, you can keep a reference to the CKEditor and use it to toggle the editor whenever the submitLoading property changes. Here is a sample code.
Closing this issue due to no further activity.