Fix for non-firefox drag and drop problems

Fix for WI box sizes auto-shrinking on click out
This commit is contained in:
ebolam
2022-10-11 19:25:26 -04:00
parent cad5462843
commit b00844db11
2 changed files with 7 additions and 6 deletions

View File

@@ -62,6 +62,7 @@ var control_held = false;
var actions_data = {};
var setup_wi_toggles = [];
var scroll_trigger_element = undefined; //undefined means not currently set. If set to null, it's disabled.
var drag_id = null;
const on_colab = $el("#on_colab").textContent == "true";
// name, desc, icon, func
@@ -3190,8 +3191,7 @@ function unhide_wi_folder(folder) {
}
function dragStart(e) {
e.dataTransfer.setData('text/plain', e.target.id);
//console.log(e.target.id);
drag_id = e.target.id;
e.dataTransfer.dropEffect = "move";
setTimeout(() => {
e.target.classList.add('hidden');
@@ -3242,7 +3242,7 @@ function drop(e) {
element.classList.remove('drag-over');
// get the draggable element
const id = e.dataTransfer.getData('text/plain');
const id = drag_id;
const draggable = document.getElementById(id);
//console.log(id);
dragged_id = draggable.id.split("_").slice(-1)[0];
@@ -3255,6 +3255,7 @@ function drop(e) {
socket.emit("wi_set_folder", {'dragged_id': dragged_id, 'folder': drop_id});
} else {
//insert the draggable element before the drop element
console.log(element);
element.parentElement.insertBefore(draggable, element);
draggable.classList.add("pulse");
@@ -3271,7 +3272,7 @@ function drop(e) {
function dragend(e) {
// get the draggable element
const id = e.dataTransfer.getData('text/plain');
const id = drag_id;
const draggable = document.getElementById(id);
// display the draggable element
draggable.classList.remove('hidden');

View File

@@ -35,7 +35,7 @@
</div>
<div id="world_info_basic_text_">
Text:
<textarea id="world_info_entry_text_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)"></textarea>
<textarea id="world_info_entry_text_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height=60;"></textarea>
</div>
<div id="world_info_entry_w++_" class="hidden">
<input type=text placeholder="Type"/><input type=text placeholder="Name"/>
@@ -45,7 +45,7 @@
</div>
<div>
Comment:
<textarea rows=1 id="world_info_comment_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)"></textarea>
<textarea rows=1 id="world_info_comment_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height=60;"></textarea>
</div>
</div>
<div id="empty_bias">