b1e526aef7a535062fb5a9487cc309d5789a86af
[roojs1] / examples / bootstrap4 / Editor.html
1 <!DOCTYPE html>
2 <html>
3   <head>
4     <title>Bootstrap - Editor Example</title>
5     <meta name="viewport" content="width=device-width, initial-scale=1.0">
6     
7        <!-- Bootstrap -->
8     <link rel="stylesheet" type="text/css" href="../../css-bootstrap4/bootstrap.min.css">
9     <link rel="stylesheet" type="text/css" href="../../css-bootstrap4/roojs-bootstrap.css">
10     <link rel="stylesheet" type="text/css" href="../../css-bootstrap/font-awesome.css">
11     
12     <script type="text/javascript" src="../../roojs-debug.js"></script>
13     
14      <script type="text/javascript" src="../../roojs-bootstrap-debug.js"></script>
15
16  
17     
18     
19     <!-- test code -->
20     <script type="text/javascript" src="../bootstrap/Editor.js"></script>
21   </head>
22   
23   <body id="body">
24     <script type="text/javascript">
25         Campaign = { Dialog : {} };
26         
27         var baseURL = '/web.campaign/index.local.php';
28         var rootURL = '/web.campaign';
29         
30         Roo.XComponent.hideProgress = true;
31         
32         Roo.onReady(function() {
33             Roo.XComponent.build();
34         });
35         
36         Roo.XComponent.on('buildcomplete', function() {
37           return;
38             Roo.Ajax.request({
39                 url : baseURL + '/editor/data.php',
40                 method: 'GET',
41                 success : function(r)
42                 {
43                  
44                     
45                     Roo.example.Editor.previewPanel.body().dom.innerHTML = "this is an examples"
46                     
47                     Roo.each(Roo.example.Editor.previewPanel.body().select('.campaign-editable', true).elements, function(el){
48                         
49                         var target = el.attr('data-target');
50                         
51                         Roo.example.Editor[target] = new Roo.bootstrap.editor.TextBlock({ panel : 'thanks-email' }).render(el);
52                         
53                     })
54                     
55                     Roo.each(Roo.example.Editor.previewPanel.body().select('.campaign-image-editable', true).elements, function(el){
56                         
57                         var target = el.attr('data-target');
58                         
59                         Roo.example.Editor[target] = new Roo.bootstrap.editor.ImageBlock({ panel : 'thanks-email' }).render(el);
60                         Roo.example.Editor[target].parent = el;
61                       /*  
62                         Roo.example.Editor[target].on('upload', function(){
63                             Campaign.Dialog.Images.show(
64                                 {
65                                     onid : 237,
66                                     ontable : 'campaign_detail',
67                                     imgtype : target
68                                 }, 
69                                 function(){
70                                     Roo.Ajax.request({
71                                         url : baseURL + '/Roo/Images',
72                                         method: 'GET',
73                                         params: {
74                                             _preview : target,
75                                             onid : 237
76                                         },
77                                         success : function(r)
78                                         {
79                                             var res = Roo.decode(r.responseText);
80                                             
81                                             if(!res.success){
82                                                 return;
83                                             }
84                                             
85                                             var width = Roo.example.Editor[target].parent.getWidth();
86                                             
87                                             Roo.example.Editor[target].setValue((baseURL + '/Images/Thumb/' + width + '/' + res.data.id));
88                                         }
89                                     });
90                                 }
91                             );
92                         })
93                         */
94                         
95                     })
96                     
97                     for ( var p in res.data.campaign.emails ){
98                         var f = res.data.campaign.emails[p];
99                         
100                         for (var d in f['message']){
101                             Roo.example.Editor[d].setValue(f['message'][d])
102                         }
103                         
104                         for (var d in f['image']){
105                             var width = Roo.example.Editor[d].parent.getWidth();
106                             Roo.example.Editor[d].setValue(baseURL + '/Images/Thumb/' + width + '/' + f['image'][d]);
107                         }
108                         
109                     }
110                     
111                 }
112             });
113         });
114         
115
116         
117     </script>
118     
119     <script src="../../../Campaign/Campaign.Dialog.Images.js" type="text/javascript"></script>
120   </body>
121 </html>