diff options
author | Valerio Virgillito | 2012-02-17 15:27:26 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-17 15:27:26 -0800 |
commit | de4e42ce73ac12f63d95db2fdce87e57db5593fb (patch) | |
tree | 4329cfb5653f8be117de13567f46ed5d32c6c2d2 /js | |
parent | 7789a48fab2b1541ef7ac1b94e14b3f8dccbb4ff (diff) | |
parent | 33b27df9b1e64eda709612902c690be35e040079 (diff) | |
download | ninja-de4e42ce73ac12f63d95db2fdce87e57db5593fb.tar.gz |
Merge pull request #54 from joseeight/TabPreview
Tab preview
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/document-controller.js | 3 | ||||
-rwxr-xr-x | js/data/menu-data.js | 9 | ||||
-rwxr-xr-x | js/document/html-document.js | 45 | ||||
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 6 | ||||
-rwxr-xr-x | js/models/app-model.js | 12 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 7 |
6 files changed, 80 insertions, 2 deletions
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, | |||
61 | 61 | ||
62 | this.eventManager.addEventListener("recordStyleChanged", this, false); | 62 | this.eventManager.addEventListener("recordStyleChanged", this, false); |
63 | 63 | ||
64 | |||
65 | |||
66 | } | 64 | } |
67 | }, | 65 | }, |
68 | 66 | ||
67 | |||
69 | 68 | ||
70 | handleWebRequest: { | 69 | handleWebRequest: { |
71 | value: function (request) { | 70 | 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 | |||
@@ -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 ae2b4600..77cc711d 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -363,6 +363,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
363 | // | 363 | // |
364 | handleEvent: { | 364 | handleEvent: { |
365 | value: function(event){ | 365 | value: function(event){ |
366 | //TODO: Remove | ||
367 | window.hackPreview = this.livePreview.bind(this); | ||
368 | |||
366 | this.application.ninja.documentController._hackRootFlag = true; | 369 | this.application.ninja.documentController._hackRootFlag = true; |
367 | //console.log(this._userDocument.root, this); | 370 | //console.log(this._userDocument.root, this); |
368 | //TODO: Clean up, using for prototyping save | 371 | //TODO: Clean up, using for prototyping save |
@@ -471,6 +474,48 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
471 | } | 474 | } |
472 | }, | 475 | }, |
473 | 476 | ||
477 | |||
478 | |||
479 | |||
480 | |||
481 | |||
482 | |||
483 | |||
484 | |||
485 | |||
486 | |||
487 | |||
488 | |||
489 | |||
490 | |||
491 | |||
492 | |||
493 | |||
494 | |||
495 | |||
496 | |||
497 | |||
498 | |||
499 | //////////////////////////////////////////////////////////////////// | ||
500 | // | ||
501 | livePreview: { | ||
502 | enumerable: false, | ||
503 | value: function () { | ||
504 | //this.application.ninja.documentController | ||
505 | //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); | ||
506 | chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); | ||
507 | } | ||
508 | }, | ||
509 | //////////////////////////////////////////////////////////////////// | ||
510 | |||
511 | |||
512 | |||
513 | |||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
474 | //////////////////////////////////////////////////////////////////// | 519 | //////////////////////////////////////////////////////////////////// |
475 | // | 520 | // |
476 | save: { | 521 | 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, { | |||
201 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt); | 201 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt); |
202 | //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); | 202 | //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); |
203 | } | 203 | } |
204 | |||
205 | // Check if cmd+a/ctrl+a for Select All | ||
206 | if((evt.keyCode == Keyboard.ENTER) && (evt.ctrlKey || evt.metaKey)) { | ||
207 | this.application.ninja.executeChromePreview(); | ||
208 | return; | ||
209 | } | ||
204 | 210 | ||
205 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyPress(evt); | 211 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyPress(evt); |
206 | 212 | ||
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, { | |||
21 | this._livePreview = value; | 21 | this._livePreview = value; |
22 | } | 22 | } |
23 | }, | 23 | }, |
24 | _chromePreview: { | ||
25 | value: false | ||
26 | }, | ||
27 | |||
28 | chromePreview: { | ||
29 | get: function() { | ||
30 | return this._chromePreview; | ||
31 | }, | ||
32 | set: function(value) { | ||
33 | this._chromePreview = value; | ||
34 | } | ||
35 | }, | ||
24 | 36 | ||
25 | _layoutView: { | 37 | _layoutView: { |
26 | value: "layoutAll" | 38 | 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, { | |||
60 | this.eventManager.addEventListener( "onOpenDocument", this, false); | 60 | this.eventManager.addEventListener( "onOpenDocument", this, false); |
61 | 61 | ||
62 | this.addEventListener("change@appModel.livePreview", this.executeLivePreview, false); | 62 | this.addEventListener("change@appModel.livePreview", this.executeLivePreview, false); |
63 | this.addEventListener("change@appModel.chromePreview", this.executeChromePreview, false); | ||
63 | this.addEventListener("change@appModel.debug", this.toggleDebug, false); | 64 | this.addEventListener("change@appModel.debug", this.toggleDebug, false); |
64 | 65 | ||
65 | NJevent("appLoading"); | 66 | NJevent("appLoading"); |
66 | } | 67 | } |
67 | }, | 68 | }, |
69 | |||
70 | executeChromePreview: { | ||
71 | value: function () { | ||
72 | this.application.ninja.documentController.activeDocument.livePreview(); | ||
73 | } | ||
74 | }, | ||
68 | 75 | ||
69 | handleResize: { | 76 | handleResize: { |
70 | value: function() { | 77 | value: function() { |