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 --- .../new-file-location.reel/new-file-location.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js') diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index fac4c488..5dd1153d 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js @@ -23,11 +23,21 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { this.fileInputField.selectDirectory = true; this.newFileName.addEventListener("keyup", this, false); - this.newFileName.focus(); + this.newFileName.addEventListener("paste", this, false); + this.newFileName.focus(); this.newFileName.select(); } }, + handlePaste:{ + value:function(evt){ + var self=this; + setTimeout(function(){ + self.handleKeyup(evt); + }, 1); + } + }, + handleKeyup:{ value:function(evt){ if(this.newFileName.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 --- .../ui/new-file-dialog/new-file-location.reel/new-file-location.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js') diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index 5dd1153d..02579676 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js @@ -31,10 +31,9 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { handlePaste:{ value:function(evt){ - var self=this; - setTimeout(function(){ - self.handleKeyup(evt); - }, 1); + evt.preventDefault(); + evt.target.value = evt.clipboardData.getData("Text"); + this.handleKeyup(evt); } }, -- cgit v1.2.3