Repository URL to install this package:
|
Version:
0.2.1 ▾
|
var Editor = {};
Editor.buildChildren = function(obj) {
var children = obj.children,
html = '';
$.each(children, function(i) {
this.attrs.html = this.attrs.html || '';
if (this.children) {
this.attrs.html += Editor.buildChildren(this);
}
html += $(this.tag, this.attrs)[0].outerHTML;
});
return html;
};
Editor.buildToolbar = function($toolbar) {
// Build tools
for (var tag in toolbars.tools) {
$toolbar.append($("<a />", toolbars.tools[tag]));
}
// Build dialogs
for (var dialog in toolbars.dialogs) {
$toolbar.append(function() {
var attrs = toolbars.dialogs[dialog].attrs,
children = toolbars.dialogs[dialog].children,
tags = [],
el;
attrs.html = Editor.buildChildren(toolbars.dialogs[dialog]);
return $("<div />", attrs);
});
}
for (var modal in toolbars.modals) {
$('body').append(function() {
var attrs = toolbars.modals[modal].attrs;
return $("<div />", attrs);
});
}
};