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.readElement(cfg.node);
28 this.updateElement(cfg.node);
33 Roo.htmleditor.BlockFigure.prototype = {
45 context : { // ?? static really
56 opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
61 title: "Caption Align",
62 opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
84 if ((''+this.width).length) {
85 img.width = this.width;
87 if ((''+ this.height).length) {
88 img.height = this.height;
92 'data-block' : 'BlockFigure',
93 contenteditable : 'false',
94 style : 'text-align:' + this.align,
99 'data-name' : 'caption',
100 contenteditable : true,
101 style : 'text-align:left',
107 readElement : function(node)
109 this.image_src = this.getVal(node, 'img', 'src');
110 this.align = this.getVal(node, 'figure', 'style', 'text-align');
111 this.caption = this.getVal(node, 'figcaption', 'html');
112 this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
115 updateElement : function(node)
117 Roo.DomHelper.overwrite(node, this.toObject());
121 getVal : function(node, tag, attr, style)
124 if (n.tagName != tag.toUpperCase()) {
125 // in theory we could do figure[3] << 3rd figure? or some more complex search..?
127 n = node.getElementsByTagName(tag).item(0);
129 if (attr == 'html') {
132 if (attr == 'style') {
133 return Roo.get(n).getStyle(style);
136 return Roo.get(n).attr(attr);