Fix using escape to save edits

This commit is contained in:
Gnome Ann 2021-09-27 22:56:12 -04:00
parent b39f12b60b
commit 3297c27fcd
1 changed files with 5 additions and 4 deletions

View File

@ -74,6 +74,7 @@ var empty_chunks = new Set();
var mutation_observer = null;
var gametext_bound = false;
var saved_prompt = "...";
var override_focusout = false;
var sman_allow_delete = false;
var sman_allow_rename = false;
@ -733,9 +734,8 @@ function chunkOnKeyDown(event) {
// Make escape commit the changes (Originally we had Enter here to but its not required and nicer for users if we let them type freely
// You can add the following after 27 if you want it back to committing on enter : || (!event.shiftKey && event.keyCode == 13)
if(event.keyCode == 27) {
setTimeout(function () {
event.target.blur();
}, 5);
override_focusout = true;
game_text.blur();
event.preventDefault();
return;
}
@ -974,7 +974,8 @@ function chunkOnPaste(event) {
// This gets run every time the caret moves in the editor
function chunkOnSelectionChange(event) {
if(!gametext_bound) {
if(!gametext_bound || override_focusout) {
override_focusout = false;
return;
}
setTimeout(function() {