Reputation: 377
I have an editor which uses an inline toolbar for manipulating text, as well as adding comments to a text range, refining text range using AI, etc.
For users with edit access I have no problem showing that toolbar using addContextToolbar
.
For users who have readonly access to the text, I want to keep using the toolbar, but this time only show the "Add Comment" button. This is also fairly trivial to do. I make a new toolbar using the same addContextToolbar
function, this time with a different predicate.
Unfortunately, showing toolbars is disabled when the entire editor is disabled (for users with read access). Also I recently learned that using @tinymce/tinymce-react
and passing readonly: true
to init
doesn't do anything. Only way to disable editor is by using the disabled
prop.
Is there any way to keep being able to show toolbars in disabled
mode? I really don't want to make my own toolbar (there are no examples online anyway). I also don't want to make my own "readonly" mode, where I ignore all keystrokes and make the caret transparent.
Upvotes: 0
Views: 116
Reputation: 377
I ended up using the answer to this question. Setting editable_root
to false
makes the editor not editable, but inline toolbars keep working.
If this helped be sure to upvote the original answer.
Upvotes: 0