mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Add in fix for copy/paste of game text pulling in html span elements causing sync errors.
This commit is contained in:
@@ -556,6 +556,11 @@ function do_story_text_updates(action) {
|
|||||||
item = document.createElement("span");
|
item = document.createElement("span");
|
||||||
item.id = 'Selected Text Chunk '+action.id;
|
item.id = 'Selected Text Chunk '+action.id;
|
||||||
item.classList.add("rawtext");
|
item.classList.add("rawtext");
|
||||||
|
item.addEventListener("paste", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var text = e.clipboardData.getData("text/plain");
|
||||||
|
document.execCommand("insertHTML", false, text);
|
||||||
|
});
|
||||||
item.setAttribute("chunk", action.id);
|
item.setAttribute("chunk", action.id);
|
||||||
//need to find the closest element
|
//need to find the closest element
|
||||||
next_id = action.id+1;
|
next_id = action.id+1;
|
||||||
@@ -6539,6 +6544,11 @@ function addMessage(author, content, actionId, afterMsgEl=null, time=null) {
|
|||||||
// Insertion location
|
// Insertion location
|
||||||
insertionLocation,
|
insertionLocation,
|
||||||
);
|
);
|
||||||
|
message.addEventListener("paste", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var text = e.clipboardData.getData("text/plain");
|
||||||
|
document.execCommand("insertHTML", false, text);
|
||||||
|
});
|
||||||
|
|
||||||
const leftContainer = $e("div", message, {classes: ["chat-left-container"]});
|
const leftContainer = $e("div", message, {classes: ["chat-left-container"]});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user