Closed jackle23 closed 1 year ago
Ref: INT-2986
TinyMCE doesn't currently support that feature. The best I can do is to simulate it with a controlled component.
https://codesandbox.io/s/readonly-comments-w2knjz?file=/src/index.js
Note: this does not validate that only comments are added to the content. It uses the event fired when comments are created to grab a snapshot of the HTML. Basically it makes it very hard to permanently modify the content but it is certainly not impossible. With the use of the browser console I could easily trick this implementation by setting the content and manually firing the event - though this is true of anything that is client side validated only.
If you wanted to make sure this was correct you'd have to perform a diff server side and ensure that the content was only modified in approved ways.
currently, I have use case where I want
Editor
to be readable only by users, but still able to commentcurrently, TinyMCE already has
readonly
feature that what I want, but inEditor
for React, it can not work.This is my using version:
"@tinymce/tinymce-react": "^4.2.0"