aboutsummaryrefslogtreecommitdiff
path: root/js/stage/stage-view.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage/stage-view.reel')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index dc9980f0..91047e51 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -118,14 +118,9 @@ exports.StageView = Montage.create(Component, {
118 } 118 }
119 }, 119 },
120 120
121 121 //called for switching between html documents
122
123 switchDocument:{ 122 switchDocument:{
124 value: function(doc){ 123 value: function(doc){
125 //save editor cursor position
126 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){
127 this.application.ninja.documentController.activeDocument.hline = this.application.ninja.documentController.activeDocument.editor.getCursor(true);
128 }
129 this.application.ninja.documentController._hideCurrentDocument(); 124 this.application.ninja.documentController._hideCurrentDocument();
130 125
131 this.application.ninja.documentController.activeDocument = doc; 126 this.application.ninja.documentController.activeDocument = doc;
@@ -133,22 +128,26 @@ exports.StageView = Montage.create(Component, {
133 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 128 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
134 this.application.ninja.documentController._showCurrentDocument(); 129 this.application.ninja.documentController._showCurrentDocument();
135 130
136 var documentController = this.application.ninja.documentController; 131 //focus current document
137
138 //restore editor cursor position
139 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ 132 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){
140 this.application.ninja.documentController.activeDocument.editor.setCursor(this.application.ninja.documentController.activeDocument.hline);
141 document.getElementById("codeMirror_"+this.application.ninja.documentController.activeDocument.uuid).getElementsByClassName("CodeMirror")[0].focus(); 133 document.getElementById("codeMirror_"+this.application.ninja.documentController.activeDocument.uuid).getElementsByClassName("CodeMirror")[0].focus();
142 } 134 }
143 135
144 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 136 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
145 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe 137 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
146 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; 138 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument;
139
140 //reinitialize draw-util, snapmanager and view-util
141 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();
142
143 //this.application.ninja.stage.layout.reinitializeForSwitchDocument();
147 144
148 // TODO dispatch event here 145 // TODO dispatch event here
149 // appDelegateModule.MyAppDelegate.onSetActiveDocument(); 146 // appDelegateModule.MyAppDelegate.onSetActiveDocument();
150 } 147 }
151 148
149 NJevent("switchDocument");
150
152 } 151 }
153 }, 152 },
154 153