Fixed title editing issue on IE
This commit is contained in:
parent
d33037e18d
commit
f3b32e8d03
@ -56,10 +56,10 @@ define([
|
|||||||
// Create a file title
|
// Create a file title
|
||||||
title = constants.DEFAULT_FILE_TITLE;
|
title = constants.DEFAULT_FILE_TITLE;
|
||||||
var indicator = 2;
|
var indicator = 2;
|
||||||
var checkTitle = function (fileDesc) {
|
var checkTitle = function(fileDesc) {
|
||||||
return fileDesc.title == title;
|
return fileDesc.title == title;
|
||||||
};
|
};
|
||||||
while (_.some(fileSystem, checkTitle)) {
|
while(_.some(fileSystem, checkTitle)) {
|
||||||
title = constants.DEFAULT_FILE_TITLE + indicator++;
|
title = constants.DEFAULT_FILE_TITLE + indicator++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ define([
|
|||||||
if(!isTemporary) {
|
if(!isTemporary) {
|
||||||
do {
|
do {
|
||||||
fileIndex = "file." + utils.randomString();
|
fileIndex = "file." + utils.randomString();
|
||||||
} while (_.has(fileSystem, fileIndex));
|
} while(_.has(fileSystem, fileIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
// syncIndex associations
|
// syncIndex associations
|
||||||
@ -155,17 +155,22 @@ define([
|
|||||||
$(".action-remove-file").click(function() {
|
$(".action-remove-file").click(function() {
|
||||||
fileMgr.deleteFile();
|
fileMgr.deleteFile();
|
||||||
});
|
});
|
||||||
|
var titleEditing;
|
||||||
$fileTitleElt.click(function() {
|
$fileTitleElt.click(function() {
|
||||||
if(window.viewerMode === true) {
|
if(window.viewerMode === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$fileTitleElt.addClass('hide');
|
$fileTitleElt.addClass('hide');
|
||||||
var fileTitleInput = $fileTitleInputElt.removeClass('hide');
|
var fileTitleInput = $fileTitleInputElt.removeClass('hide');
|
||||||
|
titleEditing = true;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
fileTitleInput.focus().get(0).select();
|
fileTitleInput.focus().get(0).select();
|
||||||
}, 10);
|
}, 10);
|
||||||
});
|
});
|
||||||
function applyTitle() {
|
function applyTitle() {
|
||||||
|
if(!titleEditing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$fileTitleInputElt.addClass('hide');
|
$fileTitleInputElt.addClass('hide');
|
||||||
$fileTitleElt.removeClass('hide');
|
$fileTitleElt.removeClass('hide');
|
||||||
var title = $.trim($fileTitleInputElt.val());
|
var title = $.trim($fileTitleInputElt.val());
|
||||||
@ -176,12 +181,17 @@ define([
|
|||||||
}
|
}
|
||||||
$fileTitleInputElt.val(fileDesc.title);
|
$fileTitleInputElt.val(fileDesc.title);
|
||||||
$editorElt.focus();
|
$editorElt.focus();
|
||||||
|
titleEditing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileTitleInputElt.blur(function() {
|
$fileTitleInputElt.blur(function() {
|
||||||
|
setTimeout(function() {
|
||||||
applyTitle();
|
applyTitle();
|
||||||
}).keyup(function(e) {
|
}, 0);
|
||||||
|
}).keypress(function(e) {
|
||||||
if(e.keyCode == 13) {
|
if(e.keyCode == 13) {
|
||||||
applyTitle();
|
applyTitle();
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
if(e.keyCode == 27) {
|
if(e.keyCode == 27) {
|
||||||
$fileTitleInputElt.val("");
|
$fileTitleInputElt.val("");
|
||||||
|
Loading…
Reference in New Issue
Block a user