@@ -54,9 +54,7 @@ define([
5454 window . tinyMceEditors = $H ( { } ) ;
5555 }
5656
57- if ( ! tinyMceEditors . get ( this . id ) ) {
58- tinyMceEditors . set ( this . id , this ) ;
59- }
57+ tinyMceEditors . set ( this . id , this ) ;
6058 } ,
6159
6260 /**
@@ -76,11 +74,6 @@ define([
7674
7775 this . turnOff ( ) ;
7876
79- if ( ! tinyMCE ) {
80- console . error ( 'TinyMCE is not loaded' ) ;
81- return ;
82- }
83-
8477 if ( this . config . plugins ) {
8578 this . config . plugins . forEach ( function ( plugin ) {
8679 var deferred ;
@@ -122,15 +115,11 @@ define([
122115 }
123116
124117 jQuery . when . apply ( jQuery , deferreds ) . done ( function ( ) {
125- try {
126- tinyMCE . init ( settings ) ;
127- this . getPluginButtons ( ) . hide ( ) ;
128- varienGlobalEvents . clearEventHandlers ( 'open_browser_callback' ) ;
129- this . eventBus . clearEventHandlers ( 'open_browser_callback' ) ;
130- this . eventBus . attachEventHandler ( 'open_browser_callback' , tinyMceEditors . get ( self . id ) . openFileBrowser ) ;
131- } catch ( e ) {
132- console . error ( 'Error initializing TinyMCE:' , e ) ;
133- }
118+ tinyMCE . init ( settings ) ;
119+ this . getPluginButtons ( ) . hide ( ) ;
120+ varienGlobalEvents . clearEventHandlers ( 'open_browser_callback' ) ;
121+ this . eventBus . clearEventHandlers ( 'open_browser_callback' ) ;
122+ this . eventBus . attachEventHandler ( 'open_browser_callback' , tinyMceEditors . get ( self . id ) . openFileBrowser ) ;
134123 } . bind ( this ) ) ;
135124 } ,
136125
@@ -415,16 +404,16 @@ define([
415404
416405 require ( [ 'mage/adminhtml/browser' ] , function ( ) {
417406 MediabrowserUtility . openDialog ( wUrl , false , false , typeTitle , {
418- /**
407+ /**
419408 * Closed.
420409 */
421- closed : function ( ) {
422- frameDialog . show ( ) ;
423- jQuery ( '.tox-tinymce-aux' ) . show ( ) ;
424- } ,
410+ closed : function ( ) {
411+ frameDialog . show ( ) ;
412+ jQuery ( '.tox-tinymce-aux' ) . show ( ) ;
413+ } ,
425414
426- targetElementId : self . activeEditor ( ) ? self . activeEditor ( ) . id : null
427- }
415+ targetElementId : self . activeEditor ( ) ? self . activeEditor ( ) . id : null
416+ }
428417 ) ;
429418 } ) ;
430419 } ,
@@ -496,9 +485,7 @@ define([
496485
497486 this . getPluginButtons ( ) . show ( ) ;
498487
499- if ( tinyMCE && tinyMCE . get ( this . getId ( ) ) ) {
500- tinyMCE . execCommand ( 'mceRemoveEditor' , false , this . getId ( ) ) ;
501- }
488+ tinyMCE . execCommand ( 'mceRemoveEditor' , false , this . getId ( ) ) ;
502489
503490 return this ;
504491 } ,
0 commit comments