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>
|
||||
<h5>Seperate by commas</h5>
|
||||
</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 class="world_entry_form_control keysecondary">
|
||||
<label for="keysecondary">
|
||||
|
@ -162,3 +162,17 @@ export function restoreCaretPosition(element, position) {
|
||||
selection.removeAllRanges();
|
||||
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 { download, debounce, delay } from "./utils.js";
|
||||
import { download, debounce, delay, initScrollHeight, resetScrollHeight } from "./utils.js";
|
||||
|
||||
export {
|
||||
world_info,
|
||||
@ -234,7 +234,16 @@ function appendWorldEntry(entry) {
|
||||
const keysecondary = $(this)
|
||||
.closest(".world_entry")
|
||||
.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();
|
||||
|
||||
});
|
||||
selectiveInput.prop("checked", entry.selective).trigger("input");
|
||||
selectiveInput.siblings(".checkbox_fancy").click(function () {
|
||||
@ -319,20 +328,6 @@ function appendWorldEntry(entry) {
|
||||
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) {
|
||||
if (!world_info_data || !("entries" in world_info_data)) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user