diff options
author | Jon Reid | 2012-06-15 10:10:41 -0700 |
---|---|---|
committer | Jon Reid | 2012-06-15 10:10:41 -0700 |
commit | 526ac54f73d53e1e2a3d6a4dbf4f9992c143baf7 (patch) | |
tree | 65939e59615aaa10a7db77211e71616ad531bd0e /js/document | |
parent | b5b760ee82e5cc4da176914983a6002cbf86c11a (diff) | |
parent | 5ee0c89fa0c7acc280ff3b884767e8513fd0b315 (diff) | |
download | ninja-526ac54f73d53e1e2a3d6a4dbf4f9992c143baf7.tar.gz |
Merge remote-tracking branch 'ninja-internal/master' into test-merge
Conflicts:
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/document-html.js | 12 | ||||
-rwxr-xr-x | js/document/mediators/template.js | 4 | ||||
-rwxr-xr-x | js/document/models/base.js | 69 | ||||
-rwxr-xr-x | js/document/models/html.js | 5 | ||||
-rw-r--r-- | js/document/templates/app/main.js | 6 | ||||
-rwxr-xr-x | js/document/templates/banner/index.html | 23 | ||||
-rwxr-xr-x | js/document/templates/html/index.html | 23 |
7 files changed, 111 insertions, 31 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js index 04565753..aded9241 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -107,6 +107,12 @@ exports.HtmlDocument = Montage.create(Component, { | |||
107 | }, | 107 | }, |
108 | handleViewReady: { | 108 | handleViewReady: { |
109 | value: function() { | 109 | value: function() { |
110 | // TODO: Find a better way to initialize this property | ||
111 | // Assign the domContainer to be the document root on open | ||
112 | if(typeof this.model.domContainer !== "undefined") { | ||
113 | this.model.domContainer = this.model.documentRoot; | ||
114 | } | ||
115 | |||
110 | //Making callback after view is loaded | 116 | //Making callback after view is loaded |
111 | this.loaded.callback.call(this.loaded.context, this); | 117 | this.loaded.callback.call(this.loaded.context, this); |
112 | } | 118 | } |
@@ -115,10 +121,8 @@ exports.HtmlDocument = Montage.create(Component, { | |||
115 | // | 121 | // |
116 | closeDocument: { | 122 | closeDocument: { |
117 | value: function (context, callback) { | 123 | value: function (context, callback) { |
118 | //Closing document and getting outcome | 124 | //Closing document (sending null to close all views) |
119 | var closed = this.model.close(null); | 125 | this.model.close(null, function () {if (callback) callback.call(context, this);}.bind(this)); |
120 | //Making callback if specified | ||
121 | if (callback) callback.call(context, this); | ||
122 | } | 126 | } |
123 | }, | 127 | }, |
124 | //////////////////////////////////////////////////////////////////// | 128 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 4c72314a..50fad1c3 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js | |||
@@ -613,8 +613,8 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
613 | } else { | 613 | } else { |
614 | cleanHTML = template.file.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this)); | 614 | cleanHTML = template.file.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this)); |
615 | } | 615 | } |
616 | //TODO: Remove, this is a temp hack | 616 | //TODO: Remove, this is a temp hack to maintain a doc type on HTML files |
617 | cleanHTML = cleanHTML; | 617 | cleanHTML = '<!DOCTYPE html>'+cleanHTML; |
618 | // | 618 | // |
619 | function parseNinjaRootUrl(url) { | 619 | function parseNinjaRootUrl(url) { |
620 | if (url.indexOf(this.application.ninja.coreIoApi.rootUrl) !== -1) { | 620 | if (url.indexOf(this.application.ninja.coreIoApi.rootUrl) !== -1) { |
diff --git a/js/document/models/base.js b/js/document/models/base.js index 5fa06259..8ff52132 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -6,8 +6,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | //////////////////////////////////////////////////////////////////////// | 7 | //////////////////////////////////////////////////////////////////////// |
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var Montage = require("montage/core/core").Montage, |
10 | Component = require("montage/ui/component").Component; | 10 | Component = require("montage/ui/component").Component, |
11 | NinjaPrompt = require("js/components/prompt.reel").NinjaPrompt; | ||
11 | //////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////// |
12 | // | 13 | // |
13 | exports.BaseDocumentModel = Montage.create(Component, { | 14 | exports.BaseDocumentModel = Montage.create(Component, { |
@@ -65,6 +66,9 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
65 | _selection: { | 66 | _selection: { |
66 | value: [] | 67 | value: [] |
67 | }, | 68 | }, |
69 | domContainer: { | ||
70 | value: null | ||
71 | }, | ||
68 | //////////////////////////////////////////////////////////////////// | 72 | //////////////////////////////////////////////////////////////////// |
69 | // | 73 | // |
70 | selection: { | 74 | selection: { |
@@ -264,30 +268,59 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
264 | if (this.callback) this.callback(result); | 268 | if (this.callback) this.callback(result); |
265 | } | 269 | } |
266 | }, | 270 | }, |
271 | //////////////////////////////////////////////////////////////////// | ||
272 | // | ||
273 | handleSavePrompt: { | ||
274 | value: function (continueToClose, callback) { | ||
275 | //TODO: Perhaps add logic to save the file is the user wants | ||
276 | if (continueToClose) { | ||
277 | if (callback) callback(); | ||
278 | } else { | ||
279 | //User canceled | ||
280 | //this.saveAll(null, callback); | ||
281 | } | ||
282 | } | ||
283 | }, | ||
267 | //////////////////////////////////////////////////////////////////// | 284 | //////////////////////////////////////////////////////////////////// |
268 | //TODO: Implement better logic to include different views on single document | 285 | //TODO: Implement better logic to include different views on single document |
269 | close: { | 286 | close: { |
270 | value: function (view, callback) { | 287 | value: function (view, callback) { |
271 | //Outcome of close (pending on save logic) | 288 | //Checking if files needs to be saved to avoid losing data |
272 | var success; | ||
273 | // | ||
274 | if (this.needsSave) { | 289 | if (this.needsSave) { |
275 | //TODO: Prompt user to save or lose data | 290 | //Creating prompt to ask user to save the file |
291 | var prompt = NinjaPrompt.create(); | ||
292 | prompt.initialize('confirm', {message: 'Do you want to save the changes you made in the document '+this.file.name+'?\n\nYour changes will be lost if you do not save them.'}, function (result){this.handleSavePrompt(result, callback);}.bind(this)); | ||
293 | //Showing the prompt, it will make callback with user input | ||
294 | prompt.show(); | ||
276 | } else { | 295 | } else { |
277 | //Close file | 296 | //TODO: Add support for other views |
278 | success = true; | 297 | if (!view || view === 'design') { |
279 | } | 298 | this.closeView('design'); |
280 | //Checking for view mode to close | 299 | } |
281 | if (this.views.design && (!view || view === 'design')) { | 300 | //Making callback |
282 | //TODO: Create a destroy method, this is messy | 301 | if (callback) callback(); |
283 | this.views.design.pauseAndStopVideos(); | ||
284 | this.parentContainer.removeChild(this.views.design.iframe); | ||
285 | this.views.design = null; | ||
286 | } | 302 | } |
287 | //Returning result of operation | 303 | |
288 | return success; | ||
289 | } | 304 | } |
290 | } | 305 | }, |
306 | //////////////////////////////////////////////////////////////////// | ||
307 | // | ||
308 | closeView: { | ||
309 | value: function (view) { | ||
310 | //Checking for view mode to close | ||
311 | switch (view.toLowerCase()) { | ||
312 | case 'design': | ||
313 | //TODO: Make into clean method in the design view | ||
314 | this.views.design.pauseAndStopVideos(); | ||
315 | this.parentContainer.removeChild(this.views.design.iframe); | ||
316 | this.views.design = null; | ||
317 | break; | ||
318 | default: | ||
319 | //TODO: Error? | ||
320 | break; | ||
321 | } | ||
322 | } | ||
323 | } | ||
291 | //////////////////////////////////////////////////////////////////// | 324 | //////////////////////////////////////////////////////////////////// |
292 | //////////////////////////////////////////////////////////////////// | 325 | //////////////////////////////////////////////////////////////////// |
293 | }); | 326 | }); |
diff --git a/js/document/models/html.js b/js/document/models/html.js index 7064c6e3..4a232ee1 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js | |||
@@ -27,11 +27,6 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
27 | this.libs = {montage: false, canvas: false, montageId: null, canvasId: null}; | 27 | this.libs = {montage: false, canvas: false, montageId: null, canvasId: null}; |
28 | } | 28 | } |
29 | }, | 29 | }, |
30 | //////////////////////////////////////////////////////////////////// | ||
31 | // | ||
32 | selectionContainer: { | ||
33 | value: [] | ||
34 | }, | ||
35 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
36 | // | 31 | // |
37 | draw3DGrid: { | 32 | draw3DGrid: { |
diff --git a/js/document/templates/app/main.js b/js/document/templates/app/main.js index 0cdf718c..8dc05ba5 100644 --- a/js/document/templates/app/main.js +++ b/js/document/templates/app/main.js | |||
@@ -61,13 +61,15 @@ exports.Main = Montage.create(Component, { | |||
61 | var componentRequire = component[data.name]; | 61 | var componentRequire = component[data.name]; |
62 | var componentInstance = componentRequire.create(); | 62 | var componentInstance = componentRequire.create(); |
63 | 63 | ||
64 | componentInstance.element = element; | ||
65 | 64 | ||
65 | componentInstance.addEventListener("firstDraw", self, false); | ||
66 | |||
67 | componentInstance.element = element; | ||
66 | componentInstance.needsDraw = true; | 68 | componentInstance.needsDraw = true; |
67 | componentInstance.ownerComponent = self; | 69 | componentInstance.ownerComponent = self; |
68 | 70 | ||
69 | self.componentToInsert = componentInstance; | 71 | self.componentToInsert = componentInstance; |
70 | componentInstance.addEventListener("firstDraw", self, false); | 72 | |
71 | 73 | ||
72 | callback(componentInstance, element); | 74 | callback(componentInstance, element); |
73 | }) | 75 | }) |
diff --git a/js/document/templates/banner/index.html b/js/document/templates/banner/index.html index 08a998e5..626dc0bc 100755 --- a/js/document/templates/banner/index.html +++ b/js/document/templates/banner/index.html | |||
@@ -71,6 +71,29 @@ | |||
71 | -webkit-transform-style: preserve-3d; | 71 | -webkit-transform-style: preserve-3d; |
72 | -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | 72 | -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); |
73 | } | 73 | } |
74 | |||
75 | ::-webkit-scrollbar { width: 11px; height: 11px; } | ||
76 | ::-webkit-scrollbar-button:start:decrement, ::-webkit-scrollbar-button:end:increment { display: none; } | ||
77 | ::-webkit-scrollbar-button:vertical:start:increment, body::-webkit-scrollbar-button:vertical:end:decrement { display: none; } | ||
78 | ::-webkit-scrollbar-button:horizontal:start:increment, body::-webkit-scrollbar-button:horizontal:end:decrement { display: none; } | ||
79 | ::-webkit-scrollbar-track:vertical { background-color: black; } | ||
80 | ::-webkit-scrollbar-track:horizontal { background-color: black; } | ||
81 | ::-webkit-scrollbar-track-piece:vertical:start { background-color: transparent; } | ||