aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.css1
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.js23
-rwxr-xr-xjs/components/layout/documents-tab.reel/documents-tab.html5
-rwxr-xr-xjs/io/document/base-document.js5
-rwxr-xr-xjs/io/document/document-controller.js34
-rwxr-xr-xjs/io/document/html-document.js23
-rwxr-xr-xjs/io/document/text-document.js1
-rwxr-xr-xjs/ninja.reel/ninja.html2
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js25
9 files changed, 79 insertions, 40 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css
index ce173cd6..52d08d72 100755
--- a/js/components/layout/document-entry.reel/document-entry.css
+++ b/js/components/layout/document-entry.reel/document-entry.css
@@ -35,4 +35,5 @@
35 35
36.documentEntry span.dirty:before{ 36.documentEntry span.dirty:before{
37 content: "*"; 37 content: "*";
38 display:inline;
38} 39}
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
index 2a33548a..a1bed79b 100755
--- a/js/components/layout/document-entry.reel/document-entry.js
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -77,6 +77,23 @@ exports.DocumentEntry = Montage.create(Component, {
77 } 77 }
78 }, 78 },
79 79
80 _dirtyFlag:{
81 enumerable:false,
82 value:false
83 },
84 dirtyFlag:{
85 get: function() {
86 return this._dirtyFlag;
87 },
88 set: function(value) {
89 var previousValue = this._dirtyFlag;
90 this._dirtyFlag = value;
91
92 if (previousValue !== this._dirtyFlag) {
93 this.needsDraw = true;
94 }
95 }
96 },
80 97
81 prepareForDraw: { 98 prepareForDraw: {
82 enumerable: false, 99 enumerable: false,
@@ -92,6 +109,12 @@ exports.DocumentEntry = Montage.create(Component, {
92 this.label.innerText = this._name ? this._name : ""; 109 this.label.innerText = this._name ? this._name : "";
93 110
94 this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); 111 this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab");
112
113 if(this.dirtyFlag === true){
114 if(!this.label.classList.contains("dirty")){this.label.classList.add("dirty");}
115 }else{
116 if(this.label.classList.contains("dirty")){this.label.classList.remove("dirty");}
117 }
95 } 118 }
96 }, 119 },
97 120
diff --git a/js/components/layout/documents-tab.reel/documents-tab.html b/js/components/layout/documents-tab.reel/documents-tab.html
index 94b2e46e..82ba8782 100755
--- a/js/components/layout/documents-tab.reel/documents-tab.html
+++ b/js/components/layout/documents-tab.reel/documents-tab.html
@@ -38,6 +38,11 @@
38 "boundObjectPropertyPath": "objectAtCurrentIteration.name", 38 "boundObjectPropertyPath": "objectAtCurrentIteration.name",
39 "oneway": true 39 "oneway": true
40 }, 40 },
41 "dirtyFlag": {
42 "boundObject": {"@": "repetition1"},
43 "boundObjectPropertyPath": "objectAtCurrentIteration.dirtyFlag",
44 "oneway": true
45 },
41 "active": { 46 "active": {
42 "boundObject": {"@": "repetition1"}, 47 "boundObject": {"@": "repetition1"},
43 "boundObjectPropertyPath": "objectAtCurrentIteration.isActive", 48 "boundObjectPropertyPath": "objectAtCurrentIteration.isActive",
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js
index ecc92447..918b51ad 100755
--- a/js/io/document/base-document.js
+++ b/js/io/document/base-document.js
@@ -31,11 +31,6 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
31 set: function(value) { this._uri = value; } 31 set: function(value) { this._uri = value; }
32 }, 32 },
33 33
34 externalUri: {
35 get: function() { return this._externalUri; },
36 set: function(value) { this._externalUri = value; }
37 },
38
39 documentType: { 34 documentType: {
40 get: function() { return this._documentType; }, 35 get: function() { return this._documentType; },
41 set: function(value) { this._documentType = value; } 36 set: function(value) { this._documentType = value; }
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index ca6b4533..51575a24 100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -239,45 +239,25 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
239 value: function(id) { 239 value: function(id) {
240 240
241 //if file dirty then save 241 //if file dirty then save
242 if(this.activeDocument.dirtyFlag === true){
243 this.activeDocument.save(true);
244 this.activeDocument.dirtyFlag=false;
245 }
242 246
243 var doc = this._findDocumentByUUID(id); 247 var doc = this._findDocumentByUUID(id);
244 this._removeDocumentView(doc.container); 248 this._removeDocumentView(doc.container);
245 249
250 var closeDocumentIndex = this._findIndexByUUID(id);
246 this._documents.splice(this._findIndexByUUID(id), 1); 251 this._documents.splice(this._findIndexByUUID(id), 1);
247 252
248 if(this.activeDocument.uuid === id && this._documents.length > 0) { 253 if(this.activeDocument.uuid === id && this._documents.length > 0) {
249
250 var closeDocumentIndex = this._findIndexByUUID(id);
251 var nextDocumentIndex = -1 ; 254 var nextDocumentIndex = -1 ;
252 if((this._documents.length > 0) && (closeDocumentIndex === 0)){ 255 if((this._documents.length > 0) && (closeDocumentIndex === 0)){
253 nextDocumentIndex = 1; 256 nextDocumentIndex = 1;
254 }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){ 257 }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){
255 nextDocumentIndex = closeDocumentIndex - 1; 258 nextDocumentIndex = closeDocumentIndex - 1;
256 } 259 }
257 260 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
258 //remove the codemirror div if this is for a code view
259 /////test
260
261 ////end- test
262
263 this.switchDocument(this._documents[0].uuid);
264
265 }
266 }
267 },
268
269 switchDocument: {
270 value: function(id) {
271 this._hideCurrentDocument();
272 this.activeDocument = this._findDocumentByUUID(id);
273
274 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
275 this._showCurrentDocument();
276
277 if(this.activeDocument.documentType === "htm" || this.activeDocument.documentType === "html") {
278 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
279 // TODO dispatch event here
280// appDelegateModule.MyAppDelegate.onSetActiveDocument();
281 } 261 }
282 } 262 }
283 }, 263 },
@@ -406,6 +386,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
406 if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){ 386 if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){
407 this.activeDocument.container.parentNode.style["display"] = "none"; 387 this.activeDocument.container.parentNode.style["display"] = "none";
408 this.application.ninja.stage.hideCanvas(true); 388 this.application.ninja.stage.hideCanvas(true);
389 this.application.ninja.stage.stageView.hideRulers();
409 } 390 }
410 } 391 }
411 } 392 }
@@ -418,6 +399,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
418 if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){ 399 if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){
419 this.activeDocument.container.parentNode.style["display"] = "block"; 400 this.activeDocument.container.parentNode.style["display"] = "block";
420 this.application.ninja.stage.hideCanvas(false); 401 this.application.ninja.stage.hideCanvas(false);
402 this.application.ninja.stage.stageView.showRulers();
421 } 403 }
422 } 404 }
423 } 405 }
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js
index da1bbe4a..8e1eb614 100755
--- a/js/io/document/html-document.js
+++ b/js/io/document/html-document.js
@@ -449,17 +449,22 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
449 */ 449 */
450 save:{ 450 save:{
451 value:function(removeCodeMirrorDivFlag){ 451 value:function(removeCodeMirrorDivFlag){
452 if(this.currentView === "design"){ 452 try{
453 //generate html and save 453 if(this.currentView === "design"){
454 }else if((this.currentView === "code") && (this.codeViewDocument !== null)){ 454 //generate html and save
455 if(removeCodeMirrorDivFlag === true){ 455 }else if((this.currentView === "code") && (this.codeViewDocument !== null)){
456 this.codeViewDocument.save(true); 456 if(removeCodeMirrorDivFlag === true){
457 }else{ 457 this.codeViewDocument.save(true);
458 this.codeViewDocument.save(); 458 }else{
459 this.codeViewDocument.save();
460 }
461 //persist to filesystem
459 } 462 }
460 //persist to filesystem 463 this.dirtyFlag=false;
464 }catch(e){
465 console.log("Error while saving "+this.uri);
466 console.log(e.stack);
461 } 467 }
462
463 } 468 }
464 } 469 }
465}); \ No newline at end of file 470}); \ No newline at end of file
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
index a768779f..683c513c 100755
--- a/js/io/document/text-document.js
+++ b/js/io/document/text-document.js
@@ -95,6 +95,7 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
95 save:{ 95 save:{
96 value:function(removeCodeMirrorDivFlag){ 96 value:function(removeCodeMirrorDivFlag){