aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-29 12:06:21 -0800
committerValerio Virgillito2012-02-29 12:06:21 -0800
commit2f3e4d12aa15077d3cc9794862156e57b7815e68 (patch)
tree2f52260fe417a5a59eab3ec075db4c549e085419
parent850f3a1f7ab81ec80b6de1c49f2d2bbcbfe87c8e (diff)
parent0996a519afccbed526912807c70c20d598e9cae7 (diff)
downloadninja-2f3e4d12aa15077d3cc9794862156e57b7815e68.tar.gz
Merge pull request #87 from joseeight/FileIO-Build-Candidate
Fixes to preview caching issues
-rwxr-xr-xjs/document/html-document.js5
-rw-r--r--js/mediators/io-mediator.js17
2 files changed, 13 insertions, 9 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 826a59c0..5d507476 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -647,9 +647,10 @@ exports.HTMLDocument = Montage.create(TextDocument, {
647 enumerable: false, 647 enumerable: false,
648 value: function () { 648 value: function () {
649 //TODO: Add logic to handle save before preview 649 //TODO: Add logic to handle save before preview
650 this.saveAll(); 650 this.application.ninja.documentController.handleExecuteSaveAll(null);
651 //Launching 'blank' tab for testing movie 651 //Launching 'blank' tab for testing movie
652 chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); 652 window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]);
653 //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]});
653 } 654 }
654 }, 655 },
655 //////////////////////////////////////////////////////////////////// 656 ////////////////////////////////////////////////////////////////////
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 6b26668b..e763c67c 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -39,6 +39,12 @@ exports.IoMediator = Montage.create(Component, {
39 enumerable: false, 39 enumerable: false,
40 value: ProjectIo 40 value: ProjectIo
41 }, 41 },
42 ////////////////////////////////////////////////////////////////////
43 //
44 appTemplatesUrl: {
45 enumerable: false,
46 value: new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi')
47 },
42 //////////////////////////////////////////////////////////////////// 48 ////////////////////////////////////////////////////////////////////
43 // 49 //
44 fileNew: { 50 fileNew: {
@@ -209,8 +215,7 @@ exports.IoMediator = Montage.create(Component, {
209 template.document.content.document.head.innerHTML = template.head; 215 template.document.content.document.head.innerHTML = template.head;
210 //Getting all CSS (style or link) tags 216 //Getting all CSS (style or link) tags
211 var styletags = template.document.content.document.getElementsByTagName('style'), 217 var styletags = template.document.content.document.getElementsByTagName('style'),
212 linktags = template.document.content.document.getElementsByTagName('link'), 218 linktags = template.document.content.document.getElementsByTagName('link');
213 url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi'); //TODO: Make public into var
214 //Looping through link tags and removing file recreated elements 219 //Looping through link tags and removing file recreated elements
215 for (var j in styletags) { 220 for (var j in styletags) {
216 if (styletags[j].getAttribute) { 221 if (styletags[j].getAttribute) {
@@ -345,7 +350,7 @@ exports.IoMediator = Montage.create(Component, {
345 webgltag.innerHTML = json; 350 webgltag.innerHTML = json;
346 } 351 }
347 // 352 //
348 return this.getPrettyHtml(template.document.content.document.documentElement.outerHTML.replace(url, '')); 353 return this.getPrettyHtml(template.document.content.document.documentElement.outerHTML.replace(this.appTemplatesUrl, ''));
349 } 354 }
350 }, 355 },
351 //////////////////////////////////////////////////////////////////// 356 ////////////////////////////////////////////////////////////////////
@@ -354,7 +359,7 @@ exports.IoMediator = Montage.create(Component, {
354 enumerable: false, 359 enumerable: false,
355 value: function (list) { 360 value: function (list) {
356 //Variable to store CSS definitions 361 //Variable to store CSS definitions
357 var i, str, url, css = ''; 362 var i, str, css = '';
358 //Looping through list 363 //Looping through list
359 if (list && list.length > 0) { 364 if (list && list.length > 0) {
360 //Adding each list item to string and also adding breaks 365 //Adding each list item to string and also adding breaks
@@ -362,10 +367,8 @@ exports.IoMediator = Montage.create(Component, {
362 css += list[i].cssText; 367 css += list[i].cssText;
363 } 368 }
364 } 369 }
365 //TODO: Add better logic for creating this string
366 url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi');
367 //Returning the CSS string 370 //Returning the CSS string
368 return this.getPrettyCss(css.replace(url, '')); 371 return this.getPrettyCss(css.replace(this.appTemplatesUrl, ''));
369 } 372 }
370 }, 373 },
371 //////////////////////////////////////////////////////////////////// 374 ////////////////////////////////////////////////////////////////////