From 074ec612eb48cc4bf7fc3004b3aa9f9a9a99dfa1 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sun, 27 Nov 2022 11:56:47 -0500 Subject: [PATCH] "Fix" for issue 318. We simply remove the selection as the selection event is giving us the parent of the action so we don't know which action is selected --- static/koboldai.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index fbfb92b7..4397194b 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -2905,8 +2905,13 @@ function select_game_text(event) { } //Check to see if new selection is a game chunk or something else - - if ((new_selected_game_chunk == null) || (((new_selected_game_chunk.id == "story_prompt") || (new_selected_game_chunk.id.slice(0,20) == "Selected Text Chunk ")) && (document.activeElement.isContentEditable))) { + if (new_selected_game_chunk == null) { + selected_game_chunk = null; + for (item of document.getElementsByClassName("editing")) { + item.classList.remove("editing"); + } + window.getSelection().removeAllRanges() + } else if (((new_selected_game_chunk.id == "story_prompt") || (new_selected_game_chunk.id.slice(0,20) == "Selected Text Chunk ")) && (document.activeElement.isContentEditable)) { if (new_selected_game_chunk != selected_game_chunk) { for (item of document.getElementsByClassName("editing")) { item.classList.remove("editing");