From 5b0ff2b7347d158876c366c51988a94570dda18b Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 22 Mar 2012 10:43:54 -0700 Subject: IKNINJA-1302 : more fix Signed-off-by: Ananya Sen --- js/io/ui/file-picker/file-input-field.reel/file-input-field.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/io/ui/file-picker/file-input-field.reel/file-input-field.js') diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 651fd7fa..ccb925b9 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js @@ -69,6 +69,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { var newFileDirectorySetEvent = document.createEvent("Events"); newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; + newFileDirectorySetEvent.keyCode = evt.keyCode; this.eventManager.dispatchEvent(newFileDirectorySetEvent); } } -- cgit v1.2.3 From 834086b91afc752745128a0c2be4730bf1c7858d Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 28 Mar 2012 14:02:57 -0700 Subject: detect paste from context menu for new file and save as dialog Signed-off-by: Ananya Sen Conflicts: js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js Signed-off-by: Ananya Sen --- js/io/ui/file-picker/file-input-field.reel/file-input-field.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/io/ui/file-picker/file-input-field.reel/file-input-field.js') diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index ccb925b9..1ab268c5 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js @@ -20,6 +20,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); + this.newFileDirectory.addEventListener("paste", this, false); } }, @@ -63,6 +64,15 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { } }, + handlePaste:{ + value:function(evt){ + var self=this; + setTimeout(function(){ + self.handleNewFileDirectoryOnkeyup(evt); + }, 1); + } + }, + handleNewFileDirectoryOnkeyup:{ value:function(evt){ if(this.newFileDirectory.value !== ""){ -- cgit v1.2.3 From d4a682ddca0248e0dd7d8871dddbd167bd020a18 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 30 Mar 2012 16:31:18 -0700 Subject: - using clipboard data directly to avoid using setTimeout - fixed logical error to trigger OK on Enter key pressed Signed-off-by: Ananya Sen --- js/io/ui/file-picker/file-input-field.reel/file-input-field.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'js/io/ui/file-picker/file-input-field.reel/file-input-field.js') diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 1ab268c5..46e8b386 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js @@ -66,10 +66,9 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { handlePaste:{ value:function(evt){ - var self=this; - setTimeout(function(){ - self.handleNewFileDirectoryOnkeyup(evt); - }, 1); + evt.preventDefault(); + evt.target.value = evt.clipboardData.getData("Text"); + this.handleNewFileDirectoryOnkeyup(evt); } }, -- cgit v1.2.3 From 5de25f936c9dce08f1d24824ae1946a07e7b708d Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 4 Apr 2012 19:21:01 -0700 Subject: - disable ok when text box is cleared using backspace and cross, for file name and directory location, in New file and save as dialog Signed-off-by: Ananya Sen --- .../file-input-field.reel/file-input-field.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'js/io/ui/file-picker/file-input-field.reel/file-input-field.js') diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 46e8b386..0f66468a 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js @@ -21,6 +21,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); this.newFileDirectory.addEventListener("paste", this, false); + this.newFileDirectory.addEventListener("search", this, false); } }, @@ -74,16 +75,20 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { handleNewFileDirectoryOnkeyup:{ value:function(evt){ - if(this.newFileDirectory.value !== ""){ - var newFileDirectorySetEvent = document.createEvent("Events"); - newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); - newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; - newFileDirectorySetEvent.keyCode = evt.keyCode; - this.eventManager.dispatchEvent(newFileDirectorySetEvent); - } + var newFileDirectorySetEvent = document.createEvent("Events"); + newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); + newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; + newFileDirectorySetEvent.keyCode = evt.keyCode; + this.eventManager.dispatchEvent(newFileDirectorySetEvent); } }, + handleSearch:{ + value:function(evt){ + this.handleNewFileDirectoryOnkeyup(evt); + } + }, + handleFileInputPickerSelectionsDone:{ value: function(evt){ var selectedUri = ""; @@ -105,7 +110,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { if(!!obj && obj.uri && obj.uri.length > 0){ selectedUri = obj.uri[0]; this.newFileDirectory.value = selectedUri; - + this.newFileDirectory.focus(); var newFileDirectorySetEvent = document.createEvent("Events"); newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; -- cgit v1.2.3 From 8acdde3e87f8cabd179a068c54fe5b78fa38e40d Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 5 Apr 2012 22:54:53 -0700 Subject: - using Montage TextField component to handle any edits like keyup, paste, cut. - optimized Enter and Esc key handling Signed-off-by: Ananya Sen --- .../file-input-field.reel/file-input-field.js | 37 ++++++++++------------ 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'js/io/ui/file-picker/file-input-field.reel/file-input-field.js') diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 0f66468a..9e77759f 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js @@ -14,14 +14,10 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { value: function() { var that = this; this.findDirectory.identifier = "findDirectory"; - this.findDirectory.addEventListener("click", this, false); - - this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); - - this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); - this.newFileDirectory.addEventListener("paste", this, false); - this.newFileDirectory.addEventListener("search", this, false); + this.eventManager.addEventListener("pickerSelectionsDone", this.handleFileInputPickerSelectionsDone, false); + this.addEventListener("change@newFileDirectory.value", this.handleNewFileDirectoryChange, false); + this.newFileDirectory.element.addEventListener("keyup", this, false); } }, @@ -65,15 +61,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { } }, - handlePaste:{ - value:function(evt){ - evt.preventDefault(); - evt.target.value = evt.clipboardData.getData("Text"); - this.handleNewFileDirectoryOnkeyup(evt); - } - }, - - handleNewFileDirectoryOnkeyup:{ + handleNewFileDirectoryChange:{ value:function(evt){ var newFileDirectorySetEvent = document.createEvent("Events"); newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); @@ -83,9 +71,18 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { } }, - handleSearch:{ - value:function(evt){ - this.handleNewFileDirectoryOnkeyup(evt); + + handleKeyup:{ + value: function(evt){ + if(evt.keyCode === 13){ + var enterKeyupEvent = document.createEvent("Events"); + enterKeyupEvent.initEvent("enterKey", false, false); + this.eventManager.dispatchEvent(enterKeyupEvent); + }else if(evt.keyCode === 27){ + var escKeyupEvent = document.createEvent("Events"); + escKeyupEvent.initEvent("escKey", false, false); + this.eventManager.dispatchEvent(escKeyupEvent); + } } }, @@ -110,7 +107,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { if(!!obj && obj.uri && obj.uri.length > 0){ selectedUri = obj.uri[0]; this.newFileDirectory.value = selectedUri; - this.newFileDirectory.focus(); + this.newFileDirectory.element.focus(); var newFileDirectorySetEvent = document.createEvent("Events"); newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; -- cgit v1.2.3