From 6a4bcaa1f43bfe3112027235a92202c8515df432 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Mon, 16 Feb 2015 20:22:06 +0000 Subject: [PATCH] More API improvements --- package.json | 2 +- plugins/c9.core/ext.js | 5 ++++- plugins/c9.ide.dialog/dialog.js | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3ac363ab..3e5392ba 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "c9.ide.imgeditor": "#08bbc53578", "c9.ide.immediate": "#e9ba147cc2", "c9.ide.installer": "#24e7d6f399", - "c9.ide.mount": "#eac3f96d4f", + "c9.ide.mount": "#32e79866ee", "c9.ide.navigate": "#1ff8b463aa", "c9.ide.newresource": "#9a7464cc47", "c9.ide.openfiles": "#28a4f5af16", diff --git a/plugins/c9.core/ext.js b/plugins/c9.core/ext.js index cf588ee9..0dcead7a 100644 --- a/plugins/c9.core/ext.js +++ b/plugins/c9.core/ext.js @@ -391,6 +391,8 @@ define(function(require, exports, module) { // } if (!baseclass) { + delete this.baseclass; + delete this.freezePublicAPI.baseclass; delete this.freezePublicAPI; delete this.setAPIKey; delete this.getEmitter; @@ -401,6 +403,7 @@ define(function(require, exports, module) { return this; }; var baseclass; + this.baseclass = this.freezePublicAPI.baseclass = function(){ baseclass = true; }; function getElement(name, callback) { @@ -611,7 +614,7 @@ define(function(require, exports, module) { /***** Register and define API *****/ - this.freezePublicAPI.baseclass(); + this.baseclass(); /** * Base class for all Plugins of Cloud9. A Cloud9 Plugin is diff --git a/plugins/c9.ide.dialog/dialog.js b/plugins/c9.ide.dialog/dialog.js index c0beb302..3eb584ab 100644 --- a/plugins/c9.ide.dialog/dialog.js +++ b/plugins/c9.ide.dialog/dialog.js @@ -74,11 +74,14 @@ define(function(require, module, exports) { var modal = options.modal; var zindex = options.zindex; var allowClose = options.allowClose; - var elements = options.elements; + var elements = options.elements || []; var resizable = options.resizable || false; var widths = options.widths || {}; var count = 0; + if (custom === undefined) + custom = !(body || heading); + var dialog, buttons, titles; var loaded; @@ -148,9 +151,14 @@ define(function(require, module, exports) { buttons = plugin.getElement("buttons"); // Create dynamic UI elements - elements.forEach(function(item) { - createItem(null, null, item); - }); + if (elements.length) { + elements.forEach(function(item) { + createItem(null, null, item); + }); + } + else { + buttons.parentNode.removeChild(buttons); + } emit.sticky("draw", { aml: titles,