mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-01-22 13:19:52 +01:00
Fix using escape to save edits
This commit is contained in:
parent
b39f12b60b
commit
3297c27fcd
@ -74,6 +74,7 @@ var empty_chunks = new Set();
|
|||||||
var mutation_observer = null;
|
var mutation_observer = null;
|
||||||
var gametext_bound = false;
|
var gametext_bound = false;
|
||||||
var saved_prompt = "...";
|
var saved_prompt = "...";
|
||||||
|
var override_focusout = false;
|
||||||
var sman_allow_delete = false;
|
var sman_allow_delete = false;
|
||||||
var sman_allow_rename = 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
|
// 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)
|
// 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) {
|
if(event.keyCode == 27) {
|
||||||
setTimeout(function () {
|
override_focusout = true;
|
||||||
event.target.blur();
|
game_text.blur();
|
||||||
}, 5);
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -974,7 +974,8 @@ function chunkOnPaste(event) {
|
|||||||
|
|
||||||
// This gets run every time the caret moves in the editor
|
// This gets run every time the caret moves in the editor
|
||||||
function chunkOnSelectionChange(event) {
|
function chunkOnSelectionChange(event) {
|
||||||
if(!gametext_bound) {
|
if(!gametext_bound || override_focusout) {
|
||||||
|
override_focusout = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user