Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can we set editor to readOnly based on state?

See original GitHub issue

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:

        removePlugins: "elementspath,uploadimage,uploadfile",
        toolbar: "None",
        readOnly: submitLoading
    events={{ instanceReady: editorReady.bind(this), change: this.editorChange.bind(this) }}

Any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

codeslayer1commented, Jul 26, 2018

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.

//call this function whenever your submitLoading property changes

       ref={instance => {this.ckeditor = instance;}}
codeslayer1commented, Aug 6, 2018

Closing this issue due to no further activity.

Read more comments on GitHub >

github_iconTop 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 > 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found