File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change 11/**
22 * jsPDFEditor
3- *
4- * This is the demo interface for jsPDF.
3+ * @return {[type] } [description]
54 */
65var jsPDFEditor = function ( ) {
7-
6+
7+ var editor ;
8+
89 return {
910 init : function ( ) {
1011
12+ var timeout = setTimeout ( function ( ) { } , 0 ) ;
1113
12- var editor = ace . edit ( "editor" ) ;
14+ editor = ace . edit ( "editor" ) ;
1315
1416 editor . setTheme ( "ace/theme/monokai" ) ;
15- editor . getSession ( ) . setMode ( "ace/mode/javascript" ) ;
17+ editor . getSession ( ) . setMode ( "ace/mode/javascript" ) ;
18+
19+ editor . getSession ( ) . on ( 'change' , function ( ) {
20+ if ( $ ( '#auto-refresh' ) . is ( ':checked' ) ) {
21+ clearTimeout ( timeout ) ;
22+ timeout = setTimeout ( function ( ) {
23+ jsPDFEditor . update ( ) ;
24+
25+ } , 200 ) ;
26+ }
1627
17- console . log ( 'hello' ) ;
18- var doc = new jsPDF ( ) ;
19- doc . text ( 10 , 10 , 'Hello world.' ) ;
20- var string = doc . output ( 'datauristring' ) ;
28+ } ) ;
2129
22- $ ( 'iframe' ) . attr ( 'src' , string ) ;
2330
2431 } ,
2532 update : function ( ) {
33+ setTimeout ( function ( ) {
34+ eval ( editor . getValue ( ) ) ;
35+ var string = doc . output ( 'datauristring' ) ;
2636
37+ $ ( 'iframe' ) . attr ( 'src' , string ) ;
38+ } , 0 ) ;
2739
2840 }
2941 } ;
You can’t perform that action at this time.
0 commit comments