Trix: Question: disable the editor

Created on 26 Oct 2016  路  2Comments  路  Source: basecamp/trix

Hi,
I have searched a bit with not luck, so here I'm. I'd like to know if it's possible to put the editor in readonly mode or not, in order to make the content not-mutable.
Is there any accessory method for accomplishing that?
Thanks

All 2 comments

There isn't an official way.

You could turn off contenteditable

document.querySelector("trix-initialize").contentEditable = false

Or disable interactions with CSS

trix-editor, 
trix-toolbar {
  pointer-events: none;
}

Or hide the editor and display its contents in a plain element on the page.

Hope that helps!

Hey on this issue, can I mark an inserted html component as read only?
such that the user cannot be able to edit that specific component

my use case, I am using Trix as Web template for webpages

Was this page helpful?
0 / 5 - 0 ratings