From 795329d2225ff3b760f7f0ea3bb6b5e68f6c6b5b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 29 Feb 2012 10:07:53 -0800 Subject: Making class level url template variable Created a class level variable for the URL to be parsed out of the user files. --- js/mediators/io-mediator.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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 @@ -38,6 +38,12 @@ exports.IoMediator = Montage.create(Component, { pio: { enumerable: false, value: ProjectIo + }, + //////////////////////////////////////////////////////////////////// + // + appTemplatesUrl: { + enumerable: false, + value: new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi') }, //////////////////////////////////////////////////////////////////// // @@ -209,8 +215,7 @@ exports.IoMediator = Montage.create(Component, { template.document.content.document.head.innerHTML = template.head; //Getting all CSS (style or link) tags var styletags = template.document.content.document.getElementsByTagName('style'), - linktags = template.document.content.document.getElementsByTagName('link'), - url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi'); //TODO: Make public into var + linktags = template.document.content.document.getElementsByTagName('link'); //Looping through link tags and removing file recreated elements for (var j in styletags) { if (styletags[j].getAttribute) { @@ -345,7 +350,7 @@ exports.IoMediator = Montage.create(Component, { webgltag.innerHTML = json; } // - return this.getPrettyHtml(template.document.content.document.documentElement.outerHTML.replace(url, '')); + return this.getPrettyHtml(template.document.content.document.documentElement.outerHTML.replace(this.appTemplatesUrl, '')); } }, //////////////////////////////////////////////////////////////////// @@ -354,7 +359,7 @@ exports.IoMediator = Montage.create(Component, { enumerable: false, value: function (list) { //Variable to store CSS definitions - var i, str, url, css = ''; + var i, str, css = ''; //Looping through list if (list && list.length > 0) { //Adding each list item to string and also adding breaks @@ -362,10 +367,8 @@ exports.IoMediator = Montage.create(Component, { css += list[i].cssText; } } - //TODO: Add better logic for creating this string - url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi'); //Returning the CSS string - return this.getPrettyCss(css.replace(url, '')); + return this.getPrettyCss(css.replace(this.appTemplatesUrl, '')); } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From bb3e42b531848b400670df6caf0f3ce02adf1243 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 29 Feb 2012 11:28:58 -0800 Subject: Fix: Caching issue with chrome tab API Using window.open to test movie. --- js/document/html-document.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/document/html-document.js b/js/document/html-document.js index 6853f4d7..60eecc59 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -649,7 +649,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { //TODO: Add logic to handle save before preview this.saveAll(); //Launching 'blank' tab for testing movie - chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); + window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); + //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 03d277db80b6cea9a25320c0575ae2bf7a6d7e6e Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 29 Feb 2012 11:46:44 -0800 Subject: Preview Fix Adding save all logic before preview, temporary fix. --- js/document/html-document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/document/html-document.js b/js/document/html-document.js index 60eecc59..579603e0 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -647,7 +647,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { enumerable: false, value: function () { //TODO: Add logic to handle save before preview - this.saveAll(); + this.application.ninja.documentController.handleExecuteSaveAll(null); //Launching 'blank' tab for testing movie window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); -- cgit v1.2.3