From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- .../CSSPanel/CSSPanelBase.reel/CSSPanelBase.js | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'js/panels/CSSPanel/CSSPanelBase.reel') diff --git a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js index b4a803b2..b496ce4a 100755 --- a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js +++ b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js @@ -57,11 +57,6 @@ var CSSPanel = exports.CSSPanelBase = (require("montage/core/core").Montage).cre this.eventManager.addEventListener("selectionChange", this, true); this.eventManager.addEventListener("elementChange", this, true); - this.eventManager.addEventListener("openDocument", this, true); - - if(this.application.ninja.currentDocument) { - this.captureOpenDocument(); - } this.addEventListener('webkitTransitionEnd', this, false); ['sheets', 'styles'].forEach(function(section) { @@ -73,11 +68,29 @@ var CSSPanel = exports.CSSPanelBase = (require("montage/core/core").Montage).cre this._setUpToolbars(); } }, - captureOpenDocument : { - value : function(e) { - this.populateStyleSheetList(); + + _currentDocument: { + value : null, + enumerable : false + }, + + currentDocument : { + get : function() { + return this._currentDocument; + }, + set : function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + + if(this._currentDocument.currentView === "design") { + this.populateStyleSheetList(); + } } }, + handleWebkitTransitionEnd : { value: function(e) { //console.log('transition end at panel base'); -- cgit v1.2.3