3 * <figure data-block="BlockFigure" contenteditable="false" role="group" style="text-align:left">' +
4 <img data-name="image" src="{SRC}">' +
5 <figcaption data-name="caption" contenteditable="true" style="text-align:left">XXXX</figcaption>
11 new Roo.htmleditor.BlockFigure{
12 image_src : 'http://www.google.com',
15 -- load document, and search for elements of this...
16 Roo.DomQuery.select('*[data-block])
17 // loop each and call ctor ({node : xxx})
19 ** see if parent has Element.findParent(*[data-block]);
24 Roo.htmleditor.BlockFigure = function(cfg)
27 this.fromElement(cfg.node);
32 Roo.htmleditor.BlockFigure.prototype = {
40 toHtml : function(doc)
42 return Roo.DomHelper.markup({
44 'data-block' : 'BlockFigure',
45 contenteditable : 'false',
46 style : 'text-align:' + this.align,
54 'data-name' : 'caption',
55 contenteditable : true,
56 style : 'text-align:left',
62 fromElement : function(node)
64 this.image_src = this.getVal(node, 'img', 'src');
65 this.align = this.getVal(node, 'figure', 'style', 'text-align');
66 this.caption = this.getVal(node, 'figcaption', 'html');
67 this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
70 getVal : function(node, tag, attr, style)
73 if (n.tagName != tag.toUpperCase()) {
74 // in theory we could do figure[3] << 3rd figure? or some more complex search..?
76 n = node.getElementsByTagName(tag).item(0);
81 if (attr == 'style') {
82 return Roo.get(n).getStyle(style);
85 return Roo.get(n).attr(attr);