aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js36
-rwxr-xr-xjs/data/menu-data.js9
-rwxr-xr-xjs/document/html-document.js59
-rwxr-xr-xjs/document/templates/montage-html/default_html.css75
-rwxr-xr-xjs/document/templates/montage-html/index.html50
-rw-r--r--js/document/templates/montage-html/main.reel/main.js54
-rwxr-xr-xjs/document/templates/montage-html/package.json8
-rwxr-xr-xjs/document/templates/montage-html/styles.css5
-rwxr-xr-xjs/document/text-document.js5
-rwxr-xr-xjs/helper-classes/3D/view-utils.js42
-rw-r--r--js/io/system/ninjalibrary.js2
-rw-r--r--js/io/system/ninjalibrary.json3
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.html2
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js4
-rw-r--r--js/mediators/io-mediator.js21
-rwxr-xr-xjs/mediators/keyboard-mediator.js6
-rwxr-xr-xjs/models/app-model.js12
-rwxr-xr-xjs/ninja.reel/ninja.js7
18 files changed, 353 insertions, 47 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index b1a22c1b..1f339fe7 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -14,7 +14,7 @@ var Montage = require("montage/core/core").Montage,
14 DocumentController; 14 DocumentController;
15//////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////
16// 16//
17DocumentController = exports.DocumentController = Montage.create(Component, { 17var DocumentController = exports.DocumentController = Montage.create(Component, {
18 hasTemplate: { 18 hasTemplate: {
19 value: false 19 value: false
20 }, 20 },
@@ -22,6 +22,10 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
22 _documents: { 22 _documents: {
23 value: [] 23 value: []
24 }, 24 },
25
26 _hackRootFlag: {
27 value: false
28 },
25 29
26 _activeDocument: { value: null }, 30 _activeDocument: { value: null },
27 _iframeCounter: { value: 1, enumerable: false }, 31 _iframeCounter: { value: 1, enumerable: false },
@@ -56,12 +60,38 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
56 this.eventManager.addEventListener("executeSave", this, false); 60 this.eventManager.addEventListener("executeSave", this, false);
57 61
58 this.eventManager.addEventListener("recordStyleChanged", this, false); 62 this.eventManager.addEventListener("recordStyleChanged", this, false);
63
59 } 64 }
60 }, 65 },
66
67
68
69 handleWebRequest: {
70 value: function (request) {
71 if (request.url.indexOf('js/document/templates/montage-html') !== -1) {
72
73 console.log(request);
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 }
85 }
86 },
87
61 88
62 handleAppLoaded: { 89 handleAppLoaded: {
63 value: function() { 90 value: function() {
64 // 91 //
92
93 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]);
94
65 } 95 }
66 }, 96 },
67 97
@@ -180,6 +210,9 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
180 // 210 //
181 openDocument: { 211 openDocument: {
182 value: function(doc) { 212 value: function(doc) {
213
214 //
215 this.documentHackReference = doc;
183 // 216 //
184 switch (doc.extension) { 217 switch (doc.extension) {
185 case 'html': case 'html': 218 case 'html': case 'html':
@@ -277,7 +310,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
277 _onOpenDocument: { 310 _onOpenDocument: {
278 value: function(doc){ 311 value: function(doc){
279 //var data = DocumentManager.activeDocument; 312 //var data = DocumentManager.activeDocument;
280
281 this._hideCurrentDocument(); 313 this._hideCurrentDocument();
282 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); 314 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
283 315
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 6503e776..7c3ca5d4 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -140,6 +140,15 @@ exports.MenuData = Montage.create( Montage, {
140 } 140 }
141 }, 141 },
142 { 142 {
143 "displayText" : "Chrome Preview",
144 "hasSubMenu" : false,
145 "enabled": true,
146 "checked": {
147 "value": false,
148 "boundProperty": "chromePreview"
149 }
150 },
151 {
143 "displayText" : "Layout View", 152 "displayText" : "Layout View",
144 "hasSubMenu" : false, 153 "hasSubMenu" : false,
145 "enabled": true, 154 "enabled": true,
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 0c8695fb..77cc711d 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -14,7 +14,7 @@ var Montage = require("montage/core/core").Montage,
14exports.HTMLDocument = Montage.create(TextDocument, { 14exports.HTMLDocument = Montage.create(TextDocument, {
15 15
16 _selectionExclude: { value: null, enumerable: false }, 16 _selectionExclude: { value: null, enumerable: false },
17 _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, 17 _htmlTemplateUrl: { value: "js/document/templates/montage-html/index.html", enumerable: false},
18 _iframe: { value: null, enumerable: false }, 18 _iframe: { value: null, enumerable: false },
19 _server: { value: null, enumerable: false }, 19 _server: { value: null, enumerable: false },
20 _templateDocument: { value: null, enumerable: false }, 20 _templateDocument: { value: null, enumerable: false },
@@ -235,6 +235,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
235 // 235 //
236 initialize: { 236 initialize: {
237 value: function(file, uuid, iframe, callback) { 237 value: function(file, uuid, iframe, callback) {
238 this.application.ninja.documentController._hackRootFlag = false;
238 // 239 //
239 this._userDocument = file; 240 this._userDocument = file;
240 // 241 //
@@ -354,11 +355,19 @@ exports.HTMLDocument = Montage.create(TextDocument, {
354 }, 355 },
355 356
356 357
358
359
360
357 361
358 //////////////////////////////////////////////////////////////////// 362 ////////////////////////////////////////////////////////////////////
359 // 363 //
360 handleEvent: { 364 handleEvent: {
361 value: function(event){ 365 value: function(event){
366 //TODO: Remove
367 window.hackPreview = this.livePreview.bind(this);
368
369 this.application.ninja.documentController._hackRootFlag = true;
370 //console.log(this._userDocument.root, this);
362 //TODO: Clean up, using for prototyping save 371 //TODO: Clean up, using for prototyping save
363 this._templateDocument = {}; 372 this._templateDocument = {};
364 this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; 373 this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");;
@@ -389,6 +398,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
389 this._stylesheets = this._document.styleSheets; // Entire stlyesheets array 398 this._stylesheets = this._document.styleSheets; // Entire stlyesheets array
390 399
391 this.callback(this); 400 this.callback(this);
401
402 //console.log('file content end');
392 } 403 }
393 }.bind(this), 50); 404 }.bind(this), 50);
394 405
@@ -440,7 +451,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
440 } 451 }
441 452
442 // Remving this callback and using the callback from the css load 453 // Remving this callback and using the callback from the css load
443 // this.callback(this); 454 //this.callback(this);
455
456
444 457
445 } 458 }
446 }, 459 },
@@ -461,6 +474,48 @@ exports.HTMLDocument = Montage.create(TextDocument, {
461 } 474 }
462 }, 475 },
463 476
477
478
479
480
481
482
483
484
485
4