@@ -74,6 +74,7 @@ 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
7778} ;
7879
7980const configRenames : Record < string , string > = {
@@ -108,7 +109,7 @@ class TinyMceEditor extends HTMLElement {
108109 'on-ObjectSelected' , 'on-SetContent' , 'on-Show' , 'on-Submit' , 'on-Undo' ,
109110 'on-VisualAid' ] ;
110111
111- return [ 'form' , 'readonly' , 'autofocus' , 'placeholder' ] . concat ( nativeEvents ) . concat ( tinyEvents ) ;
112+ return [ 'form' , 'readonly' , 'autofocus' , 'placeholder' , 'disabled' ] . concat ( nativeEvents ) . concat ( tinyEvents ) ;
112113 }
113114
114115 constructor ( ) {
@@ -355,6 +356,32 @@ class TinyMceEditor extends HTMLElement {
355356 }
356357 }
357358
359+ get disabled ( ) : boolean {
360+ if ( this . _editor ) {
361+ return this . _editor . mode . get ( ) === 'disabled' ;
362+ } else {
363+ return this . hasAttribute ( 'disabled' ) ;
364+ }
365+ }
366+
367+ set disabled ( value : boolean ) {
368+ if ( value ) {
369+ if ( this . _editor && this . _editor . mode . get ( ) !== 'disabled' ) {
370+ this . _editor . mode . set ( 'disabled' ) ;
371+ }
372+ if ( ! this . hasAttribute ( 'disabled' ) ) {
373+ this . setAttribute ( 'disabled' , '' ) ;
374+ }
375+ } else {
376+ if ( this . _editor && this . _editor . mode . get ( ) === 'disabled' ) {
377+ this . _editor . mode . set ( 'design' ) ;
378+ }
379+ if ( this . hasAttribute ( 'disabled' ) ) {
380+ this . removeAttribute ( 'disabled' ) ;
381+ }
382+ }
383+ }
384+
358385 get placeholder ( ) : string | null {
359386 return this . getAttribute ( 'placeholder' ) ;
360387 }
0 commit comments