diff options
-rwxr-xr-x | js/document/models/base.js | 2 | ||||
-rwxr-xr-x | js/document/templates/html/index.html | 5 | ||||
-rw-r--r-- | js/document/templates/html/main.js | 14 | ||||
-rwxr-xr-x | js/document/templates/html/package.json | 1 | ||||
-rwxr-xr-x | js/document/views/design.js | 2 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 12 | ||||
-rwxr-xr-x | node_modules/tools/package.json | 14 | ||||
-rwxr-xr-x | node_modules/tools/template/template-creator.js | 2 |
8 files changed, 36 insertions, 16 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js index f9844b70..033e16f6 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -93,7 +93,7 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
93 | //Currently only supporting current browser (Chrome, obviously) | 93 | //Currently only supporting current browser (Chrome, obviously) |
94 | switch (this.browser) { | 94 | switch (this.browser) { |
95 | case 'chrome': | 95 | case 'chrome': |
96 | if (this.template.type === 'banner' || this.template.type === 'animation') { | 96 | if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) { |
97 | window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url); | 97 | window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url); |
98 | } else { | 98 | } else { |
99 | window.open(this.url); | 99 | window.open(this.url); |
diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html index a1b8b242..24159841 100755 --- a/js/document/templates/html/index.html +++ b/js/document/templates/html/index.html | |||
@@ -12,6 +12,9 @@ | |||
12 | must set the 'data-ninja-template' | 12 | must set the 'data-ninja-template' |
13 | data-ninja-template="true" | 13 | data-ninja-template="true" |
14 | --> | 14 | --> |
15 | |||
16 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> | ||
17 | |||
15 | <html> | 18 | <html> |
16 | 19 | ||
17 | <head> | 20 | <head> |
@@ -58,8 +61,6 @@ | |||
58 | return document.elementFromPoint(x,y); | 61 | return document.elementFromPoint(x,y); |
59 | } | 62 | } |
60 | </script> | 63 | </script> |
61 | |||
62 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> | ||
63 | 64 | ||
64 | <script type="text/javascript" data-package="." src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> | 65 | <script type="text/javascript" data-package="." src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> |
65 | 66 | ||
diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js index d5ac88d5..f45657bb 100644 --- a/js/document/templates/html/main.js +++ b/js/document/templates/html/main.js | |||
@@ -3,8 +3,10 @@ | |||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | var Montage = require("montage/core/core").Montage, | 6 | var Montage = require("montage/core/core").Montage, |
7 | Component = require("montage/ui/component").Component; | 7 | Component = require("montage/ui/component").Component, |
8 | Template = require("montage/ui/template").Template, | ||
9 | TemplateCreator = require("tools/template/template-creator").TemplateCreator; | ||
8 | 10 | ||
9 | exports.Main = Montage.create(Component, { | 11 | exports.Main = Montage.create(Component, { |
10 | 12 | ||
@@ -18,6 +20,7 @@ exports.Main = Montage.create(Component, { | |||
18 | templateDidLoad: { | 20 | templateDidLoad: { |
19 | value: function(){ | 21 | value: function(){ |
20 | var self = this; | 22 | var self = this; |
23 | // | ||
21 | window.addComponent = function(element, data, callback) { | 24 | window.addComponent = function(element, data, callback) { |
22 | var component; | 25 | var component; |
23 | 26 | ||
@@ -36,7 +39,12 @@ exports.Main = Montage.create(Component, { | |||
36 | .end(); | 39 | .end(); |
37 | 40 | ||
38 | }; | 41 | }; |
39 | 42 | // | |
43 | window.mjsTemplateCreator = TemplateCreator.create(); | ||
44 | // | ||
45 | window.mjsTemplate = Template.create(); | ||
46 | |||
47 | |||
40 | // Dispatch event when this template has loaded. | 48 | // Dispatch event when this template has loaded. |
41 | /* | 49 | /* |
42 | var newEvent = document.createEvent( "CustomEvent" ); | 50 | var newEvent = document.createEvent( "CustomEvent" ); |
diff --git a/js/document/templates/html/package.json b/js/document/templates/html/package.json index d1e839dc..4f36090a 100755 --- a/js/document/templates/html/package.json +++ b/js/document/templates/html/package.json | |||
@@ -4,6 +4,7 @@ | |||
4 | }, | 4 | }, |
5 | "mappings": { | 5 | "mappings": { |
6 | "montage": "../../../../node_modules/montage/", | 6 | "montage": "../../../../node_modules/montage/", |
7 | "tools": "../../../../node_modules/tools/", | ||
7 | "montage-google": "../../../../node_modules/montage-google/" | 8 | "montage-google": "../../../../node_modules/montage-google/" |
8 | } | 9 | } |
9 | } \ No newline at end of file | 10 | } \ No newline at end of file |
diff --git a/js/document/views/design.js b/js/document/views/design.js index c7aab1d7..3b2eb11f 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -347,7 +347,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
347 | // | 347 | // |
348 | initMontage: { | 348 | initMontage: { |
349 | value: function () { | 349 | value: function () { |
350 | // | 350 | //initWithDocument(window.document) instantiateWithOwnerAndDocument(null, window.document) |
351 | } | 351 | } |
352 | }, | 352 | }, |
353 | //////////////////////////////////////////////////////////////////// | 353 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 8346c75e..e6f2cc2d 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -234,17 +234,13 @@ exports.IoMediator = Montage.create(Component, { | |||
234 | //TODO: Add attribute copying for <HEAD> and <HTML> | 234 | //TODO: Add attribute copying for <HEAD> and <HTML> |
235 | 235 | ||
236 | /* | 236 | /* |
237 | //Testing using montage clean up method | 237 | var tc = this.application.ninja.documentController.activeDocument.model.views.design.iframe.contentWindow.mjsTemplateCreator, code; |
238 | var mjscode, mjsTemp = TemplateCreator.create(); | 238 | code = tc.initWithDocument(this.application.ninja.documentController.activeDocument.model.views.design.iframe.contentWindow.document); |
239 | 239 | console.log(code._ownerSerialization, code._document.getElementsByTagName('html')[0].innerHTML); | |
240 | //mjscode = mjsTemp.initWithHeadAndBodyElements(template.head, template.body); | ||
241 | //mjscode = mjsTemp.initWithDocument(template.file.content.document); | ||
242 | mjscode = mjsTemp.initWithDocument(template.document); | ||
243 | 240 | ||
244 | console.log(template.head, mjscode._document.head); | ||
245 | template.file.content.document.head.innerHTML = mjscode._document.head.innerHTML.replace(regexRootUrl, ''); | 241 | template.file.content.document.head.innerHTML = mjscode._document.head.innerHTML.replace(regexRootUrl, ''); |
246 | template.file.content.document.body.innerHTML = mjscode._document.body.innerHTML.replace(regexRootUrl, ''); | 242 | template.file.content.document.body.innerHTML = mjscode._document.body.innerHTML.replace(regexRootUrl, ''); |
247 | */ | 243 | */ |
248 | 244 | ||
249 | 245 | ||
250 | 246 | ||
diff --git a/node_modules/tools/package.json b/node_modules/tools/package.json new file mode 100755 index 00000000..5d830af3 --- /dev/null +++ b/node_modules/tools/package.json | |||
@@ -0,0 +1,14 @@ | |||
1 | |||
2 | { | ||
3 | "name": "tools", | ||
4 | "version": "0.1.0", | ||
5 | "description": "Montage Tools", | ||
6 | "main": "tools", | ||
7 | "mappings": { | ||
8 | "montage" : "../montage/" | ||
9 | }, | ||
10 | "dependency": { | ||
11 | "montage" : "0.8" | ||
12 | } | ||
13 | |||
14 | } \ No newline at end of file | ||
diff --git a/node_modules/tools/template/template-creator.js b/node_modules/tools/template/template-creator.js index 1cd65ddd..374353f0 100755 --- a/node_modules/tools/template/template-creator.js +++ b/node_modules/tools/template/template-creator.js | |||
@@ -39,7 +39,7 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le | |||
39 | script, | 39 | script, |
40 | self = this; | 40 | self = this; |
41 | 41 | ||
42 | this._objectNamesIndex = {}; | 42 | this._componentNamesIndex = {}; |
43 | doc = this._document = document.implementation.createHTMLDocument(""); | 43 | doc = this._document = document.implementation.createHTMLDocument(""); |
44 | 44 | ||
45 | function copyNode(sourceNode, targetNode, isRootNode) { | 45 | function copyNode(sourceNode, targetNode, isRootNode) { |