@@ -47,7 +47,7 @@ export class NgxJoditProComponent implements ControlValueAccessor, AfterViewInit
4747 this . _options = value ;
4848
4949 if ( value ) {
50- this . initJoditContainer ( ) ;
50+ this . initJoditContainer ( ) . then ( ) ;
5151 }
5252 }
5353
@@ -106,7 +106,6 @@ export class NgxJoditProComponent implements ControlValueAccessor, AfterViewInit
106106 delay ( 0 )
107107 ) . subscribe ( ( [ [ _ , initialized ] , text ] ) => {
108108 if ( this . jodit && initialized ) {
109- this . joditContainer . nativeElement . innerHTML = text ;
110109 this . jodit . setEditorValue ( text ) ;
111110 }
112111 } ) ;
@@ -123,23 +122,24 @@ export class NgxJoditProComponent implements ControlValueAccessor, AfterViewInit
123122 ) ;
124123 }
125124
126- ngAfterViewInit ( ) {
127- this . initJoditContainer ( ) ;
125+ async ngAfterViewInit ( ) {
126+ await this . initJoditContainer ( ) ;
128127 }
129128
130129 ngOnDestroy ( ) {
131130 this . valueSubscription ?. unsubscribe ( ) ;
132131 this . jodit ?. events . destruct ( ) ;
133132 }
134133
135- initJoditContainer ( ) {
134+ async initJoditContainer ( ) {
136135 if ( this . joditContainer ?. nativeElement ) {
137136 if ( this . jodit ) {
138137 this . jodit . destruct ( ) ;
139138 this . joditInitializedSubject . next ( false ) ;
140139 }
141140 this . jodit = Jodit . make ( this . joditContainer . nativeElement , this . _options ) as IJodit ;
142- this . joditContainer . nativeElement . innerHTML = this . valueSubject . getValue ( ) ;
141+ await this . jodit . waitForReady ( ) ;
142+ this . jodit . setEditorValue ( this . valueSubject . getValue ( ) ) ;
143143
144144 this . jodit . events . on ( 'change' , ( text : string ) => {
145145 this . internValueChange = true ;
0 commit comments