@@ -95,9 +95,14 @@ export interface IProps {
9595 toolbar : NonNullable < EditorOptions [ 'toolbar' ] > ;
9696 /**
9797 * @see {@link https://www.tiny.cloud/docs/tinymce/7/react-ref/#disabled React Tech Ref - disabled }
98- * @description Whether the editor should be "disabled" (read-only) .
98+ * @description Whether the editor should be "disabled".
9999 */
100100 disabled : boolean ;
101+ /**
102+ * @see {@link https://www.tiny.cloud/docs/tinymce/7/react-ref/#readonly React Tech Ref - readonly }
103+ * @description Whether the editor should be readonly.
104+ */
105+ readonly : boolean ;
101106 /**
102107 * @see {@link https://www.tiny.cloud/docs/tinymce/7/react-ref/#textareaname React Tech Ref - textareaName }
103108 * @description Set the `name` attribute of the `textarea` element used for the editor in forms. Only valid in iframe mode.
@@ -209,9 +214,9 @@ export class Editor extends React.Component<IAllProps> {
209214 }
210215 } ) ;
211216 }
212- if ( this . props . disabled !== prevProps . disabled ) {
213- const disabled = this . props . disabled ?? false ;
214- setMode ( this . editor , disabled ? 'readonly' : 'design' ) ;
217+ if ( this . props . readonly !== prevProps . readonly ) {
218+ const readonly = this . props . readonly ?? false ;
219+ setMode ( this . editor , readonly ? 'readonly' : 'design' ) ;
215220 }
216221 }
217222 }
@@ -440,7 +445,7 @@ export class Editor extends React.Component<IAllProps> {
440445 ...this . props . init as Omit < InitOptions , OmittedInitProps > ,
441446 selector : undefined ,
442447 target,
443- readonly : this . props . disabled ,
448+ disabled : this . props . disabled ,
444449 inline : this . inline ,
445450 plugins : mergePlugins ( this . props . init ?. plugins , this . props . plugins ) ,
446451 toolbar : this . props . toolbar ?? this . props . init ?. toolbar ,
@@ -477,8 +482,8 @@ export class Editor extends React.Component<IAllProps> {
477482 editor . undoManager . add ( ) ;
478483 editor . setDirty ( false ) ;
479484 }
480- const disabled = this . props . disabled ?? false ;
481- setMode ( this . editor , disabled ? 'readonly' : 'design' ) ;
485+ const readonly = this . props . readonly ?? false ;
486+ setMode ( this . editor , readonly ? 'readonly' : 'design' ) ;
482487 // ensure existing init_instance_callback is called
483488 if ( this . props . init && isFunction ( this . props . init . init_instance_callback ) ) {
484489 this . props . init . init_instance_callback ( editor ) ;
0 commit comments