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/file-picker/file-input-field.reel/file-input-field.js | 7 +++---- .../new-file-location.reel/new-file-location.js | 7 +++---- .../new-file-options-navigator.js | 4 ++-- js/io/ui/save-as-dialog.reel/save-as-dialog.js | 11 +++++------ 4 files changed, 13 insertions(+), 16 deletions(-) (limited to 'js/io/ui') 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); } }, 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); } }, diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js index 18556bc5..c98955ca 100644 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js @@ -326,8 +326,8 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C handleNewFileDirectorySet:{ value:function(evt){ - if((evt.keyCode === 13) && !this.okButton.hasAttribute("disabled")){ - this.handleOkButtonAction(evt); + if(evt.keyCode === 13){ + if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt); }else if(evt.keyCode === 27){ this.handleCancelButtonAction(evt); } diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js index 2bc141f7..c5ed8d33 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js @@ -85,8 +85,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { handleNewFileDirectorySet:{ value:function(evt){ - if((evt.keyCode === 13) && !this.okButton.hasAttribute("disabled")){ - this.handleOkButtonAction(evt); + if(evt.keyCode === 13){ + if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt); }else if(evt.keyCode === 27){ this.handleCancelButtonAction(evt); } @@ -101,10 +101,9 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { handlePaste:{ value:function(evt){ - var self=this; - setTimeout(function(){ - self.handleNewFileNameOnkeyup(evt); - }, 1); + evt.preventDefault(); + evt.target.value = evt.clipboardData.getData("Text"); + this.handleNewFileNameOnkeyup(evt); } }, -- cgit v1.2.3