diff --git a/gensettings.py b/gensettings.py index 3923e4f5..c7277638 100644 --- a/gensettings.py +++ b/gensettings.py @@ -556,7 +556,7 @@ gensettingstf = [ "UI_V2_Only": True, "uitype": "toggle", "unit": "bool", - "label": "Experimental Items", + "label": "Experimental UI", "id": "experimental_features", "min": 0, "max": 1, diff --git a/static/koboldai.css b/static/koboldai.css index 2b94873e..43d5f43b 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -1030,16 +1030,23 @@ td.server_vars { .world_info_card.used_in_game { border: 2px outset var(--wi_card_border_color_to_ai); } + +.world_info_card input { + user-select: text; +} .world_info_title_area { display: grid; margin-left: 2px; grid-template-areas: "title delete"; grid-template-columns: auto 20px; + user-select: text; } .world_info_title { grid-area: title; + user-select: text; + -moz-user-select:text; } .world_info_delete { diff --git a/static/koboldai.js b/static/koboldai.js index eccbbdc4..0c090ff4 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -1639,8 +1639,9 @@ function world_info_entry(data) { title.setAttribute("uid", data.uid); title.setAttribute("original_text", data.title); title.setAttribute("contenteditable", true); - title.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + title.ondragstart=function() {event.preventDefault();event.stopPropagation();}; title.onblur = function () { + this.parentElement.parentElement.setAttribute('draggable', 'true'); if (this.textContent != this.getAttribute("original_text")) { world_info_data[this.getAttribute('uid')]['title'] = this.textContent; send_world_info(this.getAttribute('uid')); @@ -1739,7 +1740,10 @@ function world_info_entry(data) { label.textContent = "\xa0\xa0\xa0\xa0Attribute: "; attribute_area.append(label); input = document.createElement("input"); - input.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + input.setAttribute("contenteditable", true); + input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; + input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; + input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.value = attribute; input.type = "text"; input.setAttribute("uid", data.uid); @@ -1757,8 +1761,11 @@ function world_info_entry(data) { value_area.append(label); input = document.createElement("input"); input.type = "text"; - input.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + input.setAttribute("contenteditable", true); + input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; input.onchange = function() {do_wpp(this.parentElement.parentElement)}; + input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; + input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.value = value; input.setAttribute("uid", data.uid); input.setAttribute("data_type", "value"); @@ -1772,7 +1779,10 @@ function world_info_entry(data) { value_area.append(label); input = document.createElement("input"); input.type = "text"; - input.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + input.setAttribute("contenteditable", true); + input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; + input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; + input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.setAttribute("uid", data.uid); input.setAttribute("data_type", "value"); input.id = "wpp_"+data.uid+"_value_"+i+"_blank"; @@ -1790,7 +1800,10 @@ function world_info_entry(data) { input = document.createElement("input"); input.value = ""; input.type = "text"; - input.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + input.setAttribute("contenteditable", true); + input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; + input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; + input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.setAttribute("uid", data.uid); input.setAttribute("value_num", i); input.setAttribute("data_type", "attribute"); @@ -3044,7 +3057,7 @@ function add_tags(tags, data) { tag_item = document.createElement("span"); tag_item.classList.add("tag"); tag_item.setAttribute("draggable", true); - tag_item.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + tag_item.ondragstart=function() {event.preventDefault();event.stopPropagation();}; x = document.createElement("span"); x.textContent = "x "; x.classList.add("delete_icon"); @@ -3061,7 +3074,9 @@ function add_tags(tags, data) { text.setAttribute("uid", data.uid); text.setAttribute("tag", tag); text.id = "world_info_tags_text_"+data.uid+"_"+tag; + text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.onblur = function () { + this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); for (var i = 0; i < world_info_data[this.getAttribute('uid')]['key'].length; i++) { if (world_info_data[this.getAttribute('uid')]['key'][i] == this.getAttribute("tag")) { world_info_data[this.getAttribute('uid')]['key'][i] = this.textContent; @@ -3087,7 +3102,9 @@ function add_tags(tags, data) { text.setAttribute("uid", data.uid); text.setAttribute("contenteditable", true); text.id = "world_info_tags_text_"+data.uid+"_blank"; + text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.onblur = function () { + this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); if (this.textContent != "") { //console.log(this.textContent); on_new_wi_item = this.id; @@ -3110,7 +3127,7 @@ function add_secondary_tags(tags, data) { for (tag of data.keysecondary) { tag_item = document.createElement("span"); tag_item.classList.add("tag"); - tag_item.ondragstart=function() {console.log("Killing drag");event.preventDefault();event.stopPropagation();}; + tag_item.ondragstart=function() {event.preventDefault();event.stopPropagation();}; x = document.createElement("span"); x.textContent = "x "; x.classList.add("delete_icon"); @@ -3127,7 +3144,9 @@ function add_secondary_tags(tags, data) { text.setAttribute("uid", data.uid); text.setAttribute("tag", tag); text.id = "world_info_secondtags_text_"+data.uid+"_"+tag; + text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.onblur = function () { + this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); for (var i = 0; i < world_info_data[this.getAttribute('uid')]['keysecondary'].length; i++) { if (world_info_data[this.getAttribute('uid')]['keysecondary'][i] == this.getAttribute("tag")) { world_info_data[this.getAttribute('uid')]['keysecondary'][i] = this.textContent; @@ -3153,7 +3172,9 @@ function add_secondary_tags(tags, data) { text.setAttribute("uid", data.uid); text.setAttribute("contenteditable", true); text.id = "world_info_secondtags_text_"+data.uid+"_blank"; + text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.onblur = function () { + this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); if (this.textContent != "") { on_new_wi_item = this.id; world_info_data[this.getAttribute('uid')]['keysecondary'].push(this.textContent); diff --git a/templates/templates.html b/templates/templates.html index d6773128..92e17520 100644 --- a/templates/templates.html +++ b/templates/templates.html @@ -1,6 +1,7 @@
Type: | -+ | |
Name: | -+ |