From 4ba680a7e9168d0f505a81e42a287dfbc54b4d7d Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 1 May 2012 15:26:37 -0700 Subject: Preliminary IO to new DOM view --- js/controllers/selection-controller.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 5665b09c..2bd774f5 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -152,7 +152,6 @@ exports.SelectionController = Montage.create(Component, { selectElement: { value: function(element) { - if(this.findSelectedElement(element) === -1) { if(this.application.ninja.currentDocument.inExclusion(element) !== -1){ -- cgit v1.2.3 From 8f1385d4aa12173fb4d9af695b8e5036f675b621 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 4 May 2012 14:39:33 -0700 Subject: Fixing selection and layout code to exclude SCRIPT and STYLE tags. Signed-off-by: Nivesh Rajbhandari --- js/controllers/selection-controller.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 5665b09c..77c065ae 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -112,12 +112,12 @@ exports.SelectionController = Montage.create(Component, { handleSelectAll: { value: function(event) { - var selected = [], childNodes = []; + var selected = [], childNodes = [], self = this; childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; childNodes = Array.prototype.slice.call(childNodes, 0); childNodes.forEach(function(item) { - if(item.nodeType == 1) { + if(self.isNodeTraversable(item)) { selected.push(item); } }); @@ -281,6 +281,13 @@ exports.SelectionController = Montage.create(Component, { return -1; } + }, + + isNodeTraversable: { + value: function( item ) { + if(item.nodeType !== 1) return false; + return ((item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")); + } } }); -- cgit v1.2.3 From e7293b28c53b23e64044c29e8451cbf3fc0bd049 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 10 May 2012 22:25:26 -0700 Subject: Partially fixing the body pi and fixing the selection controller Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index a81cdf7f..6e40abb5 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -165,7 +165,7 @@ exports.SelectionController = Montage.create(Component, { while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { // If element is higher up than current container then return - if(outerElement.id === "UserContent") return; + if(outerElement.nodeName === "BODY") return; // else keep going up the chain outerElement = outerElement.parentNode; } @@ -246,25 +246,20 @@ exports.SelectionController = Montage.create(Component, { } }, - /** - * Looks into the selectionObject for the item to be found using it's id - * - * @return: Item index in the selectionObject if found - * -1 if not found - */ findSelectedElement: { value: function(item) { - // TODO do the loop check in the select element and only use the index here - // return this.application.ninja.selectedElements.indexOf(item); + // TODO: Remove this function and use the stage selectable. Then only return a match in the array + //return this.application.ninja.selectedElements.indexOf(item); + //TODO: Make sure we don't need to loop back to the container element. var itemUUID; for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { // Check for multiple selection and excluding inner elements - if(item.parentNode && item.parentNode.id !== "UserContent") { + if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) { var outerElement = item.parentNode; - while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { + while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) { outerElement = outerElement.parentNode; } -- cgit v1.2.3 From 7a94696e19b14e15261df516e2ba75e693b1313d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 00:21:56 -0700 Subject: enabling basic document switching Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 6e40abb5..1092615a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -81,10 +81,10 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { - if(this.application.ninja.documentController.activeDocument.currentView === "design"){ +// if(this.application.ninja.documentController.activeDocument.currentView === "design"){ this._isDocument = this.application.ninja.selectedElements.length === 0; NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); - } +// } } }, -- cgit v1.2.3 From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: Cleaning up referencing to 'documentRoot' and '_document' Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view. --- js/controllers/selection-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 1092615a..7bef0db8 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -114,7 +114,7 @@ exports.SelectionController = Montage.create(Component, { value: function(event) { var selected = [], childNodes = [], self = this; - childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; + childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes; childNodes = Array.prototype.slice.call(childNodes, 0); childNodes.forEach(function(item) { if(self.isNodeTraversable(item)) { @@ -256,10 +256,10 @@ exports.SelectionController = Montage.create(Component, { for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { // Check for multiple selection and excluding inner elements - if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) { + if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.model.documentRoot) { var outerElement = item.parentNode; - while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) { + while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.model.documentRoot) { outerElement = outerElement.parentNode; } -- cgit v1.2.3 From 209ec9524a987a8f8bc20c57e2a76ac55be15fd9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 24 May 2012 11:11:47 -0700 Subject: Fixed selection bug when switching/opening documents. Also, use saved scroll values when switching between documents. Signed-off-by: Nivesh Rajbhandari --- js/controllers/selection-controller.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 1092615a..214b9032 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -67,10 +67,9 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = true; if(currentSelectionArray) { - if(currentSelectionArray.length >= 1) { + this.application.ninja.selectedElements = currentSelectionArray; + if(currentSelectionArray.length) { this._isDocument = false; - - this.application.ninja.selectedElements = currentSelectionArray; NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); } } -- cgit v1.2.3