mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
-fix WI entry 2ndary key height
-initHeight and resetHeight functions moved from WI to utils
This commit is contained in:
@ -2077,7 +2077,7 @@
|
|||||||
<h4>Keywords</h4>
|
<h4>Keywords</h4>
|
||||||
<h5>Seperate by commas</h5>
|
<h5>Seperate by commas</h5>
|
||||||
</label>
|
</label>
|
||||||
<textarea class="text_pole" name="key" rows="1" placeholder="" maxlength="250"></textarea>
|
<textarea class="text_pole" name="key" class="key" rows="1" placeholder="" maxlength="250"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="world_entry_form_control keysecondary">
|
<div class="world_entry_form_control keysecondary">
|
||||||
<label for="keysecondary">
|
<label for="keysecondary">
|
||||||
|
@ -162,3 +162,17 @@ export function restoreCaretPosition(element, position) {
|
|||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function resetScrollHeight(element) {
|
||||||
|
element.style.height = '';
|
||||||
|
element.style.height = (element.scrollHeight) + 3 + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function initScrollHeight(element) {
|
||||||
|
await delay(1);
|
||||||
|
const height = Number($(element).prop("scrollHeight") + 3);
|
||||||
|
console.log(`init height to ${height}`);
|
||||||
|
//console.log(element.style.height);
|
||||||
|
$(element).css("height", "");
|
||||||
|
$(element).css("height", `${height}px`);
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders } from "../script.js";
|
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders } from "../script.js";
|
||||||
import { download, debounce, delay } from "./utils.js";
|
import { download, debounce, delay, initScrollHeight, resetScrollHeight } from "./utils.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
world_info,
|
world_info,
|
||||||
@ -234,7 +234,16 @@ function appendWorldEntry(entry) {
|
|||||||
const keysecondary = $(this)
|
const keysecondary = $(this)
|
||||||
.closest(".world_entry")
|
.closest(".world_entry")
|
||||||
.find(".keysecondary");
|
.find(".keysecondary");
|
||||||
|
|
||||||
|
const keyPrimary = $(this)
|
||||||
|
.closest(".world_entry")
|
||||||
|
.find(".key");
|
||||||
|
|
||||||
|
const keyPrimaryHeight = $(keyPrimary).css('height');
|
||||||
|
|
||||||
|
keysecondary.css('height', keyPrimaryHeight) + 'px';
|
||||||
value ? keysecondary.show() : keysecondary.hide();
|
value ? keysecondary.show() : keysecondary.hide();
|
||||||
|
|
||||||
});
|
});
|
||||||
selectiveInput.prop("checked", entry.selective).trigger("input");
|
selectiveInput.prop("checked", entry.selective).trigger("input");
|
||||||
selectiveInput.siblings(".checkbox_fancy").click(function () {
|
selectiveInput.siblings(".checkbox_fancy").click(function () {
|
||||||
@ -319,20 +328,6 @@ function appendWorldEntry(entry) {
|
|||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resetScrollHeight(element) {
|
|
||||||
element.style.height = '';
|
|
||||||
element.style.height = (element.scrollHeight) + 3 + 'px';
|
|
||||||
}
|
|
||||||
|
|
||||||
async function initScrollHeight(element) {
|
|
||||||
await delay(1);
|
|
||||||
const height = Number($(element).prop("scrollHeight") + 3);
|
|
||||||
console.log(height);
|
|
||||||
//console.log(element.style.height);
|
|
||||||
$(element).css("height", "");
|
|
||||||
$(element).css("height", `${height}px`);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function deleteWorldInfoEntry(uid) {
|
async function deleteWorldInfoEntry(uid) {
|
||||||
if (!world_info_data || !("entries" in world_info_data)) {
|
if (!world_info_data || !("entries" in world_info_data)) {
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user