From 1b8586c07951accbc3c0f3951966e4e258b0c5d9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 4 Jun 2012 15:34:57 -0700 Subject: Adding saving blocking screen This is for chrome preview, also fixed other preview bug with plain files not opening in preview. --- js/document/mediators/template.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js/document/mediators') diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 17fa553c..c3e8033b 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js @@ -334,7 +334,9 @@ exports.TemplateDocumentMediator = Montage.create(Component, { var webgltag, webgllibtag, webglrdgetag, mjstag, mjslibtag, matchingtags = [], scripts = template.file.content.document.getElementsByTagName('script'), libsobserver = {montage: false, canvas: false, montageCopied: null, canvasCopied: null, callback: libCopyCallback, dispatched: false}; - + //TODO: Clean up, this is messy + if (mJsSerialization) libsobserver.montage = true; + if (template.webgl && template.webgl.length > 1) libsobserver.canvas = true; // for (var i in scripts) { if (scripts[i].getAttribute) { @@ -378,7 +380,6 @@ exports.TemplateDocumentMediator = Montage.create(Component, { if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; - libsobserver.canvas = true; this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, rdgeDirName, function(result) {libsobserver.canvasCopied = result; this.libCopied(libsobserver);}.bind(this)); } else { //TODO: Error handle no available library to copy @@ -505,7 +506,6 @@ exports.TemplateDocumentMediator = Montage.create(Component, { if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Montage') { mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; - libsobserver.montage = true; this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, mjsDirName, function(result) {libsobserver.montageCopied = result; this.libCopied(libsobserver);}.bind(this)); @@ -589,7 +589,11 @@ exports.TemplateDocumentMediator = Montage.create(Component, { cleanHTML = cleanHTML.replace(/ninja-content/gi, 'div'); } // - return this.getPrettyHtml(cleanHTML.replace(this.getAppTemplatesUrlRegEx(), '')); + if (libsobserver.montage || libsobserver.canvas) { + return {content: this.getPrettyHtml(cleanHTML.replace(this.getAppTemplatesUrlRegEx(), '')), libs: true}; + } else { + return {content: this.getPrettyHtml(cleanHTML.replace(this.getAppTemplatesUrlRegEx(), '')), libs: false}; + } } }, //////////////////////////////////////////////////////////////////// @@ -614,7 +618,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, { if (observer.callback && !observer.dispatched) observer.callback(false); observer.dispatched = true; } - } else if (observer.canvas && observer.canvasCopied) { + } else if (observer.canvas) { // if (observer.canvasCopied) { if (observer.callback && !observer.dispatched) observer.callback(true); -- cgit v1.2.3