From 2edcdd88ffc2f6ff0ea836e4da3e1fd2cb3e856f Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 27 Feb 2012 17:39:26 -0800 Subject: persist undo/redo stack per html document Signed-off-by: Ananya Sen --- js/controllers/undo-controller.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js index 926803d3..01853593 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: [], writable:true }, undoQueue: { get: function() { return this._undoQueue; + }, + set: function(value){ + this._undoQueue = value; } }, /** * Redo Queue */ - _redoQueue: { value: [], enumerable: false }, + _redoQueue: { value: [], enumerable: false, writable:true }, 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.splice(0, this.undoQueue.length); + this.redoQueue.splice(0, this.redoQueue.length); + } } }); \ No newline at end of file -- cgit v1.2.3 From 1766c6b17e2311fcd21c2be6608c7dcdc0a9b23a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 15:07:49 -0800 Subject: persist selections while switching documents Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index f50762f3..62313960 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -47,6 +47,7 @@ exports.SelectionController = Montage.create(Component, { this.eventManager.addEventListener("elementDeleted", this, false); this.eventManager.addEventListener("selectAll", this, false); this.eventManager.addEventListener("deleteSelection", this, false); + this.eventManager.addEventListener("switchDocument", this, false); // defaultEventManager.addEventListener( "undo", this, false); // defaultEventManager.addEventListener( "redo", this, false); } @@ -88,6 +89,14 @@ exports.SelectionController = Montage.create(Component, { } }, + handleSwitchDocument: { + value: function() { + this._selectedItems = this.application.ninja.selectedElements.slice(0); + this._isDocument = false; + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + } + }, + handleElementAdded: { value: function(event) { this.executeSelectElement(event.detail); -- cgit v1.2.3 From e0fab951e4f3869b04fd4a01f429a6654991cd68 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 15:33:35 -0800 Subject: minor fixes in saving undo/redo stacks per document Signed-off-by: Ananya Sen --- js/controllers/undo-controller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js index 01853593..19cfb6e6 100755 --- a/js/controllers/undo-controller.js +++ b/js/controllers/undo-controller.js @@ -71,7 +71,7 @@ exports.UndoController = Montage.create( Component, { /** * Undo Queue */ - _undoQueue: { value: [], writable:true }, + _undoQueue: { value: []}, undoQueue: { get: function() { @@ -85,7 +85,7 @@ exports.UndoController = Montage.create( Component, { /** * Redo Queue */ - _redoQueue: { value: [], enumerable: false, writable:true }, + _redoQueue: { value: [], enumerable: false}, redoQueue: { get: function() { @@ -212,8 +212,8 @@ exports.UndoController = Montage.create( Component, { clearHistory:{ value: function(){ - this.undoQueue.splice(0, this.undoQueue.length); - this.redoQueue.splice(0, this.redoQueue.length); + this.undoQueue.length = 0; + this.redoQueue.length = 0; } } }); \ No newline at end of file -- cgit v1.2.3 From 1c7e86b6c2c802d720cc3075f75c7a61866ebc07 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 16:41:18 -0800 Subject: fix for creatingNewFile flag Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 02031922..64ff2c7e 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -195,7 +195,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value:function(doc){ var response = doc || null;//default just for testing if(!!response && response.success && (response.status!== 500) && !!response.uri){ + + this.isNewFilePath = true;//path identifier flag this.creatingNewFile = true;//flag for timeline to identify new file flow + this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); }else if(!!response && !response.success){ //Todo: restrict directory path to the sandbox, in the dialog itself @@ -224,9 +227,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, //TODO: Add UI to handle error codes, shouldn't be alert windows if(!!response && (response.status === 204)) { - if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow + if((typeof this.isNewFilePath === 'undefined') || (this.isNewFilePath !== true)){//not from new file flow this.creatingNewFile = false; } + this.isNewFilePath = false;//reset path identifier flag //Sending full response object this.openDocument(response); -- cgit v1.2.3 From 7a9c2a91dfbbdd0cd7c79d81be5aeecd7887e7f1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 29 Feb 2012 10:12:38 -0800 Subject: handle selections for switching documents Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 62313960..0f2a16e0 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -92,7 +92,11 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { this._selectedItems = this.application.ninja.selectedElements.slice(0); - this._isDocument = false; + if(this._selectedItems.length === 0){ + this._isDocument = true; + }else{ + this._isDocument = false; + } NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } }, -- cgit v1.2.3 From 03ea76700cb8bee3f4f58acf3e3503b0642d13fb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 29 Feb 2012 11:46:19 -0800 Subject: fixed selection which click after switching to a document Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 0f2a16e0..184c4899 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -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{ this._isDocument = false; } NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + + this._selectionContainer = this.application.ninja.currentSelectedContainer; } }, -- cgit v1.2.3 From 80ac930684255dd24cecae70b488285a6058488e Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 1 Mar 2012 13:34:45 -0800 Subject: Optimizing URL intercepting detection Modified the way the webRequest maps to the file. --- js/controllers/document-controller.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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]}; } + } }, //////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From 130cd6d4b99c9db344ec0ab44a54a59d11b31d2f Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 8 Mar 2012 13:29:58 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 194496a6..a8056519 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -336,14 +336,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component, nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); + if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();} this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ + if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){ + this.activeDocument.pauseAndStopVideos(); + } this.activeDocument = null; this._removeDocumentView(doc.container); this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; this.application.ninja.stage.hideCanvas(true); + }else{//closing inactive document tab - just clear DOM + if(typeof doc.pauseAndStopVideos !== "undefined"){ + doc.pauseAndStopVideos(); + } + this._removeDocumentView(doc.container); } NJevent("closeDocument", doc.uri); -- cgit v1.2.3 From 1c1862702f0356259c2e24fdccc3a5e42b6f03da Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 9 Mar 2012 15:21:26 -0800 Subject: Temp Gradient Fix Temporary fix for getting gradient mode. --- js/controllers/color-controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index a6e41dd3..53573baf 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -259,6 +259,7 @@ exports.ColorController = Montage.create(Component, { //Radial gradient gradient.stops = []; gradient.mode = 'radial'; + gradient.gradientMode = 'radial'; gradient.css = css; // arr = css.split('%,'); @@ -284,6 +285,7 @@ exports.ColorController = Montage.create(Component, { //Linear gradient gradient.stops = []; gradient.mode = 'linear'; + gradient.gradientMode = 'linear'; gradient.css = css; // arr = css.split('from('); @@ -317,7 +319,7 @@ exports.ColorController = Montage.create(Component, { } } //Creating gradient object - color = {mode: 'gradient', value: {stops: gradient.stops, mode: gradient.mode, css: css}}; + color = {mode: 'gradient', value: {stops: gradient.stops, mode: gradient.mode, gradientMode: gradient.gradientMode, css: css}}; } else if (css){ //Simple solid color color = this.parseCssToColor(css); -- cgit v1.2.3