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 // used by context menu
47 context : { // ?? static really
58 opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
63 title: "Caption Align",
64 opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
78 * create a DomHelper friendly object - for use with
79 * Roo.DomHelper.markup / overwrite / etc..
89 if ((''+this.width).length) {
90 img.width = this.width;
92 if ((''+ this.height).length) {
93 img.height = this.height;
97 'data-block' : 'BlockFigure',
98 contenteditable : 'false',
99 style : 'text-align:' + this.align,
104 contenteditable : true,
105 style : 'text-align:left',
112 readElement : function(node)
114 this.image_src = this.getVal(node, 'img', 'src');
115 this.align = this.getVal(node, 'figure', 'style', 'text-align');
116 this.caption = this.getVal(node, 'figcaption', 'html');
117 this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
120 updateElement : function(node)
122 Roo.DomHelper.overwrite(node, this.toObject());
126 Roo.DomHelper.markup(this.toObject());
129 getVal : function(node, tag, attr, style)
132 if (n.tagName != tag.toUpperCase()) {
133 // in theory we could do figure[3] << 3rd figure? or some more complex search..?
135 n = node.getElementsByTagName(tag).item(0);
137 if (attr == 'html') {
140 if (attr == 'style') {
141 return Roo.get(n).getStyle(style);
144 return Roo.get(n).attr(attr);