Fixed title editing issue on IE
This commit is contained in:
parent
d33037e18d
commit
f3b32e8d03
@ -56,10 +56,10 @@ define([
|
||||
// Create a file title
|
||||
title = constants.DEFAULT_FILE_TITLE;
|
||||
var indicator = 2;
|
||||
var checkTitle = function (fileDesc) {
|
||||
var checkTitle = function(fileDesc) {
|
||||
return fileDesc.title == title;
|
||||
};
|
||||
while (_.some(fileSystem, checkTitle)) {
|
||||
while(_.some(fileSystem, checkTitle)) {
|
||||
title = constants.DEFAULT_FILE_TITLE + indicator++;
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ define([
|
||||
if(!isTemporary) {
|
||||
do {
|
||||
fileIndex = "file." + utils.randomString();
|
||||
} while (_.has(fileSystem, fileIndex));
|
||||
} while(_.has(fileSystem, fileIndex));
|
||||
}
|
||||
|
||||
// syncIndex associations
|
||||
@ -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("");
|
||||
|
Loading…
Reference in New Issue
Block a user