@@ -74,7 +74,6 @@ const configAttributes: Record<string, (v: string) => unknown> = {
7474 icons : parseString , // name of icon pack eg. 'material'
7575 icons_url : parseString , // url to icon pack js
7676 promotion : parseBooleanOrString , // boolean
77- disabled : parseBooleanOrString , // boolean
7877} ;
7978
8079const configRenames : Record < string , string > = {
@@ -202,6 +201,9 @@ class TinyMceEditor extends HTMLElement {
202201 if ( this . readonly ) {
203202 config . readonly = true ;
204203 }
204+ if ( this . disabled ) {
205+ config . disabled = true ;
206+ }
205207 if ( this . autofocus ) {
206208 config . auto_focus = true ;
207209 }
@@ -294,6 +296,8 @@ class TinyMceEditor extends HTMLElement {
294296 if ( oldValue !== newValue ) {
295297 if ( attribute === 'form' ) {
296298 this . _updateForm ( ) ;
299+ } else if ( attribute === 'disabled' ) {
300+ this . disabled = newValue !== null ;
297301 } else if ( attribute === 'readonly' ) {
298302 this . readonly = newValue !== null ;
299303 } else if ( attribute === 'autofocus' ) {
@@ -357,25 +361,23 @@ class TinyMceEditor extends HTMLElement {
357361 }
358362
359363 get disabled ( ) : boolean {
360- if ( this . _editor ) {
361- return this . _editor . mode . get ( ) === 'disabled' ;
362- } else {
363- return this . hasAttribute ( 'disabled' ) ;
364- }
364+ return this . _editor ? this . _editor . options . get ( 'disabled' ) : this . hasAttribute ( 'disabled' ) ;
365365 }
366366
367367 set disabled ( value : boolean ) {
368368 if ( value ) {
369- if ( this . _editor && this . _editor . mode . get ( ) !== 'disabled' ) {
370- this . _editor . mode . set ( 'disabled' ) ;
369+ if ( this . _editor && this . _editor . options . get ( 'disabled' ) === false ) {
370+ this . _editor . options . set ( 'disabled' , value ) ;
371371 }
372+
372373 if ( ! this . hasAttribute ( 'disabled' ) ) {
373374 this . setAttribute ( 'disabled' , '' ) ;
374375 }
375376 } else {
376- if ( this . _editor && this . _editor . mode . get ( ) === 'disabled' ) {
377- this . _editor . mode . set ( 'design' ) ;
377+ if ( this . _editor && this . _editor . options . get ( 'disabled' ) === true ) {
378+ this . _editor . options . set ( 'disabled' , false ) ;
378379 }
380+
379381 if ( this . hasAttribute ( 'disabled' ) ) {
380382 this . removeAttribute ( 'disabled' ) ;
381383 }
0 commit comments