File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,23 @@ export class DOMEventHandlers {
2828 container : HTMLDivElement ,
2929 data : IEditorData | IElement [ ] ,
3030 options : IEditorOption = { }
31- ) {
31+ ) : Editor {
3232 // if (DOMEventHandlers.instance) {
3333 // console.log('tried to register again. Returning')
3434 // return
3535 // }
36+ if ( DOMEventHandlers . instance ) {
37+ try {
38+ DOMEventHandlers . instance . destroy ( ) ;
39+ } catch ( e ) {
40+ console . warn ( "Cleaning up old editor instance" ) ;
41+ }
42+ }
3643 DOMEventHandlers . instance = new Editor ( container , data , options )
3744 DOMEventHandlers . instance . command . executeSetLocale ( 'en' )
3845 DOMEventHandlers . instance . register . langMap ( 'en' , en )
46+
47+ return DOMEventHandlers . instance ;
3948 }
4049
4150 static handleUndo ( ) {
You can’t perform that action at this time.
0 commit comments