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"]],
75 * create a DomHelper friendly object - for use with
76 * Roo.DomHelper.markup / overwrite / etc..
86 if ((''+this.image_width).length) {
87 img.width = this.image_width;
89 if ((''+ this.height).length) {
90 img.height = this.image_height;
94 'data-block' : 'Figure',
95 contenteditable : 'false',
96 style : 'text-align:' + this.align,
101 contenteditable : true,
102 style : 'text-align:left',
109 readElement : function(node)
111 this.image_src = this.getVal(node, 'img', 'src');
112 this.align = this.getVal(node, 'figure', 'style', 'text-align');
113 this.caption = this.getVal(node, 'figcaption', 'html');
114 this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
117 updateElement : function(node)
119 Roo.DomHelper.overwrite(node, this.toObject());
122 * convert to plain HTML for calling insertAtCursor..
126 return 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);