From c2805e03c84b6e598556fd06d1ede7aaeea7ce9c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 16:17:54 -0800 Subject: Squashed commit FileIO-Build-Candidate into Master Fixing issues with HTML and CSS URLs. Adjusted RegEx logic. Also code a mirror update and undo/redo changes were merged into this request. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 9 ++++++--- js/controllers/selection-controller.js | 12 +++++++----- js/controllers/undo-controller.js | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 64ff2c7e..194496a6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -76,11 +76,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // handleWebRequest: { value: function (request) { - if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { + //TODO: Check if frameId is proper + if (this._hackRootFlag && request.parentFrameId !== -1) { //TODO: Optimize creating string - return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; - } + //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); + //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; + return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/montage-html/'))[1]}; } + } }, //////////////////////////////////////////////////////////////////// // diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index c4623d3f..75968d4a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -76,7 +76,7 @@ exports.SelectionController = Montage.create(Component, { this.application.ninja.selectedElements = currentSelectionArray; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); @@ -92,12 +92,14 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { this._selectedItems = this.application.ninja.selectedElements.slice(0); - if(this._selectedItems.length === 0 ){ + if(this._selectedItems.length === 0) { this._isDocument = true; - }else{ + } else { this._isDocument = false; } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); + + this._selectionContainer = this.application.ninja.currentSelectedContainer; } }, @@ -137,7 +139,7 @@ exports.SelectionController = Montage.create(Component, { value: function(event) { this.application.ninja.selectedElements = []; this._isDocument = true; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); } }, diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js index 926803d3..19cfb6e6 100755 --- a/js/controllers/undo-controller.js +++ b/js/controllers/undo-controller.js @@ -71,22 +71,28 @@ exports.UndoController = Montage.create( Component, { /** * Undo Queue */ - _undoQueue: { value: [] }, + _undoQueue: { value: []}, undoQueue: { get: function() { return this._undoQueue; + }, + set: function(value){ + this._undoQueue = value; } }, /** * Redo Queue */ - _redoQueue: { value: [], enumerable: false }, + _redoQueue: { value: [], enumerable: false}, redoQueue: { get: function() { return this._redoQueue; + }, + set: function(value){ + this._redoQueue = value; } }, @@ -202,5 +208,12 @@ exports.UndoController = Montage.create( Component, { this.redoQueue.splice(0, this.redoQueue.length); //this.redoQueue = []; } + }, + + clearHistory:{ + value: function(){ + this.undoQueue.length = 0; + this.redoQueue.length = 0; + } } }); \ No newline at end of file -- cgit v1.2.3