Fixed title editing issue on IE

This commit is contained in:
benweet 2014-09-06 01:09:35 +01:00
parent d33037e18d
commit f3b32e8d03

View File

@ -155,17 +155,22 @@ define([
$(".action-remove-file").click(function() {
fileMgr.deleteFile();
});
var titleEditing;
$fileTitleElt.click(function() {
if(window.viewerMode === true) {
return;
}
$fileTitleElt.addClass('hide');
var fileTitleInput = $fileTitleInputElt.removeClass('hide');
titleEditing = true;
setTimeout(function() {
fileTitleInput.focus().get(0).select();
}, 10);
});
function applyTitle() {
if(!titleEditing) {
return;
}
$fileTitleInputElt.addClass('hide');
$fileTitleElt.removeClass('hide');
var title = $.trim($fileTitleInputElt.val());
@ -176,12 +181,17 @@ define([
}
$fileTitleInputElt.val(fileDesc.title);
$editorElt.focus();
titleEditing = false;
}
$fileTitleInputElt.blur(function() {
setTimeout(function() {
applyTitle();
}).keyup(function(e) {
}, 0);
}).keypress(function(e) {
if(e.keyCode == 13) {
applyTitle();
e.preventDefault();
}
if(e.keyCode == 27) {
$fileTitleInputElt.val("");