From f00eee5e8b2d2ab804d8dc55824787b5636fa6e1 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Thu, 19 Feb 2015 17:06:48 +0000 Subject: [PATCH 1/3] Some docs related changes to pane --- plugins/c9.core/ext.js | 12 ++++++------ plugins/c9.ide.console/console.js | 4 ++-- plugins/c9.ide.editors/document.js | 2 +- plugins/c9.ide.editors/pane.js | 27 +++++++++++++-------------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/plugins/c9.core/ext.js b/plugins/c9.core/ext.js index 0dcead7a..fe7d79c9 100644 --- a/plugins/c9.core/ext.js +++ b/plugins/c9.core/ext.js @@ -124,12 +124,6 @@ define(function(require, exports, module) { return usedBy } - function loadRemotePlugin(id, options, callback) { - vfs.extend(id, options, function(err, meta) { - callback(err, meta && meta.api); - }); - } - function unloadAllPlugins(exclude) { if (lut.settings) lut.settings.unload(null, true); @@ -160,6 +154,12 @@ define(function(require, exports, module) { } } + function loadRemotePlugin(id, options, callback) { + vfs.extend(id, options, function(err, meta) { + callback(err, meta && meta.api); + }); + } + function fetchRemoteApi(id, callback) { vfs.use(id, {}, function(err, meta) { callback(err, meta && meta.api); diff --git a/plugins/c9.ide.console/console.js b/plugins/c9.ide.console/console.js index c3d01435..8ee3b85f 100644 --- a/plugins/c9.ide.console/console.js +++ b/plugins/c9.ide.console/console.js @@ -185,7 +185,7 @@ define(function(require, module, exports) { tabs.on("paneCreate", function(e) { if (hidden && container && ui.isChildOf(container, e.pane.aml)) { - e.pane.visible = false; + e.pane._visible = false; } }); @@ -297,7 +297,7 @@ define(function(require, module, exports) { maxHeight = window.innerHeight - 70; getPanes().forEach(function(pane) { - pane.visible = !shouldHide; + pane._visible = !shouldHide; }); if (!shouldHide && !tabs.focussedTab) { diff --git a/plugins/c9.ide.editors/document.js b/plugins/c9.ide.editors/document.js index 5326b831..596abdf0 100644 --- a/plugins/c9.ide.editors/document.js +++ b/plugins/c9.ide.editors/document.js @@ -362,7 +362,7 @@ define(function(require, module, exports) { }, /** * Sets or retrieves the serialized value of this document. - * Setting this document will not change the undo stack. Set + * Setting this property will not change the undo stack. Set * this property only to initialize the document or to reset * the value of this document. Requesting the value of this * document will cause it to serialize it's full state. diff --git a/plugins/c9.ide.editors/pane.js b/plugins/c9.ide.editors/pane.js index 359bcc24..851de469 100644 --- a/plugins/c9.ide.editors/pane.js +++ b/plugins/c9.ide.editors/pane.js @@ -657,20 +657,18 @@ define(function(require, module, exports) { * @readonly */ get group(){ - function getGroup(amlPane) { - var pNode = amlPane.parentNode; + var pNode = amlPane.parentNode; + + if (pNode.localName.indexOf("splitbox") == -1) + return false; - if (pNode.localName.indexOf("splitbox") == -1) - return false; - - var result = pNode.childNodes.map(function(aml) { - return aml.cloud9pane; - }); - // result.__defineGetter__("group", function(){ - // return getGroup(pNode) - // }); - return result; - } + var result = []; + pNode.childNodes.forEach(function(aml) { + if (aml.cloud9pane) + result.push(aml.cloud9pane); + }); + + return result; }, /** @@ -703,7 +701,8 @@ define(function(require, module, exports) { * @readonly */ get visible(){ return visible; }, - set visible(v){ visible = v; }, + set visible(v){ amlPane.setProperty("visible", v); visible = v; }, + set _visible(v){ visible = v; }, /** * Retrieves the meta object for this panel From f3cb3f8f6ad414db48a4018cb2d826e334b82a51 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Thu, 19 Feb 2015 22:38:39 +0000 Subject: [PATCH 2/3] added a suggestion from andrew and boyscouting --- plugins/c9.ide.editors/document.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/c9.ide.editors/document.js b/plugins/c9.ide.editors/document.js index 596abdf0..01cf170c 100644 --- a/plugins/c9.ide.editors/document.js +++ b/plugins/c9.ide.editors/document.js @@ -330,7 +330,7 @@ define(function(require, module, exports) { get editor(){ return editor; }, set editor(v) { editor = v; - emit("setEditor", {editor: v}); + emit("setEditor", { editor: v }); }, /** * Whether the document is fully loaded @@ -340,7 +340,7 @@ define(function(require, module, exports) { set ready(v) { if (ready) throw new Error("Permission Denied"); ready = true; - emit.sticky("ready"); + emit.sticky("ready", { doc: plugin }); }, /** * The tooltip displayed when hovering over the tab button @@ -349,7 +349,7 @@ define(function(require, module, exports) { get tooltip(){ return tooltip; }, set tooltip(v) { tooltip = v; - emit("setTooltip", {tooltip: v}); + emit("setTooltip", { tooltip: v }); }, /** * The title of the document (displayed as caption of the tab button) @@ -358,7 +358,7 @@ define(function(require, module, exports) { get title(){ return title; }, set title(v) { title = v; - emit("setTitle", {title: v}); + emit("setTitle", { title: v }); }, /** * Sets or retrieves the serialized value of this document. @@ -380,7 +380,7 @@ define(function(require, module, exports) { }, set value(v) { value = recentValue = v; - emit("setValue", {value: v}); + emit("setValue", { value: v }); hasValue = true; }, /** From 9a2cfb28b790548b5b2e4064e56e595f0c5742f6 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Sat, 21 Feb 2015 23:09:43 +0000 Subject: [PATCH 3/3] small changes --- plugins/c9.ide.ace/ace.js | 6 +++--- plugins/c9.ide.editors/document.js | 2 +- plugins/c9.ide.editors/editor.js | 3 ++- plugins/c9.ide.editors/undomanager.js | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index b6919a99..c45d1371 100644 --- a/plugins/c9.ide.ace/ace.js +++ b/plugins/c9.ide.ace/ace.js @@ -2075,7 +2075,7 @@ define(function(require, exports, module) { /***** Lifecycle *****/ - //@todo set selection, scroll and file in header + // @todo set selection, scroll and file in header plugin.on("load", function(){ @@ -2102,7 +2102,7 @@ define(function(require, exports, module) { doc.on("setValue", function set(e) { var aceSession = c9Session.session; if (!aceSession) - return; //This is probably a deconstructed document + return; // This is probably a deconstructed document // The first value that is set should clear the undo stack // additional times setting the value should keep it. @@ -2115,7 +2115,7 @@ define(function(require, exports, module) { hideProgress(); } - if (e.state) + if (e.state) // There is nowhere where e.state is set. Dead code? setState(doc, e.state); if (currentDocument === doc) diff --git a/plugins/c9.ide.editors/document.js b/plugins/c9.ide.editors/document.js index 01cf170c..25f217ea 100644 --- a/plugins/c9.ide.editors/document.js +++ b/plugins/c9.ide.editors/document.js @@ -369,7 +369,7 @@ define(function(require, module, exports) { * @property {String} value */ get value(){ - var calculated = emit("getValue", {value: value}); + var calculated = emit("getValue", { value: recentValue || value }); if (typeof calculated != "string") calculated = value; diff --git a/plugins/c9.ide.editors/editor.js b/plugins/c9.ide.editors/editor.js index cb7f573f..d51d8646 100644 --- a/plugins/c9.ide.editors/editor.js +++ b/plugins/c9.ide.editors/editor.js @@ -205,7 +205,8 @@ define(function(require, module, exports) { /***** Register and define API *****/ - plugin.freezePublicAPI.baseclass(); + // This is a base class + plugin.baseclass(); /** * Editor base class for Cloud9 Editors. Each file that is opened diff --git a/plugins/c9.ide.editors/undomanager.js b/plugins/c9.ide.editors/undomanager.js index e5c6f5d9..c88355c2 100644 --- a/plugins/c9.ide.editors/undomanager.js +++ b/plugins/c9.ide.editors/undomanager.js @@ -137,7 +137,7 @@ define(function(require, module, exports) { } function findItem(compressedItem) { - return emit("itemFind", {state: compressedItem}); + return emit("itemFind", { state: compressedItem }); } function reset(){ @@ -205,8 +205,8 @@ define(function(require, module, exports) { * } * * var undoManager = new UndoManager(); - * undoManager.add(new Item("a", 0)); // data = ["a"] - * undoManager.add(new Item("b", 1)); // data = ["a", "b"] + * undoManager.add(new Item("a").redo()); // data = ["a"] + * undoManager.add(new Item("b").redo()); // data = ["a", "b"] * * undoManager.undo(); // data = ["a"]; * undoManager.undo(); // data = [];