Start of WI card text select fix_text

This commit is contained in:
ebolam
2022-10-14 11:33:13 -04:00
parent 022b729cd9
commit dffbd63f46
4 changed files with 62 additions and 15 deletions

View File

@@ -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,

View File

@@ -1031,15 +1031,22 @@ td.server_vars {
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 {

View File

@@ -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);

View File

@@ -1,6 +1,7 @@
<div draggable="true" class="world_info_card" id="world_info_">
<div class="world_info_title_area">
<h4 draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_title_" class="world_info_title"></h4>
<h4 draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_title_"
class="world_info_title" onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');"></h4>
<span id="world_info_delete_" class="world_info_delete">X</span>
</div>
<div class="world_info_tag_area" id="world_info_toggle_area_">
@@ -24,28 +25,46 @@
<table>
<tr>
<td>Type:</td>
<td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_type_" onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)"></td>
<td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_type_"
onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)"
onfocus="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');"></td>
</tr>
<tr>
<td>Name:</td>
<td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_name_" onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)"></td>
<td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_name_"
onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)"
onfocus="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');"></td>
</tr>
</table>
</div>
<div id="world_info_basic_text_">
Text:
<textarea draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_entry_text_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height='60px';"></textarea>
<textarea draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_entry_text_" class="world_info_text fullwidth" oninput="autoResize(this, 60)"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');autoResize(this, 60)" onblur="this.parentElement.parentElement.setAttribute('draggable', 'true');this.style.height='60px';"></textarea>
</div>
<div id="world_info_entry_w++_" class="hidden">
<input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="Type"/><input type=text placeholder="Name"/>
<input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="Type"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'false');"/>
<input type=text placeholder="Name"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'false');"/>
<div>
<input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="attribute"/><input type=text placeholder="value"/>
<input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="attribute"
onfocus="this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');"/>
<input type=text placeholder="value"/>
</div>
</div>
<div>
Comment:
<textarea draggable="true" ondragstartondragstart="event.preventDefault();event.stopPropagation();" rows=1 id="world_info_comment_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height='60px';"></textarea>
<textarea draggable="true" ondragstartondragstart="event.preventDefault();event.stopPropagation();" rows=1 id="world_info_comment_"
class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height='60px';"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'false');"></textarea>
</div>
</div>
<div id="empty_bias">