aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js48
-rwxr-xr-xjs/document/html-document.js222
-rwxr-xr-xjs/document/text-document.js14
-rwxr-xr-xjs/io/system/coreioapi.js31
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.css (renamed from js/components/ui/FilePicker/file-input-field.reel/file-input-field.css)0
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.html (renamed from js/components/ui/FilePicker/file-input-field.reel/file-input-field.html)2
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.js (renamed from js/components/ui/FilePicker/file-input-field.reel/file-input-field.js)0
-rwxr-xr-xjs/io/ui/file-picker/file-picker-controller.js (renamed from js/components/ui/FilePicker/file-picker-controller.js)4
-rwxr-xr-xjs/io/ui/file-picker/file-picker-model.js (renamed from js/components/ui/FilePicker/file-picker-model.js)2
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.css (renamed from js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css)0
-rwxr-xr-xjs/io/ui/file-picker/picker-navigator.reel/picker-navigator.html (renamed from js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html)4
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js (renamed from js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js)0
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html2
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js21
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.html2
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js21
-rwxr-xr-xjs/mediators/element-mediator.js6
-rwxr-xr-xjs/mediators/keyboard-mediator.js10
-rwxr-xr-xjs/ninja.reel/ninja.html2
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js4
20 files changed, 214 insertions, 181 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});
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 77cc711d..28818774 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -358,22 +358,40 @@ exports.HTMLDocument = Montage.create(TextDocument, {
358 358
359 359
360 360
361 361
362
363
364 /*
365 DOM Mutation Events:
366
367 DOMActivate, DOMFocusIn, DOMFocusOut, DOMAttrModified,
368 DOMCharacterDataModified, DOMNodeInserted, DOMNodeInsertedIntoDocument,
369 DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified, DOMContentLoaded
370
371 */
372
373
374
375 /*
376//TODO: Remove and clean up event listener (DOMSubtreeModified)
377 _hackCount: {
378 value: 0
379 },
380*/
381
382
362 //////////////////////////////////////////////////////////////////// 383 ////////////////////////////////////////////////////////////////////
363 // 384 //
364 handleEvent: { 385 handleEvent: {
365 value: function(event){ 386 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);
371 //TODO: Clean up, using for prototyping save 387 //TODO: Clean up, using for prototyping save
372 this._templateDocument = {}; 388 this._templateDocument = {};
373 this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; 389 this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");
374 this._templateDocument.body = this.iframe.contentWindow.document.getElementById("UserContent");; 390 this._templateDocument.body = this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent");
391 //TODO: Remove, also for prototyping
392 this.application.ninja.documentController._hackRootFlag = true;
375 // 393 //
376 this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent"); 394 //this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent");
377 this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG"); 395 this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG");
378 this.stageBG.onclick = null; 396 this.stageBG.onclick = null;
379 this._document = this.iframe.contentWindow.document; 397 this._document = this.iframe.contentWindow.document;
@@ -381,82 +399,93 @@ exports.HTMLDocument = Montage.create(TextDocument, {
381 // 399 //
382 if(!this.documentRoot.Ninja) this.documentRoot.Ninja = {}; 400 if(!this.documentRoot.Ninja) this.documentRoot.Ninja = {};
383 // 401 //
402 this._templateDocument.head.innerHTML = this._userDocument.content.head;
403 this._templateDocument.body.innerHTML = this._userDocument.content.body;
404
405
406
407
408 /* this.iframe.contentWindow.document.addEventListener('DOMSubtreeModified', function (e) { */ //TODO: Remove events upon loading once
384 409
385 this.documentRoot.innerHTML = this._userDocument.content.body; 410 //TODO: When written, the best way to initialize the document is to listen for the DOM tree being modified
386 this.iframe.contentWindow.document.getElementById("userHead").innerHTML = this._userDocument.content.head; 411 setTimeout(function () {
387 412
388
389 //TODO: Look at code below and clean up
390 413
391 414
415 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
416 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
417 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
418 if(this._document.styleSheets.length > 1) {
419 this._styles = this._document.styleSheets[this._document.styleSheets.length - 1];
420 this._stylesheets = this._document.styleSheets; // Entire stlyesheets array
421
422 //TODO Finish this implementation once we start caching Core Elements
423 // Assign a model to the UserContent and add the ViewPort reference to it.
424 NJUtils.makeElementModel(this.documentRoot, "Stage", "stage");
425 //this.documentRoot.elementModel.viewPort = this.iframe.contentWindow.document.getElementById("Viewport");
426 NJUtils.makeElementModel(this.stageBG, "Stage", "stage");
427 NJUtils.makeElementModel(this.iframe.contentWindow.document.getElementById("Viewport"), "Stage", "stage");
428
429 for(i = 0; i < this._stylesheets.length; i++) {
430 if(this._stylesheets[i].ownerNode.id === this._stageStyleSheetId) {
431 this.documentRoot.elementModel.defaultRule = this._stylesheets[i];
432 break;
433 }