From 6bc07657c8ef58e6efddd383748ecf84d1c789ad Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Thu, 16 Feb 2012 15:58:26 -0800
Subject: Adding new RDGE library data
---
js/io/system/ninjalibrary.js | 2 ++
js/io/system/ninjalibrary.json | 3 +--
js/mediators/io-mediator.js | 21 ++++++++++-----------
3 files changed, 13 insertions(+), 13 deletions(-)
(limited to 'js')
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
index 8c58883a..960bdef9 100644
--- a/js/io/system/ninjalibrary.js
+++ b/js/io/system/ninjalibrary.js
@@ -145,6 +145,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
synchronize: {
enumerable: true,
value: function(chromeLibs, chrome) {
+ //TODO: Remove
+ window.wipeLibrary = this.deleteLibraries.bind(this);
//
this.chromeApi = chrome;
//
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index 05e0a427..a61c30d1 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,7 +1,6 @@
{
"libraries": [
{"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"},
- {"name": "Assets", "path": "/assets/descriptor.json", "version": "0.5.0.0"},
- {"name": "RDGE", "path": "/js/helper-classes/RDGE/rdge-compiled.js", "version": "0.5.0.0", "file": "rdge-compiled.js"}
+ {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.0.1"}
]
}
\ No newline at end of file
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index e9958ec3..56869839 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -143,6 +143,16 @@ exports.IoMediator = Montage.create(Component, {
//
switch (file.mode) {
case 'html':
+ //Copy webGL library if needed
+ if (file.webgl.length > 0) {
+ for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) {
+ //if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Assets' || this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') {
+ if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') {
+ this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(file.document.root, (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase());
+ }
+ }
+ }
+ //
contents = this.parseNinjaTemplateToHtml(file);
break;
default:
@@ -192,17 +202,6 @@ exports.IoMediator = Montage.create(Component, {
//
template.document.content.document.body.innerHTML = template.body;
template.document.content.document.head.innerHTML = template.head;
- //
- if (template.webgl.length > 0) {
- for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) {
- if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Assets' || this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') {
- this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase());
- }
- }
-
- //this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(path, libname);
- //console.log(this.application.ninja.coreIoApi.ninjaLibrary.libs);
- }
//TODO: Remove temp fix for styles
if (template.style) {
template.document.content.document.head.getElementsByTagName('style')[0].innerHTML = this.getCssFromRules(template.style.cssRules);
--
cgit v1.2.3
From cfc2a432323d4620b1f4ca2061bbe57f46e7eaf7 Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Thu, 16 Feb 2012 23:10:15 -0800
Subject: Moving Ninja iFrame templates
---
js/document/html-document.js | 11 +++-
.../templates/montage-html/default_html.css | 75 ++++++++++++++++++++++
js/document/templates/montage-html/index.html | 50 +++++++++++++++
.../templates/montage-html/main.reel/main.js | 55 ++++++++++++++++
js/document/templates/montage-html/package.json | 8 +++
js/document/templates/montage-html/styles.css | 5 ++
6 files changed, 202 insertions(+), 2 deletions(-)
create mode 100755 js/document/templates/montage-html/default_html.css
create mode 100755 js/document/templates/montage-html/index.html
create mode 100644 js/document/templates/montage-html/main.reel/main.js
create mode 100755 js/document/templates/montage-html/package.json
create mode 100755 js/document/templates/montage-html/styles.css
(limited to 'js')
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 0c8695fb..a5483f40 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -14,7 +14,7 @@ var Montage = require("montage/core/core").Montage,
exports.HTMLDocument = Montage.create(TextDocument, {
_selectionExclude: { value: null, enumerable: false },
- _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false},
+ _htmlTemplateUrl: { value: "js/document/templates/montage-html/index.html", enumerable: false},
_iframe: { value: null, enumerable: false },
_server: { value: null, enumerable: false },
_templateDocument: { value: null, enumerable: false },
@@ -235,6 +235,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
//
initialize: {
value: function(file, uuid, iframe, callback) {
+ //console.log('allow');
//
this._userDocument = file;
//
@@ -359,6 +360,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
//
handleEvent: {
value: function(event){
+ //console.log('end');
+ //console.log('file content start');
//TODO: Clean up, using for prototyping save
this._templateDocument = {};
this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");;
@@ -389,6 +392,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
this._stylesheets = this._document.styleSheets; // Entire stlyesheets array
this.callback(this);
+
+ //console.log('file content end');
}
}.bind(this), 50);
@@ -440,7 +445,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
}
// Remving this callback and using the callback from the css load
- // this.callback(this);
+ //this.callback(this);
+
+
}
},
diff --git a/js/document/templates/montage-html/default_html.css b/js/document/templates/montage-html/default_html.css
new file mode 100755
index 00000000..68300edf
--- /dev/null
+++ b/js/document/templates/montage-html/default_html.css
@@ -0,0 +1,75 @@
+/*
+This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
+
+* {
+ -webkit-transition-duration: 0s !important;
+ -webkit-animation-duration: 0s !important;
+ -webkit-animation-name: none !important;
+}
+
+html{
+ overflow:hidden;
+}
+
+body
+{
+ background: #808080;
+}
+
+#Viewport
+{
+ margin: 0px;
+ padding: 0px;
+ top: 200px;
+ left: 700px;
+ /*position: absolute;*/
+ /*height: 600px;*/
+ /*width: 800px;*/
+ opacity: 0.99;
+ z-index:2;
+}
+
+#stageBG
+{
+ background: #ffffff;
+ top: 200px;
+ left: 700px;
+ z-index:1;
+}
+
+.stageDimension
+{
+ position: absolute;
+ height: 600px;
+ width: 800px;
+}
+
+.stageView
+{
+ border: 1px solid black;
+ -webkit-transform-style: preserve-3d;
+ -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+}
+
+.stageContentShadow {
+ -webkit-box-shadow: 3px 5px 4px rgba(0,0,0,.5);
+ -moz-box-shadow: 3px 5px 4px rgba(0,0,0,.5);
+ box-shadow: 3px 5px 4px rgba(0,0,0,.5);
+}
+
+#userHead
+{
+ display: none;
+}
+
+.global3DSettings {
+ -webkit-transform-style: preserve-3d;
+ -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+}
+
+.elem-red-outline {
+ outline: red solid thin;
+}
\ No newline at end of file
diff --git a/js/document/templates/montage-html/index.html b/js/document/templates/montage-html/index.html
new file mode 100755
index 00000000..8b3d73bb
--- /dev/null
+++ b/js/document/templates/montage-html/index.html
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+ Ninja Prototype
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js
new file mode 100644
index 00000000..86871fd3
--- /dev/null
+++ b/js/document/templates/montage-html/main.reel/main.js
@@ -0,0 +1,55 @@
+/*
+ This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
+var Montage = require("montage/core/core").Montage,
+ Component = require("montage/ui/component").Component;
+
+//var Button = ("montage/ui/button.reel").Button;
+
+exports.Main = Montage.create(Component, {
+
+ hasTemplate: {
+ value: false
+ },
+
+ /**
+ * Adding window hooks to callback into this object from Ninja.
+ */
+ templateDidLoad: {
+ value: function(){
+ window.addComponent = this.addComponentToUserDocument;
+// window.addBinding = this.addBindingToUserDocument;
+
+ // Dispatch event when this template has loaded.
+ var newEvent = document.createEvent( "CustomEvent" );
+ newEvent.initCustomEvent( "userTemplateDidLoad", false, true );
+
+ document.body.dispatchEvent( newEvent );
+
+ }
+ },
+
+ addComponentToUserDocument:{
+ value:function(element, data, callback){
+
+ var component;
+
+ component = require.async(data.path)
+ .then(function(component) {
+ var componentRequire = component[data.name];
+ var componentInstance = componentRequire.create();
+
+ componentInstance.element = element;
+ componentInstance.deserializedFromTemplate();
+ componentInstance.needsDraw = true;
+
+ callback(componentInstance, element);
+ })
+ .end();
+
+ }
+ }
+
+});
\ No newline at end of file
diff --git a/js/document/templates/montage-html/package.json b/js/document/templates/montage-html/package.json
new file mode 100755
index 00000000..c8bc02fb
--- /dev/null
+++ b/js/document/templates/montage-html/package.json
@@ -0,0 +1,8 @@
+{
+ "directories": {
+ "lib": ""
+ },
+ "mappings": {
+ "montage": "../../../../node_modules/montage/"
+ }
+}
\ No newline at end of file
diff --git a/js/document/templates/montage-html/styles.css b/js/document/templates/montage-html/styles.css
new file mode 100755
index 00000000..0441c1cf
--- /dev/null
+++ b/js/document/templates/montage-html/styles.css
@@ -0,0 +1,5 @@
+/*
+ This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
\ No newline at end of file
--
cgit v1.2.3
From b5d41c64de2875e2f8b31ec11268cb9f2d30780a Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Thu, 16 Feb 2012 23:38:48 -0800
Subject: Fixing the getStageWorldToGlobalMatrix bug
removing the snapManager reference in viewUtils
Signed-off-by: Valerio Virgillito
---
js/helper-classes/3D/view-utils.js | 42 ++++++++++++++------------------------
1 file changed, 15 insertions(+), 27 deletions(-)
(limited to 'js')
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index c8e20def..a2fac34f 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -4,16 +4,16 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/
-var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
- snapManagerModule = require("js/helper-classes/3D/snap-manager"),
+var Montage = require("montage/core/core").Montage,
+ Component = require("montage/ui/component").Component,
+ vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
Rectangle = require("js/helper-classes/3D/rectangle").Rectangle,
ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
///////////////////////////////////////////////////////////////////////
// Class ViewUtils
// Viewing Utility functions
///////////////////////////////////////////////////////////////////////
-var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
-{
+exports.ViewUtils = Montage.create(Component, {
///////////////////////////////////////////////////////////////////////
// Instance variables
///////////////////////////////////////////////////////////////////////
@@ -133,7 +133,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
var xVec = [mat[0], mat[1], mat[2], mat[3]];
var yVec = [mat[4], mat[5], mat[6], mat[7]];
- var stage = snapManagerModule.SnapManager.getStage();
+ var stage = this.application.ninja.currentDocument.documentRoot;
var stageMat = this.getMatrixFromElement(stage);
var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]];
@@ -412,7 +412,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
// get the four corners of the element in global space
var bounds = this.getElementViewBounds3D( elt );
var bounds3D = new Array();
- var stage = snapManagerModule.SnapManager.getStage();
+ var stage = this.application.ninja.currentDocument.documentRoot;
for (var i=0; i<3; i++)
{
var gPt = this.localToGlobal( bounds[i], elt );
@@ -789,7 +789,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
getStageWorldToGlobalMatrix: {
value: function() {
- var stage = snapManagerModule.SnapManager.getStage();
+ var stage = this.application.ninja.currentDocument.documentRoot;
this.pushViewportObj( stage );
// get the matrix to the parent
@@ -1190,12 +1190,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
// drawLayoutModule.drawLayout.redrawDocument() OR
// window.stageManager.drawSelectionRec(true) this.getStage().draw();
// drawLayoutModule.drawLayout.redrawDocument();
-//
-// SNAP MANAGER
-// snapManager: snapManagerModule.SnapManager
-// snapManagerModule: snapManagerModule = r_equire("js/helper-classes/3D/snap-manager")
-// stage stage = snapManagerModule.SnapManager.getStage();
-//
+
// SELECTION MANAGER
// selected elements: this.application.ninja.selectedElements
// selectionManager this.application.ninja.selectionController
@@ -1213,10 +1208,10 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
clearStageTranslation: {
value: function() {
- if (snapManagerModule.SnapManager.application.ninja.currentDocument)
+ if (this.application.ninja.currentDocument)
{
// get the user content object
- var userContent = snapManagerModule.SnapManager.application.ninja.currentDocument.documentRoot;
+ var userContent = this.application.ninja.currentDocument.documentRoot;
if (!userContent) return;
this.setViewportObj( userContent );
@@ -1235,9 +1230,10 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
value:function( globalPt, zoomFactor ) {
var localPt;
var tmp1, tmp2, tmp3;
- if (snapManagerModule.SnapManager.application.ninja.currentDocument)
+
+ if (this.application.ninja.currentDocument)
{
- var userContent = snapManagerModule.SnapManager.application.ninja.currentDocument.documentRoot;
+ var userContent = this.application.ninja.currentDocument.documentRoot;
if (!userContent) return;
this.setViewportObj( userContent );
var userContentMat = this.getMatrixFromElement(userContent);
@@ -1285,7 +1281,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
tmp2 = this.localToGlobal( localPt, userContent ); // DEBUG - remove this line
// apply to the stage background
-// var stageBG = snapManagerModule.SnapManager.application.ninja.currentDocument.stageBG;
+// var stageBG = this.application.ninja.currentDocument.stageBG;
// var stageBGMat = this.getMatrixFromElement(stageBG);
// var newStageBGMat = glmat4.multiply( mat, stageBGMat, []);
// this.setMatrixForElement(stageBG, newStageBGMat );
@@ -1298,15 +1294,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
{
value: function()
{
- return this.getStage.canvas;
- }
- },
-
- getSnapManager:
- {
- value: function()
- {
- return snapManagerModule.SnapManager;
+ return this.application.ninjs.stage.canvas;
}
},
--
cgit v1.2.3
From 66af1dd3e5aa80b257ba711600d112752ecaf655 Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Fri, 17 Feb 2012 00:19:48 -0800
Subject: Adding Chrome webRequest intercept
Need to add logic to resolve file's actual URL dynamically.
---
js/controllers/document-controller.js | 25 +++++++++++++++++++++++++
js/document/html-document.js | 6 ++++--
2 files changed, 29 insertions(+), 2 deletions(-)
(limited to 'js')
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index b1a22c1b..9785d824 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -56,12 +56,37 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
this.eventManager.addEventListener("executeSave", this, false);
this.eventManager.addEventListener("recordStyleChanged", this, false);
+
+
+
}
},
+
+
+ handleWebRequest: {
+ value: function (request) {
+ if (request.url.indexOf('js/document/templates/montage-html') !== -1) {
+
+ console.log(request);
+
+ //TODO: Figure out why active document is not available here
+
+ /*
+if (request.url.indexOf('calculator.css') !== -1) {
+ return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+'/calculator/components/calculator.reel/calculator.css'};
+ }
+*/
+ }
+ }
+ },
+
handleAppLoaded: {
value: function() {
//
+
+ chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: [""]}, ["blocking"]);
+
}
},
diff --git a/js/document/html-document.js b/js/document/html-document.js
index a5483f40..16595d14 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -355,13 +355,15 @@ exports.HTMLDocument = Montage.create(TextDocument, {
},
+
+
+
////////////////////////////////////////////////////////////////////
//
handleEvent: {
value: function(event){
- //console.log('end');
- //console.log('file content start');
+
//TODO: Clean up, using for prototyping save
this._templateDocument = {};
this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");;
--
cgit v1.2.3
From a42c536c2b3209afc058eabd31167bd0aa6f71c8 Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Fri, 17 Feb 2012 13:40:38 -0800
Subject: Adding webRequest redirects for iFrame templates
---
js/controllers/document-controller.js | 20 ++++++++++++++------
js/document/html-document.js | 5 +++--
js/document/text-document.js | 5 +++--
js/io/ui/cloudpopup.reel/cloudpopup.html | 2 +-
4 files changed, 21 insertions(+), 11 deletions(-)
(limited to 'js')
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 9785d824..5e2a6461 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -14,7 +14,7 @@ var Montage = require("montage/core/core").Montage,
DocumentController;
////////////////////////////////////////////////////////////////////////
//
-DocumentController = exports.DocumentController = Montage.create(Component, {
+var DocumentController = exports.DocumentController = Montage.create(Component, {
hasTemplate: {
value: false
},
@@ -22,6 +22,10 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
_documents: {
value: []
},
+
+ _hackRootFlag: {
+ value: false
+ },
_activeDocument: { value: null },
_iframeCounter: { value: 1, enumerable: false },
@@ -71,11 +75,13 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
//TODO: Figure out why active document is not available here
- /*
-if (request.url.indexOf('calculator.css') !== -1) {
- return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+'/calculator/components/calculator.reel/calculator.css'};
+ if (this._hackRootFlag) {
+
+ //console.log(request.url.split('/')[request.url.split('/').length-1]);
+ //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]);
+
+ 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]};
}
-*/
}
}
},
@@ -205,6 +211,9 @@ if (request.url.indexOf('calculator.css') !== -1) {
//
openDocument: {
value: function(doc) {
+
+ //
+ this.documentHackReference = doc;
//
switch (doc.extension) {
case 'html': case 'html':
@@ -302,7 +311,6 @@ if (request.url.indexOf('calculator.css') !== -1) {
_onOpenDocument: {
value: function(doc){
//var data = DocumentManager.activeDocument;
-
this._hideCurrentDocument();
this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 16595d14..ae2b4600 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -235,7 +235,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
//
initialize: {
value: function(file, uuid, iframe, callback) {
- //console.log('allow');
+ this.application.ninja.documentController._hackRootFlag = false;
//
this._userDocument = file;
//
@@ -363,7 +363,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
//
handleEvent: {
value: function(event){
-
+ this.application.ninja.documentController._hackRootFlag = true;
+ //console.log(this._userDocument.root, this);
//TODO: Clean up, using for prototyping save
this._templateDocument = {};
this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");;
diff --git a/js/document/text-document.js b/js/document/text-document.js
index 6f8efaad..3e20e1f6 100755
--- a/js/document/text-document.js
+++ b/js/document/text-document.js
@@ -6,9 +6,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
//BaseDocument Object for all files types and base class for HTML documents.
-var Montage = require("montage/core/core").Montage;
+var Montage = require("montage/core/core").Montage,
+ Component = require("montage/ui/component").Component;
-var TextDocument = exports.TextDocument = Montage.create(Montage, {
+var TextDocument = exports.TextDocument = Montage.create(Component, {
//TODO: Clean up, test
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.html b/js/io/ui/cloudpopup.reel/cloudpopup.html
index 2c1c169a..e58041ec 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.html
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.html
@@ -36,7 +36,7 @@
Connection to the Cloud Server was not detected. Please verify
that the server is running and the URL below is correct.
-
+
--
cgit v1.2.3
From d47c4c0f6053fb8390526f32c2ee08dee0bdec20 Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Fri, 17 Feb 2012 15:22:23 -0800
Subject: Chrome Preview
---
js/controllers/document-controller.js | 3 +--
js/data/menu-data.js | 9 +++++++
js/document/html-document.js | 45 +++++++++++++++++++++++++++++++++++
js/mediators/keyboard-mediator.js | 6 +++++
js/models/app-model.js | 12 ++++++++++
js/ninja.reel/ninja.js | 7 ++++++
6 files changed, 80 insertions(+), 2 deletions(-)
(limited to 'js')
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 5e2a6461..1f339fe7 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -61,11 +61,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
this.eventManager.addEventListener("recordStyleChanged", this, false);
-
-
}
},
+
handleWebRequest: {
value: function (request) {
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
@@ -139,6 +139,15 @@ exports.MenuData = Montage.create( Montage, {
"boundProperty": "livePreview"
}
},
+ {
+ "displayText" : "Chrome Preview",
+ "hasSubMenu" : false,
+ "enabled": true,
+ "checked": {
+ "value": false,
+ "boundProperty": "chromePreview"
+ }
+ },
{
"displayText" : "Layout View",
"hasSubMenu" : false,
diff --git a/js/document/html-document.js b/js/document/html-document.js
index ae2b4600..77cc711d 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -363,6 +363,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
//
handleEvent: {
value: function(event){
+ //TODO: Remove
+ window.hackPreview = this.livePreview.bind(this);
+
this.application.ninja.documentController._hackRootFlag = true;
//console.log(this._userDocument.root, this);
//TODO: Clean up, using for prototyping save
@@ -471,6 +474,48 @@ exports.HTMLDocument = Montage.create(TextDocument, {
}
},
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ livePreview: {
+ enumerable: false,
+ value: function () {
+ //this.application.ninja.documentController
+ //console.log(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]});
+ }
+ },
+ ////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+
+
////////////////////////////////////////////////////////////////////
//
save: {
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index a1fdead3..e8a11ad8 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -201,6 +201,12 @@ exports.KeyboardMediator = Montage.create(Component, {
if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt);
//menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar");
}
+
+ // Check if cmd+a/ctrl+a for Select All
+ if((evt.keyCode == Keyboard.ENTER) && (evt.ctrlKey || evt.metaKey)) {
+ this.application.ninja.executeChromePreview();
+ return;
+ }
if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyPress(evt);
diff --git a/js/models/app-model.js b/js/models/app-model.js
index bfa1871c..1c599a32 100755
--- a/js/models/app-model.js
+++ b/js/models/app-model.js
@@ -21,6 +21,18 @@ exports.AppModel = Montage.create(Component, {
this._livePreview = value;
}
},
+ _chromePreview: {
+ value: false
+ },
+
+ chromePreview: {
+ get: function() {
+ return this._chromePreview;
+ },
+ set: function(value) {
+ this._chromePreview = value;
+ }
+ },
_layoutView: {
value: "layoutAll"
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 43087c39..399d7b4d 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -60,11 +60,18 @@ exports.Ninja = Montage.create(Component, {
this.eventManager.addEventListener( "onOpenDocument", this, false);
this.addEventListener("change@appModel.livePreview", this.executeLivePreview, false);
+ this.addEventListener("change@appModel.chromePreview", this.executeChromePreview, false);
this.addEventListener("change@appModel.debug", this.toggleDebug, false);
NJevent("appLoading");
}
},
+
+ executeChromePreview: {
+ value: function () {
+ this.application.ninja.documentController.activeDocument.livePreview();
+ }
+ },
handleResize: {
value: function() {
--
cgit v1.2.3
From a62b6a5c231ab83e682b5e3831b38824788c0707 Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Mon, 20 Feb 2012 15:08:49 -0800
Subject: Cloud URL localStorage Fix
Fixed logic to remember and display the previously used URL for local cloud if not started on Ninja load.
---
js/io/ui/cloudpopup.reel/cloudpopup.js | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'js')
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
index a2283d46..d2e82662 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.js
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -62,6 +62,10 @@ exports.CloudPopup = Montage.create(Component, {
draw: {
enumerable: false,
value: function() {
+ //
+ if (window.localStorage['ioRootUrl']) {
+ this.components.url.value = window.localStorage['ioRootUrl'];
+ }
//
this.testConnection();
if (this.application.ninja.coreIoApi.cloudAvailable()) {
--
cgit v1.2.3