aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js48
1 files changed, 26 insertions, 22 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 1f339fe7..c31ffbac 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -66,35 +66,37 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
66 66
67 67
68 68
69
70
71
72
73 ////////////////////////////////////////////////////////////////////
74 //
69 handleWebRequest: { 75 handleWebRequest: {
70 value: function (request) { 76 value: function (request) {
71 if (request.url.indexOf('js/document/templates/montage-html') !== -1) { 77 if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) {
72 78 //TODO: Optimize creating string
73 console.log(request); 79 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]};
74
75 //TODO: Figure out why active document is not available here
76
77 if (this._hackRootFlag) {
78
79 //console.log(request.url.split('/')[request.url.split('/').length-1]);
80 //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]);
81
82 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]};
83 }
84 } 80 }
85 } 81 }
86 }, 82 },
87 83 ////////////////////////////////////////////////////////////////////
88 84 //
89 handleAppLoaded: { 85 handleAppLoaded: {
90 value: function() { 86 value: function() {
91 // 87 //Adding an intercept to resources loaded to ensure user assets load from cloud simulator
92
93 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); 88 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]);
94
95 } 89 }
96 }, 90 },
97 91 ////////////////////////////////////////////////////////////////////
92
93
94
95
96
97
98
99
98 handleExecuteFileOpen: { 100 handleExecuteFileOpen: {
99 value: function(event) { 101 value: function(event) {
100 var pickerSettings = event._event.settings || {}; 102 var pickerSettings = event._event.settings || {};
@@ -118,8 +120,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
118 //TODO: Check for appropiate structures 120 //TODO: Check for appropiate structures
119 handleExecuteSave: { 121 handleExecuteSave: {
120 value: function(event) { 122 value: function(event) {
121 //Text and HTML document classes should return the same save object for fileSave 123 if(!!this.activeDocument){
122 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); 124 //Text and HTML document classes should return the same save object for fileSave
125 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this));
126 }
123 } 127 }
124 }, 128 },
125 //////////////////////////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////
@@ -459,5 +463,5 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
459 value: function() { 463 value: function() {
460 return "userDocument_" + (this._iframeCounter++); 464 return "userDocument_" + (this._iframeCounter++);
461 } 465 }
462 } 466 }
463}); 467});