mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix obliteration of quick reply slots on input
This commit is contained in:
@@ -113,17 +113,18 @@ async function moduleWorker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onQuickReplyNumberOfSlotsInput() {
|
async function onQuickReplyNumberOfSlotsInput() {
|
||||||
let numberOfSlots = Number($(this).val());
|
const $input = $('#quickReplyNumberOfSlots');
|
||||||
|
let numberOfSlots = Number($input.val());
|
||||||
|
|
||||||
if (isNaN(numberOfSlots)) {
|
if (isNaN(numberOfSlots)) {
|
||||||
numberOfSlots = defaultSettings.numberOfSlots;
|
numberOfSlots = defaultSettings.numberOfSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp min and max values (from input attributes)
|
// Clamp min and max values (from input attributes)
|
||||||
if (numberOfSlots < Number($(this).attr('min'))) {
|
if (numberOfSlots < Number($input.attr('min'))) {
|
||||||
numberOfSlots = Number($(this).attr('min'));
|
numberOfSlots = Number($input.attr('min'));
|
||||||
} else if (numberOfSlots > Number($(this).attr('max'))) {
|
} else if (numberOfSlots > Number($input.attr('max'))) {
|
||||||
numberOfSlots = Number($(this).attr('max'));
|
numberOfSlots = Number($input.attr('max'));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension_settings.quickReply.numberOfSlots = numberOfSlots;
|
extension_settings.quickReply.numberOfSlots = numberOfSlots;
|
||||||
@@ -184,12 +185,18 @@ jQuery(async () => {
|
|||||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-drawer-content">
|
<div class="inline-drawer-content">
|
||||||
<label class="checkbox_label">
|
<label class="checkbox_label marginBot10">
|
||||||
<input id="quickReplyEnabled" type="checkbox" />
|
<input id="quickReplyEnabled" type="checkbox" />
|
||||||
Enable Quick Replies
|
Enable Quick Replies
|
||||||
</label>
|
</label>
|
||||||
<label for="quickReplyNumberOfSlots">Number of slots:</label>
|
<label for="quickReplyNumberOfSlots">Number of slots:</label>
|
||||||
<input id="quickReplyNumberOfSlots" class="text_pole" type="number" min="1" max="100" value="" />
|
<div class="flex-container flexGap5 flexnowrap">
|
||||||
|
<input id="quickReplyNumberOfSlots" class="text_pole" type="number" min="1" max="100" value="" />
|
||||||
|
<div class="menu_button menu_button_icon" id="quickReplyNumberOfSlotsApply">
|
||||||
|
<div class="fa-solid fa-check"></div>
|
||||||
|
<span>Apply</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<small><i>Customize your Quick Replies:</i></small><br>
|
<small><i>Customize your Quick Replies:</i></small><br>
|
||||||
<div id="quickReplyContainer">
|
<div id="quickReplyContainer">
|
||||||
</div>
|
</div>
|
||||||
@@ -199,7 +206,7 @@ jQuery(async () => {
|
|||||||
$('#extensions_settings2').append(settingsHtml);
|
$('#extensions_settings2').append(settingsHtml);
|
||||||
|
|
||||||
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
||||||
$('#quickReplyNumberOfSlots').on('input', onQuickReplyNumberOfSlotsInput);
|
$('#quickReplyNumberOfSlotsApply').on('click', onQuickReplyNumberOfSlotsInput);
|
||||||
|
|
||||||
await loadSettings();
|
await loadSettings();
|
||||||
addQuickReplyBar();
|
addQuickReplyBar();
|
||||||
|
Reference in New Issue
Block a user