@@ -89,7 +89,6 @@ export default (Vue, Options = {}) => {
8989 }
9090
9191 this . currentConfig = this . clone ( this . config || this . defaultConfig ) ;
92- this . currentConfig = { ...this . currentConfig } ;
9392
9493 this . setContent ( true ) ;
9594
@@ -178,12 +177,21 @@ export default (Vue, Options = {}) => {
178177
179178 function htmlSet ( ) {
180179
181- self . _editor . html . set ( self . model || '' ) ;
180+ // Check if editor not null
181+ if ( self . _editor == null ) {
182+ return ;
183+ }
184+
185+ if ( self . _editor . html != undefined ) {
186+ self . _editor . html . set ( self . model || '' ) ;
187+ }
182188
183189 //This will reset the undo stack everytime the model changes externally. Can we fix this?
184190
185- self . _editor . undo . saveStep ( ) ;
186- self . _editor . undo . reset ( ) ;
191+ if ( self . _editor . undo != undefined ) {
192+ self . _editor . undo . saveStep ( ) ;
193+ self . _editor . undo . reset ( ) ;
194+ }
187195
188196 }
189197
@@ -217,6 +225,7 @@ export default (Vue, Options = {}) => {
217225 } ,
218226
219227 destroyEditor : function ( ) {
228+ this . initEvents = [ ] ;
220229
221230 if ( this . _editor ) {
222231
@@ -279,7 +288,12 @@ export default (Vue, Options = {}) => {
279288 var self = this ;
280289
281290 this . registerEvent ( 'initialized' , function ( ) {
282- if ( self . _editor . events ) {
291+
292+ // Editor initialized
293+ self . editorInitialized = true ;
294+
295+ // Check if editor not null and editor has events
296+ if ( self . _editor != null && self . _editor . events ) {
283297 // bind contentChange and keyup event to froalaModel
284298 self . _editor . events . on ( 'contentChanged' , function ( ) {
285299 self . updateModel ( ) ;
0 commit comments