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') 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') 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