more styling
[roojs1] / Roo / rtf / Group.js
1
2 Roo.rtf.Group = function(parent)
3 {
4     // we dont want to acutally store parent - it will make debug a nightmare..
5     this.content = [];
6     this.cn  = [];
7      
8        
9     
10 };
11
12 Roo.rtf.Group.prototype = {
13     ignorable : false,
14     content: false,
15     cn: false,
16     addContent : function(node) {
17         // could set styles...
18         this.content.push(node);
19     },
20     addChild : function(cn)
21     {
22         this.cn.push(cn);
23     },
24     // only for images really...
25     toDataURL : function()
26     {
27         var mimetype = false;
28         switch(true) {
29             case this.content.filter(function(a) { return a.value == 'pngblip' } ).length > 0: 
30                 mimetype = "image/png";
31                 break;
32              case this.content.filter(function(a) { return a.value == 'jpegblip' } ).length > 0:
33                 mimetype = "image/jpeg";
34                 break;
35             default :
36                 return 'about:blank'; // ?? error?
37         }
38         
39         
40         var hexstring = this.content[this.content.length-1].value;
41         
42         return 'data:' + mimetype + ';base64,' + btoa(hexstring.match(/\w{2}/g).map(function(a) {
43             return String.fromCharCode(parseInt(a, 16));
44         }).join(""));
45     }
46     
47 };