From 83fff4ad660e4c9ea82c234f051c58d96f84f3e3 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 25 May 2012 15:18:41 -0700 Subject: fix for the id and class controls in the pi the id and class did not set values from the pi because of the removals of all id's on element. Signed-off-by: Valerio Virgillito --- js/panels/properties.reel/properties.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index e3ecce10..84b0d589 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -89,7 +89,7 @@ exports.Properties = Montage.create(Component, { handleBlur: { value: function(event) { - if(event.target.id === "elementId") { + if(event.target === this.elementId.element) { // Remove all white spaces from the id this.elementId.value = this.elementId.value.replace(/\s/g, ''); @@ -106,7 +106,7 @@ exports.Properties = Montage.create(Component, { } else { ElementsMediator.setAttribute(this.application.ninja.currentDocument.model.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.model.documentRoot.elementModel.id); } - } else if(event.target.id === "elementClass") { + } else if(event.target === this.elementClass.element) { if(this.application.ninja.selectedElements.length) { ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "class", this.elementClass.value, this.application.ninja.selectedElements[0].className, "pi"); } else { -- cgit v1.2.3 From b978bf7f76195bea9caa370ea18b1444d0b1bf18 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 27 May 2012 16:32:32 -0700 Subject: Cleaning up --- js/document/document-text.js | 59 ++++++++++++++++++++++---------------------- js/document/views/code.js | 56 +++++++++++++++++------------------------ 2 files changed, 52 insertions(+), 63 deletions(-) diff --git a/js/document/document-text.js b/js/document/document-text.js index bb63f5f8..811cc8ce 100755 --- a/js/document/document-text.js +++ b/js/document/document-text.js @@ -6,17 +6,16 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot //////////////////////////////////////////////////////////////////////// // -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component, +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, TextDocumentModel = require("js/document/models/text").TextDocumentModel, - CodeDocumentView = require("js/document/views/code").CodeDocumentView; + CodeDocumentView = require("js/document/views/code").CodeDocumentView; //////////////////////////////////////////////////////////////////////// // exports.TextDocument = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // hasTemplate: { - enumerable: false, value: false }, //////////////////////////////////////////////////////////////////// @@ -26,45 +25,47 @@ exports.TextDocument = Montage.create(Component, { }, //////////////////////////////////////////////////////////////////// // - init:{ - enumerable: false, - value : function(file, context, callback, view){ - var codeDocumentView = CodeDocumentView.create(), container = null; - + value: function(file, context, callback, view){ + // + var codeDocumentView = CodeDocumentView.create(), container = null; //TODO: Why is this initilzied to null? //Creating instance of Text Document Model this.model = Montage.create(TextDocumentModel,{ file: {value: file}, - parentContainer: {value: document.getElementById("codeViewContainer")}, - views: {value: {'code': codeDocumentView, 'design': null}} + parentContainer: {value: document.getElementById("codeViewContainer")}, //TODO: Remove reference to this element, should be dynamic + views: {value: {'code': codeDocumentView, 'design': null}} //TODO: Add check if file might have design view, if so, then create it }); - + //TODO: Add design view logic + //Initilizing view(s) codeDocumentView.initialize(this.model.parentContainer); - - codeDocumentView.textArea.value = file.content; - codeDocumentView.initializeTextView(file, this); - + //Checking for view specified if (view === 'code') { //TODO: Remove reference and use as part of model this.currentView = 'code'; //Setting current view object to design this.model.currentView = this.model.views.code; + //Rendering view + codeDocumentView.textArea.value = file.content; + codeDocumentView.initializeTextView(file, this); + } else { + //Other view(s) logic goes here } - - - callback.call(context, this); + //Checking if callback is needed + if (callback) callback.call(context, this); } }, -//////////////////////////////////////////////////////////////////// - // - closeDocument: { - value: function (context, callback) { - var closed = this.model.close(null); - - callback.call(context, this); - } - } -//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// + // + closeDocument: { + value: function (context, callback) { + //Closing document and getting outcome + var closed = this.model.close(null); + //Making callback if specified + if (callback) callback.call(context, this); + } + } + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/js/document/views/code.js b/js/document/views/code.js index 66d1c702..0a0ff5c1 100755 --- a/js/document/views/code.js +++ b/js/document/views/code.js @@ -10,15 +10,13 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, BaseDocumentView = require("js/document/views/base").BaseDocumentView; //////////////////////////////////////////////////////////////////////// -// -var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentView, { +// +exports.CodeDocumentView = Montage.create(BaseDocumentView, { //////////////////////////////////////////////////////////////////// // hasTemplate: { - enumerable: false, value: false }, - //////////////////////////////////////////////////////////////////// // _editor: { @@ -28,7 +26,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie // editor: { get: function() {return this._editor;}, - set: function(value) {this._editor= value;} + set: function(value) {this._editor = value;} }, //////////////////////////////////////////////////////////////////// // @@ -39,7 +37,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie // textArea: { get: function() {return this._textArea;}, - set: function(value) {this._textArea= value;} + set: function(value) {this._textArea = value;} }, //////////////////////////////////////////////////////////////////// // @@ -50,14 +48,10 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie // textViewContainer: { get: function() {return this._textViewContainer;}, - set: function(value) {this._textViewContainer= value;} + set: function(value) {this._textViewContainer = value;} }, //////////////////////////////////////////////////////////////////// // - - /** - * Public method - */ initialize:{ value: function(parentContainer){ //create contianer @@ -65,42 +59,35 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie //this.textViewContainer.id = "codemirror_" + uuid; this.textViewContainer.style.display = "block"; parentContainer.appendChild(this.textViewContainer); - //create text area this.textArea = this.createTextAreaElement(); } }, - - /** - * Public method - * Creates a textarea element which will contain the content of the opened text document. - */ + //////////////////////////////////////////////////////////////////// + //Creates a textarea element which will contain the content of the opened text document createTextAreaElement: { value: function() { var textArea = document.createElement("textarea"); -// textArea.id = "code"; -// textArea.name = "code"; + //textArea.id = "code"; + //textArea.name = "code"; this.textViewContainer.appendChild(textArea); - + //Returns textarea element return textArea; } }, //////////////////////////////////////////////////////////////////// - // - /** - * Public method - * Creates a new instance of a code editor - */ + //Creates a new instance of a code editor initializeTextView: { value: function(file, textDocument) { + // var type; - + // if(this.activeDocument) { //need to hide only if another document was open before -// this.application.ninja.documentController._hideCurrentDocument(); -// this.hideOtherDocuments(doc.uuid); + //this.application.ninja.documentController._hideCurrentDocument(); + //this.hideOtherDocuments(doc.uuid); } - + // switch(file.extension) { case "css" : type = "css"; @@ -130,18 +117,18 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie type = "xml"; break; } + // this.textViewContainer.style.display="block"; - + // this.editor = this.application.ninja.codeEditorController.createEditor(this, type, file.extension, textDocument); this.editor.hline = this.editor.setLineClass(0, "activeline"); - - } }, //////////////////////////////////////////////////////////////////// // show: { value: function (callback) { + // this.textViewContainer.style.display = "block"; // if (callback) callback(); @@ -151,6 +138,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie // hide: { value: function (callback) { + // this.textViewContainer.style.display = "none"; // if (callback) callback(); @@ -164,8 +152,8 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie this.textViewContainer.className = "codeViewContainer "+themeClass; } } -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// \ No newline at end of file -- cgit v1.2.3 From 526c2cee246c05fde7776e2d4e05f8c4adf27660 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 27 May 2012 17:03:37 -0700 Subject: Cleaning up --- js/io/system/ninjalibrary.js | 126 ++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 75 deletions(-) diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index 3de5fb69..dab623c1 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js @@ -4,12 +4,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ -/* ///////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// -NOTES: - -//////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////// */ // var Montage = require("montage/core/core").Montage; //////////////////////////////////////////////////////////////////////// @@ -18,73 +13,53 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //////////////////////////////////////////////////////////////////// // _chromeApi: { - enumerable: false, value: null }, //////////////////////////////////////////////////////////////////// // chromeApi: { - enumerable: false, - get: function() { - return this._chromeApi; - }, - set: function(value) { - this._chromeApi = value; - } + get: function() {return this._chromeApi;}, + set: function(value) {this._chromeApi = value;} }, //////////////////////////////////////////////////////////////////// // _coreApi: { - enumerable: false, value: null }, //////////////////////////////////////////////////////////////////// // coreApi: { - enumerable: false, - get: function() { - return this._coreApi; - }, - set: function(value) { - this._coreApi = value; - } + get: function() {return this._coreApi;}, + set: function(value) {this._coreApi = value;} }, //////////////////////////////////////////////////////////////////// // _libs: { - enumerable: false, value: null }, //////////////////////////////////////////////////////////////////// // libs: { - enumerable: false, - get: function() { - return this._libs; - }, - set: function(value) { - this._libs = value; - } + get: function() {return this._libs;}, + set: function(value) {this._libs = value;} }, //////////////////////////////////////////////////////////////////// // _libsToSync: { - enumerable: false, value: 0 }, //////////////////////////////////////////////////////////////////// // _syncedLibs: { - enumerable: false, value: 0 }, //////////////////////////////////////////////////////////////////// // copyLibToCloud: { - enumerable: false, value: function (path, libName, callback) { - // + //Checking for library to exists if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { + //Getting contents to begin copying this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { for (var i in contents) { if (libName === contents[i].name) { @@ -98,16 +73,15 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { } }.bind(this)); } else { - //Error + //TODO: Add error handling } } }, //////////////////////////////////////////////////////////////////// // copyDirectoryToCloud: { - enumerable: true, value: function(root, folder, fileRoot, callback) { - // + //Setting up directory name if (folder.name) { var dir; if (root) { @@ -115,23 +89,26 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { } else { dir = folder.name; } - // + //Creating directory if (!this.coreApi.createDirectory({uri: dir.replace(/\/\//gi, '/')})) { //Error occured while creating folders - return; + return; //TODO: Add error handling } } - // + //Checking for directory if (folder.isDirectory) { + //Using Chrome API to get directory contents this.chromeApi.directoryContents(folder, function (contents) { + //Looping through children of directory to copy for (var i in contents) { + //Checking for file or directory if (contents[i].isDirectory) { + //Recursive call if directory this.copyDirectoryToCloud(dir, contents[i], fileRoot); } else if (contents[i].isFile){ - //File to copy + //Copying file this.chromeApi.fileContent(contents[i].fullPath, function (result) { - // - //this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: blob.getBlob(result.data.type), contentType: result.data.type}); + //Using binary when copying files to allow images and such to work this.coreApi.createFile({uri: (fileRoot+result.file.fullPath).replace(/\/\//gi, '/'), contents: result.content}); }.bind(this)); } @@ -145,34 +122,31 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //////////////////////////////////////////////////////////////////// // synchronize: { - enumerable: true, value: function(chromeLibs, chrome) { //TODO: Remove window.wipeLibrary = this.deleteLibraries.bind(this); - // + //Getting instance of browser file API this.chromeApi = chrome; - // -// debugger; + //Local variables var i, l, libs, libjson, xhr = new XMLHttpRequest(), tocopylibs = []; - //Getting known json list of libraries to copy to chrome + //Getting known json list of libraries to copy to chrome (will be on a CDN later) xhr.open("GET", '/js/io/system/ninjalibrary.json', false); xhr.send(); //Checkng for correct reponse if (xhr.readyState === 4) { //Parsing json libraries libs = JSON.parse(xhr.response); - // + //Storing JSON data this.libs = libs.libraries; - // + //Checking for preview libraries to avoid duplicates if (chromeLibs.length > 0) { - // + //Looping through libraries on browser file system for (i=0; chromeLibs[i]; i++) { for (var j in libs.libraries) { - if (String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase() === chromeLibs[i]) { - //TODO: Remove, currently manually removing copied libraries - // //this.chromeApi.directoryDelete(chromeLibs[i]); - } else { - if (libs.libraries[j].file) { + //Checking for matching names (directories are libraries names) + if (String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase() !== chromeLibs[i]) { + //Checking for library to be single file (special case) + if (libs.libraries[j].file) { tocopylibs.push({name: String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase(), path: libs.libraries[j].path, file: libs.libraries[j].file}); } else { tocopylibs.push({name: String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase(), path: libs.libraries[j].path}); @@ -194,9 +168,9 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { } } } - // + //Storing list of libraries to copy this._libsToSync = tocopylibs.length; - // + //Check to see if libraries are needed to be copied if (tocopylibs.length > 0) { for (i=0; tocopylibs[i]; i++) { //Checking for library to be single file @@ -213,7 +187,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //Creating new file from loaded content this.chromeApi.fileNew('/'+tocopylibs[i].name+'/'+tocopylibs[i].file, xhr.response, function (status) {if(status) this.libraryCopied()}.bind(this)); } else { - //Error creating single file library + //TODO: Add error handling } } else { //Creating root folder @@ -224,16 +198,18 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { xhr.send(); //Checking for status if (xhr.readyState === 4) { - // + //Parsing JSON data of files to copy libjson = JSON.parse(xhr.response); - // + //Looping through list for (l=0; libjson.directories[l]; l++) { + //Initializing defaults libjson.dirsToCreate = libjson.directories.length; libjson.dirsCreated = 0; libjson.filesToCreate = libjson.files.length; libjson.filesCreated = 0; libjson.local = tocopylibs[i].name; libjson.main = this; + //Looping through list and creating directories first this.createDirectory(tocopylibs[i].name, libjson.directories[l], function (status) { //Checking for success on directories created if (status) { @@ -242,6 +218,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //All directories created if (this.dirsCreated === this.dirsToCreate) { var xhr, i; + //Looping through files to copy now that directories are ready for (i=0; this.files[i]; i++) { xhr = new XMLHttpRequest(); xhr.open("GET", this.root+this.files[i], false); @@ -263,7 +240,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { }.bind(libjson)); } } else { - //Error + //TODO: Add error handling } } } @@ -272,26 +249,25 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { this._dispatchEvent(); } } else { - //Error + //TODO: Add error handling } } }, //////////////////////////////////////////////////////////////////// - // + //Creating a directory on the file system (and sub directories if nested) createDirectory: { - enumerable: true, value: function(root, folder, callback) { - // + //Checking for name, establishing format if (folder.name) { if (root) { dir = root+'/'+folder.name; } else { dir = folder.name; } - // + //Creating directory this.chromeApi.directoryNew(dir, function (status) {if (callback)callback(status)}); } - // + //Checking for children and making recursive calls if needed if (folder.children) { for (var j in folder.children) { if (root) { @@ -304,9 +280,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { } }, //////////////////////////////////////////////////////////////////// - // + //Callback to keep track of copied libraries during sync libraryCopied: { - enumerable: true, value: function() { this._syncedLibs++; if (this._syncedLibs === this._libsToSync) { @@ -315,27 +290,28 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { } }, //////////////////////////////////////////////////////////////////// - // + //Method to remove libraries copied into browser file system (ALL) deleteLibraries: { - enumerable: true, value: function () { + //Used by file system API to callback function parseLibrary (contents) { - // + //Looping through contents to delete for(var i=0; contents[i]; i++) { - // + //Deleting entire directies (no single files are copied outside) if (contents[i].isDirectory) { this.chromeApi.directoryDelete(contents[i].name); + } else { + //TODO: Handle single files } } }; - // + //Making call to file system API to get all libraries (files) on file system this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, parseLibrary.bind(this)); } }, //////////////////////////////////////////////////////////////////// // _dispatchEvent: { - enumerable: true, value: function () { var syncEvent = document.createEvent("CustomEvent"); syncEvent.initEvent('sync', true, true); -- cgit v1.2.3 From 6ca89e7233614b93c49a4feadb8a0a82e5800b8f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 27 May 2012 17:32:41 -0700 Subject: Cleaning up --- js/document/views/design.js | 6 ++---- js/io/system/ninjalibrary.js | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/js/document/views/design.js b/js/document/views/design.js index d772aa86..c7313708 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -67,13 +67,13 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { propertiesPanel: { value: null }, - //////////////////////////////////////////////////////////////////// // _liveNodeList: { value: null }, - + //////////////////////////////////////////////////////////////////// + // getLiveNodeList: { value: function(useFilter) { if(useFilter) { @@ -92,8 +92,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } }, //////////////////////////////////////////////////////////////////// - // - // initialize: { value: function (parent) { diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index dab623c1..12af5988 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js @@ -65,8 +65,13 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { if (libName === contents[i].name) { //Getting contents of library to be copied this.chromeApi.directoryContents(contents[i], function (lib) { - //Creating directory structure from subfolders - this.copyDirectoryToCloud(path, contents[i], path, callback); + //Copying to cloud, adding blocking if no callback specified + if (!callback) { + //TODO: Add blocking logic here + this.copyDirectoryToCloud(path, contents[i], path); + } else { + this.copyDirectoryToCloud(path, contents[i], path, callback); + } }.bind(this)); break; } -- cgit v1.2.3 From 75a01802f73e791b082229f065eeb3df6a48a962 Mon Sep 17 00:00:00 2001 From: António Afonso Date: Wed, 30 May 2012 10:17:49 -0700 Subject: Avoid duplicate labels in template creator This is the fix for Motorola-Mobility/montage#649--- node_modules/tools/template/template-creator.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/node_modules/tools/template/template-creator.js b/node_modules/tools/template/template-creator.js index 374353f0..dc6b1190 100755 --- a/node_modules/tools/template/template-creator.js +++ b/node_modules/tools/template/template-creator.js @@ -51,8 +51,8 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le component = isRootNode ? null : sourceNode.controller; if (component) { - label = self._generateLabelForComponent(component); targetNode.setAttribute("id", label); + label = self._generateLabelForComponent(component, Object.keys(components)); component._element = targetNode; components[label] = component; } else { @@ -94,8 +94,8 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le _componentNamesIndex: { value: null }, - - _generateLabelForComponent: {value: function(component) { + + _generateLabelForComponent: {value: function(component, labels) { var componentInfo = Montage.getInfoForObject(component), componentLabel = componentInfo.label, componentName, @@ -105,8 +105,11 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le return componentLabel; } else { componentName = componentInfo.objectName.toLowerCase(); - index = this._componentNamesIndex[componentName] || 1; - this._componentNamesIndex[componentName] = index + 1; + do { + index = this._componentNamesIndex[componentName] || 1; + this._componentNamesIndex[componentName] = index + 1; + } while (labels.indexOf(componentName+index) >= 0); + return componentName + index; } }}, -- cgit v1.2.3 From e6dbd73e80ac47ae9bfdfdb5bef3263b24a36603 Mon Sep 17 00:00:00 2001 From: António Afonso Date: Wed, 30 May 2012 10:34:45 -0700 Subject: Stop adding ids to elements in template creator This is the fix for Motorola-Mobility/montage#648 --- node_modules/tools/template/template-creator.js | 1 - 1 file changed, 1 deletion(-) diff --git a/node_modules/tools/template/template-creator.js b/node_modules/tools/template/template-creator.js index dc6b1190..4ba1b443 100755 --- a/node_modules/tools/template/template-creator.js +++ b/node_modules/tools/template/template-creator.js @@ -51,7 +51,6 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le component = isRootNode ? null : sourceNode.controller; if (component) { - targetNode.setAttribute("id", label); label = self._generateLabelForComponent(component, Object.keys(components)); component._element = targetNode; components[label] = component; -- cgit v1.2.3 From 87a5999ecd9e7d84d21fd8c712944cd9408c3aa0 Mon Sep 17 00:00:00 2001 From: António Afonso Date: Wed, 30 May 2012 10:36:59 -0700 Subject: Stop serializing the child components of the top components are not serialized We just removed them before serializing and add them again afterwards.--- node_modules/tools/template/template-creator.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/node_modules/tools/template/template-creator.js b/node_modules/tools/template/template-creator.js index 4ba1b443..01a2518b 100755 --- a/node_modules/tools/template/template-creator.js +++ b/node_modules/tools/template/template-creator.js @@ -35,6 +35,7 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le var serializer = this.serializer, objects = {}, components = {}, + componentsChildComponents = {}, doc, script, self = this; @@ -54,6 +55,8 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le label = self._generateLabelForComponent(component, Object.keys(components)); component._element = targetNode; components[label] = component; + componentsChildComponents[label] = component.childComponents; + delete component.childComponents; } else { for (var i = 0; (childNode = childNodes[i]); i++) { targetChildNode = targetNode.appendChild(childNode.cloneNode(false)); @@ -84,6 +87,10 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le copyNode(body, this._document.body, true); this._ownerSerialization = serializer.serialize(components); + for (var label in components) { + components[label].childComponents = componentsChildComponents[label]; + } + components = componentsChildComponents = null; this._externalObjects = serializer.getExternalObjects(); return this; -- cgit v1.2.3 From 78c80a68083ed8ad573898de215fb723b0546d32 Mon Sep 17 00:00:00 2001 From: António Afonso Date: Wed, 30 May 2012 10:37:38 -0700 Subject: Initialize an internal Template variable in TemplateCreator --- node_modules/tools/template/template-creator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/node_modules/tools/template/template-creator.js b/node_modules/tools/template/template-creator.js index 01a2518b..c5d3cffd 100755 --- a/node_modules/tools/template/template-creator.js +++ b/node_modules/tools/template/template-creator.js @@ -41,6 +41,7 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le self = this; this._componentNamesIndex = {}; + this._objectNamesIndex = {}; doc = this._document = document.implementation.createHTMLDocument(""); function copyNode(sourceNode, targetNode, isRootNode) { -- cgit v1.2.3 From d49c909cff7f0c5e5d0b127ad84a2fefc6677dc6 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 14:46:00 -0700 Subject: updating to version 0.6 Signed-off-by: Valerio Virgillito --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index b46c9826..e9406399 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Ninja", "description": "Ninja HTML5 Authoring Tool - Alpha Release", - "version": "0.5.3.0", + "version": "0.6.0.0", "app": { "launch": { "local_path": "index.html" -- cgit v1.2.3