Add in fix for copy/paste of game text pulling in html span elements causing sync errors.

This commit is contained in:
ebolam
2023-01-10 08:03:43 -05:00
parent 33dc4aa749
commit 70a25ed6db

View File

@@ -556,6 +556,11 @@ function do_story_text_updates(action) {
item = document.createElement("span");
item.id = 'Selected Text Chunk '+action.id;
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);
//need to find the closest element
next_id = action.id+1;
@@ -6539,6 +6544,11 @@ function addMessage(author, content, actionId, afterMsgEl=null, time=null) {
// Insertion location
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"]});