(function ($) { $.wysiwyg.dialog.register("default", function () { var that = this; this._$dialog = null; this.init = function() { var abstractDialog = this, content = this.options.content; if(typeof content == 'object') { if(typeof content.html == 'function') { content = content.html(); } else if(typeof content.toString == 'function') { content = content.toString(); } } that._$dialog = $('
'); var $topbar = $(''); var $link = $('X'); $link.click(function () { abstractDialog.close(); // this is important it makes sure that is close from the abstract $.wysiwyg.dialog instace, not just locally }); $topbar.find('.wysiwyg-dialog-close-wrapper').prepend($link); var $dcontent = $('