From 4937b39fb0cf542f57cdadc7d1e2ed9798f7ef87 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 16:09:14 -0800 Subject: fixes to document tabbing Signed-off-by: Ananya Sen --- .../pickerNavigator.reel/pickerNavigator.js | 2 +- js/controllers/document-controller.js | 32 +++++++++++++--------- js/ninja.reel/ninja.html | 4 +-- js/stage/stage-view.reel/stage-view.js | 1 - 4 files changed, 22 insertions(+), 17 deletions(-) (limited to 'js') diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js index 6b0d92f7..edc24a2c 100644 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js @@ -794,7 +794,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { handleOkButtonAction : { value: function(evt){ - console.log("$$$ File Picker : selected "+ this.selectedItems.toString()); + //console.log("$$$ File Picker : selected "+ this.selectedItems.toString()); var success = true; if(!!this.pickerModel.callback && (this.selectedItems.length > 0)){//call the callback if it is available try{ diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index f397ace7..b1a22c1b 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -34,17 +34,17 @@ DocumentController = exports.DocumentController = Montage.create(Component, { return this._activeDocument; }, set: function(doc) { - if(this._activeDocument) this._activeDocument.isActive = false; - - if(this._documents.indexOf(doc) === -1) this._documents.push(doc); + if(!!this._activeDocument) this._activeDocument.isActive = false; this._activeDocument = doc; - this._activeDocument.isActive = true; + if(!!this._activeDocument){ - if(!!this._activeDocument.editor){ - this._activeDocument.editor.focus(); + if(this._documents.indexOf(doc) === -1) this._documents.push(doc); + this._activeDocument.isActive = true; + if(!!this._activeDocument.editor){ + this._activeDocument.editor.focus(); + } } - } }, @@ -184,7 +184,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { switch (doc.extension) { case 'html': case 'html': //Open in designer view - Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument); + Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); break; default: //Open in code view @@ -250,7 +250,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, { } var doc = this._findDocumentByUUID(id); - this._removeDocumentView(doc.container); var closeDocumentIndex = this._findIndexByUUID(id); this._documents.splice(this._findIndexByUUID(id), 1); @@ -263,8 +262,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, { nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); + this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ - //if there are no documents to switch to then just show the iframeContainer + this.activeDocument = null; + this._removeDocumentView(doc.container); + this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; } } @@ -275,11 +277,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, { _onOpenDocument: { value: function(doc){ //var data = DocumentManager.activeDocument; - //DocumentManager._hideCurrentDocument(); - //stageManagerModule.stageManager.toggleCanvas(); + this._hideCurrentDocument(); + this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); + + this.application.ninja.stage.hideCanvas(false); + + this.activeDocument = doc; - DocumentController.activeDocument = doc; + this._showCurrentDocument(); NJevent("onOpenDocument", doc); // appDelegateModule.MyAppDelegate.onSetActiveDocument(); diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 9a1a6b97..2d00d8dc 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -348,10 +348,10 @@
-
+
-
+
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 31ace49c..2144af84 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -187,7 +187,6 @@ exports.StageView = Montage.create(Component, { }, hideOtherDocuments:{ value:function(docUuid){ - //use CodeMirror toTextArea() to remove editor and save content into textarea this.application.ninja.documentController._documents.forEach(function(aDoc){ if(aDoc.currentView === "design"){ aDoc.container.parentNode.style["display"] = "none"; -- cgit v1.2.3