@@ -11,14 +11,7 @@ angular
11
11
if ( ! element . hasClass ( 'processed' ) ) {
12
12
element . addClass ( 'processed' ) ;
13
13
14
- // if the directive was called after document.ready, e.g. because of ng-if then the element
15
- // will not have been initialized by bootstrap-markdown
16
- if ( element . markdown === undefined ) {
17
- element . data ( 'markdown' , ( data = new $ . fn . markdown . Constructor ( element [ 0 ] , { } ) ) )
18
- }
19
-
20
- // Setup the markdown WYSIWYG.
21
- element . markdown ( {
14
+ var markdownOptions = {
22
15
autofocus : options . autofocus || false ,
23
16
saveable : options . saveable || false ,
24
17
savable : options . savable || false ,
@@ -69,7 +62,17 @@ angular
69
62
runScopeFunction ( scope , attrs . onShow , e ) ;
70
63
}
71
64
}
72
- } ) ;
65
+ } ;
66
+
67
+ // Setup the markdown WYSIWYG.
68
+
69
+ // if the markdown editor was added dynamically the markdown function will be undefined
70
+ // so it has to be called explicitely
71
+ if ( element . markdown === undefined ) {
72
+ element . data ( 'markdown' , ( data = new $ . fn . markdown . Constructor ( element [ 0 ] , markdownOptions ) ) )
73
+ } else {
74
+ element . markdown ( markdownOptions ) ;
75
+ }
73
76
}
74
77
}
75
78
} ;
0 commit comments