Merge pull request #2786 from SillyTavern/textarea-revert-nyxFix initial reversion commit

758c90be0036a5fd3398f2fe448e8cff8fc6035f

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
9 files changed, +79 -70Ignore whitespace
public/css/st-tailwind.css+5 -2
@@ -494,12 +494,15 @@
494}494}
495495
496input:disabled,496input:disabled,
497textarea:disabled,497textarea:disabled {
498#AdvancedFormatting .disabled {
499 cursor: not-allowed;498 cursor: not-allowed;
500 filter: brightness(0.5);499 filter: brightness(0.5);
501}500}
502501
502#AdvancedFormatting .disabled {
503 filter: brightness(0.5);
504}
505
503.debug-red {506.debug-red {
504 border: 1px solid red !important;507 border: 1px solid red !important;
505}508}
public/index.html+21 -21
@@ -3089,14 +3089,14 @@
3089 <small data-i18n="Story String">Story String</small>3089 <small data-i18n="Story String">Story String</small>
3090 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="context_story_string" title="Expand the editor" data-i18n="[title]Expand the editor"></i>3090 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="context_story_string" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
3091 </label>3091 </label>
3092 <div contenteditable="true" id="context_story_string" class="text_pole textarea_compact"></div>3092 <textarea id="context_story_string" class="text_pole textarea_compact autoSetHeight"></textarea>
3093 <div class="flex-container">3093 <div class="flex-container">
3094 <div class="flex1">3094 <div class="flex1">
3095 <label for="context_example_separator">3095 <label for="context_example_separator">
3096 <small data-i18n="Example Separator">Example Separator</small>3096 <small data-i18n="Example Separator">Example Separator</small>
3097 </label>3097 </label>
3098 <div>3098 <div>
3099 <div contenteditable="true" id="context_example_separator" class="text_pole textarea_compact"></div>3099 <textarea id="context_example_separator" class="text_pole textarea_compact autoSetHeight"></textarea>
3100 </div>3100 </div>
3101 </div>3101 </div>
3102 <div class="flex1">3102 <div class="flex1">
@@ -3104,7 +3104,7 @@
3104 <small data-i18n="Chat Start">Chat Start</small>3104 <small data-i18n="Chat Start">Chat Start</small>
3105 </label>3105 </label>
3106 <div>3106 <div>
3107 <div contenteditable="true" id="context_chat_start" class="text_pole textarea_compact"></div>3107 <textarea id="context_chat_start" class="text_pole textarea_compact autoSetHeight"></textarea>
3108 </div>3108 </div>
3109 </div>3109 </div>
3110 </div>3110 </div>
@@ -3182,7 +3182,7 @@
3182 </small>3182 </small>
3183 </div>3183 </div>
3184 <div>3184 <div>
3185 <div contenteditable="true" id="custom_stopping_strings" class="text_pole textarea_compact monospace"></div>3185 <textarea id="custom_stopping_strings" class="text_pole textarea_compact monospace autoSetHeight"></textarea>
3186 </div>3186 </div>
3187 <label class="checkbox_label" for="custom_stopping_strings_macro">3187 <label class="checkbox_label" for="custom_stopping_strings_macro">
3188 <input id="custom_stopping_strings_macro" type="checkbox" checked>3188 <input id="custom_stopping_strings_macro" type="checkbox" checked>
@@ -3241,7 +3241,7 @@
3241 <small data-i18n="System Prompt">System Prompt</small>3241 <small data-i18n="System Prompt">System Prompt</small>
3242 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="instruct_system_prompt" title="Expand the editor" data-i18n="[title]Expand the editor"></i>3242 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="instruct_system_prompt" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
3243 </label>3243 </label>
3244 <div contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact"></div>3244 <textarea id="instruct_system_prompt" class="text_pole textarea_compact autoSetHeight"></textarea>
3245 </div>3245 </div>
32463246
3247 <div>3247 <div>
@@ -3323,7 +3323,7 @@
3323 </span>3323 </span>
3324 </small>3324 </small>
3325 <div>3325 <div>
3326 <div contenteditable="true" id="start_reply_with" class="text_pole textarea_compact"></div>3326 <textarea id="start_reply_with" class="text_pole textarea_compact autoSetHeight"></textarea>
3327 </div>3327 </div>
3328 <label class="checkbox_label" for="chat-show-reply-prefix-checkbox">3328 <label class="checkbox_label" for="chat-show-reply-prefix-checkbox">
3329 <input id="chat-show-reply-prefix-checkbox" type="checkbox" />3329 <input id="chat-show-reply-prefix-checkbox" type="checkbox" />
@@ -3353,7 +3353,7 @@
3353 <small data-i18n="System Prompt Prefix">System Prompt Prefix</small>3353 <small data-i18n="System Prompt Prefix">System Prompt Prefix</small>
3354 </label>3354 </label>
3355 <div>3355 <div>
3356 <div contenteditable="true" id="instruct_system_sequence_prefix" class="text_pole textarea_compact"></div>3356 <textarea id="instruct_system_sequence_prefix" class="text_pole textarea_compact autoSetHeight"></textarea>
3357 </div>3357 </div>
3358 </div>3358 </div>
3359 <div class="flexAuto" title="Inserted after a System prompt." data-i18n="[title]Inserted after a System prompt.">3359 <div class="flexAuto" title="Inserted after a System prompt." data-i18n="[title]Inserted after a System prompt.">
@@ -3361,38 +3361,38 @@
3361 <small data-i18n="System Prompt Suffix">System Prompt Suffix</small>3361 <small data-i18n="System Prompt Suffix">System Prompt Suffix</small>
3362 </label>3362 </label>
3363 <div>3363 <div>
3364 <div contenteditable="true" id="instruct_system_sequence_suffix" class="text_pole wide100p textarea_compact"></div>3364 <textarea id="instruct_system_sequence_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3365 </div>3365 </div>
3366 </div>3366 </div>
3367 </div>3367 </div>
3368 <div class="flex-container">3368 <div class="flex-container">
3369 <div class="flexAuto" title="Inserted before a User message and as a last prompt line when impersonating." data-i18n="[title]Inserted before a User message and as a last prompt line when impersonating.">3369 <div class="flexAuto" title="Inserted before a User message and as a last prompt line when impersonating." data-i18n="[title]Inserted before a User message and as a last prompt line when impersonating.">
3370 <small data-i18n="User Prefix">User Message Prefix</small>3370 <small data-i18n="User Prefix">User Message Prefix</small>
3371 <div contenteditable="true" id="instruct_input_sequence" class="text_pole textarea_compact"></div>3371 <textarea id="instruct_input_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
3372 </div>3372 </div>
3373 <div class="flexAuto" title="Inserted after a User message." data-i18n="[title]Inserted after a User message.">3373 <div class="flexAuto" title="Inserted after a User message." data-i18n="[title]Inserted after a User message.">
3374 <small data-i18n="User Suffix">User Message Suffix</small>3374 <small data-i18n="User Suffix">User Message Suffix</small>
3375 <div contenteditable="true" id="instruct_input_suffix" class="text_pole wide100p textarea_compact"></div>3375 <textarea id="instruct_input_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3376 </div>3376 </div>
3377 </div>3377 </div>
3378 <div class="flex-container">3378 <div class="flex-container">
3379 <div class="flexAuto" title="Inserted before an Assistant message and as a last prompt line when generating an AI reply." data-i18n="[title]Inserted before an Assistant message and as a last prompt line when generating an AI reply.">3379 <div class="flexAuto" title="Inserted before an Assistant message and as a last prompt line when generating an AI reply." data-i18n="[title]Inserted before an Assistant message and as a last prompt line when generating an AI reply.">
3380 <small data-i18n="Assistant Prefix">Assistant Message Prefix</small>3380 <small data-i18n="Assistant Prefix">Assistant Message Prefix</small>
3381 <div contenteditable="true" id="instruct_output_sequence" class="text_pole wide100p textarea_compact"></div>3381 <textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3382 </div>3382 </div>
3383 <div class="flexAuto" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message.">3383 <div class="flexAuto" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message.">
3384 <small data-i18n="Assistant Suffix">Assistant Message Suffix</small>3384 <small data-i18n="Assistant Suffix">Assistant Message Suffix</small>
3385 <div contenteditable="true" id="instruct_output_suffix" class="text_pole wide100p textarea_compact"></div>3385 <textarea id="instruct_output_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3386 </div>3386 </div>
3387 </div>3387 </div>
3388 <div class="flex-container">3388 <div class="flex-container">
3389 <div class="flexAuto" id="instruct_system_sequence_block" title="Inserted before a System (added by slash commands or extensions) message." data-i18n="[title]Inserted before a System (added by slash commands or extensions) message.">3389 <div class="flexAuto" id="instruct_system_sequence_block" title="Inserted before a System (added by slash commands or extensions) message." data-i18n="[title]Inserted before a System (added by slash commands or extensions) message.">
3390 <small data-i18n="System Prefix">System Message Prefix</small>3390 <small data-i18n="System Prefix">System Message Prefix</small>
3391 <div contenteditable="true" id="instruct_system_sequence" class="text_pole textarea_compact"></div>3391 <textarea id="instruct_system_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
3392 </div>3392 </div>
3393 <div class="flexAuto" id="instruct_system_suffix_block" title="Inserted after a System message." data-i18n="[title]Inserted after a System message.">3393 <div class="flexAuto" id="instruct_system_suffix_block" title="Inserted after a System message." data-i18n="[title]Inserted after a System message.">
3394 <small data-i18n="System Suffix">System Message Suffix</small>3394 <small data-i18n="System Suffix">System Message Suffix</small>
3395 <div contenteditable="true" id="instruct_system_suffix" class="text_pole wide100p textarea_compact"></div>3395 <textarea id="instruct_system_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3396 </div>3396 </div>
3397 </div>3397 </div>
3398 <div class="flexBasis100p" title="If enabled, System Sequences will be the same as User Sequences." data-i18n="[title]If enabled, System Sequences will be the same as User Sequences.">3398 <div class="flexBasis100p" title="If enabled, System Sequences will be the same as User Sequences." data-i18n="[title]If enabled, System Sequences will be the same as User Sequences.">
@@ -3408,37 +3408,37 @@
3408 <div class="flex-container">3408 <div class="flex-container">
3409 <div class="flexAuto" title="Inserted before the first Assistant's message." data-i18n="[title]Inserted before the first Assistant's message.">3409 <div class="flexAuto" title="Inserted before the first Assistant's message." data-i18n="[title]Inserted before the first Assistant's message.">
3410 <small data-i18n="First Assistant Prefix">First Assistant Prefix</small>3410 <small data-i18n="First Assistant Prefix">First Assistant Prefix</small>
3411 <div contenteditable="true" id="instruct_first_output_sequence" class="text_pole textarea_compact"></div>3411 <textarea id="instruct_first_output_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
3412 </div>3412 </div>
3413 <div class="flexAuto" title="Inserted before the last Assistant's message or as a last prompt line when generating an AI reply (except a neutral/system role)." data-i18n="[title]instruct_last_output_sequence">3413 <div class="flexAuto" title="Inserted before the last Assistant's message or as a last prompt line when generating an AI reply (except a neutral/system role)." data-i18n="[title]instruct_last_output_sequence">
3414 <small data-i18n="Last Assistant Prefix">Last Assistant Prefix</small>3414 <small data-i18n="Last Assistant Prefix">Last Assistant Prefix</small>
3415 <div contenteditable="true" id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact"></div>3415 <textarea id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3416 </div>3416 </div>
3417 </div>3417 </div>
3418 <div class="flex-container">3418 <div class="flex-container">
3419 <div class="flexAuto" title="Inserted before the first User's message." data-i18n="[title]Inserted before the first User's message.">3419 <div class="flexAuto" title="Inserted before the first User's message." data-i18n="[title]Inserted before the first User's message.">
3420 <small data-i18n="First User Prefix">First User Prefix</small>3420 <small data-i18n="First User Prefix">First User Prefix</small>
3421 <div contenteditable="true" id="instruct_first_input_sequence" class="text_pole textarea_compact"></div>3421 <textarea id="instruct_first_input_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
3422 </div>3422 </div>
3423 <div class="flexAuto" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence">3423 <div class="flexAuto" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence">
3424 <small data-i18n="Last User Prefix">Last User Prefix</small>3424 <small data-i18n="Last User Prefix">Last User Prefix</small>
3425 <div contenteditable="true" id="instruct_last_input_sequence" class="text_pole wide100p textarea_compact"></div>3425 <textarea id="instruct_last_input_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
3426 </div>3426 </div>
3427 </div>3427 </div>
3428 <div class="flex-container">3428 <div class="flex-container">
3429 <div class="flexAuto" title="Will be inserted as a last prompt line when using system/neutral generation." data-i18n="[title]Will be inserted as a last prompt line when using system/neutral generation.">3429 <div class="flexAuto" title="Will be inserted as a last prompt line when using system/neutral generation." data-i18n="[title]Will be inserted as a last prompt line when using system/neutral generation.">
3430 <small data-i18n="System Instruction Prefix">System Instruction Prefix</small>3430 <small data-i18n="System Instruction Prefix">System Instruction Prefix</small>
3431 <div contenteditable="true" id="instruct_last_system_sequence" class="text_pole textarea_compact"></div>3431 <textarea id="instruct_last_system_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
3432 </div>3432 </div>
3433 <div class="flexAuto" title="If a stop sequence is generated, everything past it will be removed from the output (inclusive)." data-i18n="[title]If a stop sequence is generated, everything past it will be removed from the output (inclusive).">3433 <div class="flexAuto" title="If a stop sequence is generated, everything past it will be removed from the output (inclusive)." data-i18n="[title]If a stop sequence is generated, everything past it will be removed from the output (inclusive).">
3434 <small data-i18n="Stop Sequence">Stop Sequence</small>3434 <small data-i18n="Stop Sequence">Stop Sequence</small>
3435 <div contenteditable="true" id="instruct_stop_sequence" class="text_pole textarea_compact"></div>3435 <textarea id="instruct_stop_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
3436 </div>3436 </div>
3437 </div>3437 </div>
3438 <div class="flex-container">3438 <div class="flex-container">
3439 <div class="flexAuto" title="Will be inserted at the start of the chat history if it doesn't start with a User message." data-i18n="[title]Will be inserted at the start of the chat history if it doesn't start with a User message.">3439 <div class="flexAuto" title="Will be inserted at the start of the chat history if it doesn't start with a User message." data-i18n="[title]Will be inserted at the start of the chat history if it doesn't start with a User message.">
3440 <small data-i18n="User Filler Message">User Filler Message</small>3440 <small data-i18n="User Filler Message">User Filler Message</small>
3441 <div contenteditable="true" id="instruct_user_alignment_message" class="text_pole textarea_compact"></div>3441 <textarea id="instruct_user_alignment_message" class="text_pole textarea_compact autoSetHeight"></textarea>
3442 </div>3442 </div>
3443 </div>3443 </div>
3444 </div>3444 </div>
public/script.js+12 -8
@@ -10616,10 +10616,12 @@ jQuery(async function () {
10616 }10616 }
1061710617
10618 // Set the height of "autoSetHeight" textareas within the drawer to their scroll height10618 // Set the height of "autoSetHeight" textareas within the drawer to their scroll height
10619 $(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(async function () {10619 if (!CSS.supports('field-sizing', 'content')) {
10620 await resetScrollHeight($(this));10620 $(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(async function () {
10621 return;10621 await resetScrollHeight($(this));
10622 });10622 return;
10623 });
10624 }
1062310625
10624 } else if (drawerWasOpenAlready) { //to close manually10626 } else if (drawerWasOpenAlready) { //to close manually
10625 icon.toggleClass('closedIcon openIcon');10627 icon.toggleClass('closedIcon openIcon');
@@ -10691,10 +10693,12 @@ jQuery(async function () {
10691 $(this).closest('.inline-drawer').find('.inline-drawer-content').stop().slideToggle();10693 $(this).closest('.inline-drawer').find('.inline-drawer-content').stop().slideToggle();
1069210694
10693 // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height10695 // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height
10694 $(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(async function () {10696 if (!CSS.supports('field-sizing', 'content')) {
10695 await resetScrollHeight($(this));10697 $(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(async function () {
10696 return;10698 await resetScrollHeight($(this));
10697 });10699 return;
10700 });
10701 }
10698 });10702 });
1069910703
10700 $(document).on('click', '.inline-drawer-maximize', function () {10704 $(document).on('click', '.inline-drawer-maximize', function () {
public/scripts/group-chats.js+10 -6
@@ -1491,9 +1491,11 @@ function select_group_chats(groupId, skipAnimation) {
1491 }1491 }
14921492
1493 // Toggle textbox sizes, as input events have not fired here1493 // Toggle textbox sizes, as input events have not fired here
1494 $('#rm_group_chats_block .autoSetHeight').each(element => {1494 if (!CSS.supports('field-sizing', 'content')) {
1495 resetScrollHeight(element);1495 $('#rm_group_chats_block .autoSetHeight').each(element => {
1496 });1496 resetScrollHeight(element);
1497 });
1498 }
14971499
1498 eventSource.emit('groupSelected', { detail: { id: openGroupId, group: group } });1500 eventSource.emit('groupSelected', { detail: { id: openGroupId, group: group } });
1499}1501}
@@ -1964,9 +1966,11 @@ function doCurMemberListPopout() {
1964}1966}
19651967
1966jQuery(() => {1968jQuery(() => {
1967 $(document).on('input', '#rm_group_chats_block .autoSetHeight', function () {1969 if (!CSS.supports('field-sizing', 'content')) {
1968 resetScrollHeight($(this));1970 $(document).on('input', '#rm_group_chats_block .autoSetHeight', function () {
1969 });1971 resetScrollHeight($(this));
1972 });
1973 }
19701974
1971 $(document).on('click', '.group_select', function () {1975 $(document).on('click', '.group_select', function () {
1972 const groupId = $(this).attr('chid') || $(this).attr('grid') || $(this).data('id');1976 const groupId = $(this).attr('chid') || $(this).attr('grid') || $(this).data('id');
public/scripts/instruct-mode.js+11 -11
@@ -7,7 +7,7 @@ import {
7 power_user,7 power_user,
8 context_presets,8 context_presets,
9} from './power-user.js';9} from './power-user.js';
10import { regexFromString } from './utils.js';10import { regexFromString, resetScrollHeight } from './utils.js';
1111
12/**12/**
13 * @type {any[]} Instruct mode presets.13 * @type {any[]} Instruct mode presets.
@@ -95,11 +95,14 @@ export async function loadInstructMode(data) {
95 if (control.isCheckbox) {95 if (control.isCheckbox) {
96 $element.prop('checked', power_user.instruct[control.property]);96 $element.prop('checked', power_user.instruct[control.property]);
97 } else {97 } else {
98 $element[0].innerText = (power_user.instruct[control.property]);98 $element.val(power_user.instruct[control.property]);
99 }99 }
100100
101 $element.on('input', async function () {101 $element.on('input', async function () {
102 power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].innerText;102 power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this).val();
103 if (!CSS.supports('field-sizing', 'content')) {
104 await resetScrollHeight($(this));
105 }
103 saveSettingsDebounced();106 saveSettingsDebounced();
104 });107 });
105108
@@ -108,9 +111,6 @@ export async function loadInstructMode(data) {
108 }111 }
109 });112 });
110113
111 $('#instruct_system_sequence').css('height', 'auto');
112 $('#instruct_system_suffix').css('height', 'auto');
113
114 instruct_presets.forEach((preset) => {114 instruct_presets.forEach((preset) => {
115 const name = preset.name;115 const name = preset.name;
116 const option = document.createElement('option');116 const option = document.createElement('option');
@@ -611,13 +611,13 @@ jQuery(() => {
611 if (state) {611 if (state) {
612 $('#instruct_system_sequence_block').addClass('disabled');612 $('#instruct_system_sequence_block').addClass('disabled');
613 $('#instruct_system_suffix_block').addClass('disabled');613 $('#instruct_system_suffix_block').addClass('disabled');
614 $('#instruct_system_sequence').prop('contenteditable', false);614 $('#instruct_system_sequence').prop('readOnly', true);
615 $('#instruct_system_suffix').prop('contenteditable', false);615 $('#instruct_system_suffix').prop('readOnly', true);
616 } else {616 } else {
617 $('#instruct_system_sequence_block').removeClass('disabled');617 $('#instruct_system_sequence_block').removeClass('disabled');
618 $('#instruct_system_suffix_block').removeClass('disabled');618 $('#instruct_system_suffix_block').removeClass('disabled');
619 $('#instruct_system_sequence').prop('contenteditable', true);619 $('#instruct_system_sequence').prop('readOnly', false);
620 $('#instruct_system_suffix').prop('contenteditable', true);620 $('#instruct_system_suffix').prop('readOnly', false);
621 }621 }
622622
623 });623 });
@@ -663,7 +663,7 @@ jQuery(() => {
663 if (control.isCheckbox) {663 if (control.isCheckbox) {
664 $element.prop('checked', power_user.instruct[control.property]).trigger('input');664 $element.prop('checked', power_user.instruct[control.property]).trigger('input');
665 } else {665 } else {
666 $element[0].innerText = (power_user.instruct[control.property]);666 $element.val(power_user.instruct[control.property]);
667 $element.trigger('input');667 $element.trigger('input');
668 }668 }
669 }669 }
public/scripts/openai.js+5 -3
@@ -5281,9 +5281,11 @@ $(document).ready(async function () {
5281 saveSettingsDebounced();5281 saveSettingsDebounced();
5282 });5282 });
52835283
5284 $(document).on('input', '#openai_settings .autoSetHeight', function () {5284 if (!CSS.supports('field-sizing', 'content')) {
5285 resetScrollHeight($(this));5285 $(document).on('input', '#openai_settings .autoSetHeight', function () {
5286 });5286 resetScrollHeight($(this));
5287 });
5288 }
52875289
5288 if (!isMobile()) {5290 if (!isMobile()) {
5289 $('#model_openrouter_select').select2({5291 $('#model_openrouter_select').select2({
public/scripts/power-user.js+10 -7
@@ -1740,20 +1740,23 @@ async function loadContextSettings() {
1740 if (control.isCheckbox) {1740 if (control.isCheckbox) {
1741 $element.prop('checked', power_user.context[control.property]);1741 $element.prop('checked', power_user.context[control.property]);
1742 } else {1742 } else {
1743 $element[0].innerText = power_user.context[control.property];1743 $element.val(power_user.context[control.property]);
1744 }1744 }
1745 console.log(`Setting ${$element.prop('id')} to ${power_user.context[control.property]}`);1745 console.log(`Setting ${$element.prop('id')} to ${power_user.context[control.property]}`);
17461746
1747 // If the setting already exists, no need to duplicate it1747 // If the setting already exists, no need to duplicate it
1748 // TODO: Maybe check the power_user object for the setting instead of a flag?1748 // TODO: Maybe check the power_user object for the setting instead of a flag?
1749 $element.on('input keyup', async function () {1749 $element.on('input', async function () {
1750 const value = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].innerText;1750 const value = control.isCheckbox ? !!$(this).prop('checked') : $(this).val();
1751 if (control.isGlobalSetting) {1751 if (control.isGlobalSetting) {
1752 power_user[control.property] = value;1752 power_user[control.property] = value;
1753 } else {1753 } else {
1754 power_user.context[control.property] = value;1754 power_user.context[control.property] = value;
1755 }1755 }
17561756 console.log(`Setting ${$element.prop('id')} to ${value}`);
1757 if (!CSS.supports('field-sizing', 'content')) {
1758 await resetScrollHeight($(this));
1759 }
1757 saveSettingsDebounced();1760 saveSettingsDebounced();
1758 });1761 });
1759 });1762 });
@@ -1793,7 +1796,7 @@ async function loadContextSettings() {
1793 .prop('checked', control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property])1796 .prop('checked', control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property])
1794 .trigger('input');1797 .trigger('input');
1795 } else {1798 } else {
1796 $element[0].innerText = (control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]);1799 $element.val(control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]);
1797 $element.trigger('input');1800 $element.trigger('input');
1798 }1801 }
1799 }1802 }
@@ -3096,7 +3099,7 @@ $(document).ready(() => {
3096 });3099 });
30973100
3098 $('#start_reply_with').on('input', function () {3101 $('#start_reply_with').on('input', function () {
3099 power_user.user_prompt_bias = String($(this)[0].innerText);3102 power_user.user_prompt_bias = String($(this).val());
3100 saveSettingsDebounced();3103 saveSettingsDebounced();
3101 });3104 });
31023105
@@ -3628,7 +3631,7 @@ $(document).ready(() => {
3628 });3631 });
36293632
3630 $('#custom_stopping_strings').on('input', function () {3633 $('#custom_stopping_strings').on('input', function () {
3631 power_user.custom_stopping_strings = String($(this)[0].innerText).trim();3634 power_user.custom_stopping_strings = String($(this).val()).trim();
3632 saveSettingsDebounced();3635 saveSettingsDebounced();
3633 });3636 });
36343637
public/scripts/utils.js+3 -1
@@ -2028,7 +2028,9 @@ export function toggleDrawer(drawer, expand = true) {
2028 }2028 }
20292029
2030 // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height2030 // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height
2031 content.querySelectorAll('textarea.autoSetHeight').forEach(resetScrollHeight);2031 if (!CSS.supports('field-sizing', 'content')) {
2032 content.querySelectorAll('textarea.autoSetHeight').forEach(resetScrollHeight);
2033 }
2032}2034}
20332035
2034export async function fetchFaFile(name) {2036export async function fetchFaFile(name) {
public/style.css+2 -11
@@ -1176,6 +1176,7 @@ textarea {
1176textarea.autoSetHeight {1176textarea.autoSetHeight {
1177 max-height: 50vh;1177 max-height: 50vh;
1178 max-height: 50dvh;1178 max-height: 50dvh;
1179 field-sizing: content;
1179}1180}
11801181
1181input,1182input,
@@ -5454,16 +5455,6 @@ body:not(.movingUI) .drawer-content.maximized {
5454 opacity: 0.7;5455 opacity: 0.7;
5455}5456}
54565457
5457#advanced-formatting-button div[contenteditable] {5458#AdvancedFormatting .autoSetHeight {
5458 overflow-wrap: anywhere;5459 overflow-wrap: anywhere;
5459 max-height: 50vh;
5460 max-height: 50dvh;
5461 resize: vertical;
5462 overflow: auto;
5463 min-height: 1.8em;
5464 white-space: preserve-breaks;
5465}5460}
5466
5467div[contenteditable] br {
5468 display: revert;
5469}
5469 \ No newline at end of file \ No newline at end of file