@@ -21,7 +21,7 @@ angular.module('ui.tinymce', [])
2121 var ngModel = ctrls [ 0 ] ,
2222 form = ctrls [ 1 ] || null ;
2323
24- var expression , options , tinyInstance ,
24+ var expression , options = { } , tinyInstance ,
2525 updateView = function ( editor ) {
2626 var content = editor . getContent ( { format : options . format } ) . trim ( ) ;
2727 content = $sce . trustAsHtml ( content ) ;
@@ -55,7 +55,7 @@ angular.module('ui.tinymce', [])
5555
5656 angular . extend ( expression , scope . $eval ( attrs . uiTinymce ) ) ;
5757
58- options = {
58+ var setupOptions = {
5959 // Update model when calling setContent
6060 // (such as from the source editor popup)
6161 setup : function ( ed ) {
@@ -74,7 +74,7 @@ angular.module('ui.tinymce', [])
7474 } ) ;
7575
7676 // Update model on change
77- ed . on ( 'change' , function ( e ) {
77+ ed . on ( 'change' , function ( ) {
7878 ed . save ( ) ;
7979 updateView ( ed ) ;
8080 } ) ;
@@ -99,12 +99,12 @@ angular.module('ui.tinymce', [])
9999 } ) ;
100100 }
101101 } ,
102- format : 'raw' ,
102+ format : expression . format || 'raw' ,
103103 selector : '#' + attrs . id
104104 } ;
105105 // extend options with initial uiTinymceConfig and
106106 // options from directive attribute value
107- angular . extend ( options , uiTinymceConfig , expression ) ;
107+ angular . extend ( options , uiTinymceConfig , expression , setupOptions ) ;
108108 // Wrapped in $timeout due to $tinymce:refresh implementation, requires
109109 // element to be present in DOM before instantiating editor when
110110 // re-rendering directive
0 commit comments