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 = {
44 context : { // ?? static really
55 opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
60 title: "Caption Align",
61 opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
75 toHtml : function(doc)
83 if ((''+this.width).length) {
84 img.width = this.width;
86 if ((''+ this.height).length) {
87 img.height = this.height;
89 return Roo.DomHelper.markup({
91 'data-block' : 'BlockFigure',
92 contenteditable : 'false',
93 style : 'text-align:' + this.align,
98 'data-name' : 'caption',
99 contenteditable : true,
100 style : 'text-align:left',
106 fromElement : function(node)
108 this.image_src = this.getVal(node, 'img', 'src');
109 this.align = this.getVal(node, 'figure', 'style', 'text-align');
110 this.caption = this.getVal(node, 'figcaption', 'html');
111 this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
114 getVal : function(node, tag, attr, style)
117 if (n.tagName != tag.toUpperCase()) {
118 // in theory we could do figure[3] << 3rd figure? or some more complex search..?
120 n = node.getElementsByTagName(tag).item(0);
122 if (attr == 'html') {
125 if (attr == 'style') {
126 return Roo.get(n).getStyle(style);
129 return Roo.get(n).attr(attr);