mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Allow expanding contenteditables
This commit is contained in:
@@ -3085,8 +3085,9 @@
|
|||||||
<select id="context_presets" data-preset-manager-for="context" class="flex1 text_pole"></select>
|
<select id="context_presets" data-preset-manager-for="context" class="flex1 text_pole"></select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="context_story_string">
|
<label for="context_story_string" class="flex-container">
|
||||||
<small data-i18n="Story String">Story String</small>
|
<small data-i18n="Story String">Story String</small>
|
||||||
|
<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>
|
||||||
</label>
|
</label>
|
||||||
<div contenteditable="true" id="context_story_string" class="text_pole textarea_compact"></div>
|
<div contenteditable="true" id="context_story_string" class="text_pole textarea_compact"></div>
|
||||||
<div class="flex-container">
|
<div class="flex-container">
|
||||||
@@ -3236,8 +3237,9 @@
|
|||||||
<input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i"></input>
|
<input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i"></input>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label for="instruct_system_prompt" class="flex-container">
|
||||||
<small data-i18n="System Prompt">System Prompt</small>
|
<small data-i18n="System Prompt">System Prompt</small>
|
||||||
|
<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>
|
||||||
</label>
|
</label>
|
||||||
<div contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact"></div>
|
<div contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1416,6 +1416,7 @@ jQuery(function () {
|
|||||||
$(document).on('click', '.editor_maximize', function () {
|
$(document).on('click', '.editor_maximize', function () {
|
||||||
const broId = $(this).attr('data-for');
|
const broId = $(this).attr('data-for');
|
||||||
const bro = $(`#${broId}`);
|
const bro = $(`#${broId}`);
|
||||||
|
const contentEditable = bro.is('[contenteditable]');
|
||||||
const withTab = $(this).attr('data-tab');
|
const withTab = $(this).attr('data-tab');
|
||||||
|
|
||||||
if (!bro.length) {
|
if (!bro.length) {
|
||||||
@@ -1427,11 +1428,16 @@ jQuery(function () {
|
|||||||
wrapper.classList.add('height100p', 'wide100p', 'flex-container');
|
wrapper.classList.add('height100p', 'wide100p', 'flex-container');
|
||||||
wrapper.classList.add('flexFlowColumn', 'justifyCenter', 'alignitemscenter');
|
wrapper.classList.add('flexFlowColumn', 'justifyCenter', 'alignitemscenter');
|
||||||
const textarea = document.createElement('textarea');
|
const textarea = document.createElement('textarea');
|
||||||
textarea.value = String(bro.val());
|
textarea.value = String(contentEditable ? bro[0].innerText : bro.val());
|
||||||
textarea.classList.add('height100p', 'wide100p', 'maximized_textarea');
|
textarea.classList.add('height100p', 'wide100p', 'maximized_textarea');
|
||||||
bro.hasClass('monospace') && textarea.classList.add('monospace');
|
bro.hasClass('monospace') && textarea.classList.add('monospace');
|
||||||
textarea.addEventListener('input', function () {
|
textarea.addEventListener('input', function () {
|
||||||
|
if (contentEditable) {
|
||||||
|
bro[0].innerText = textarea.value;
|
||||||
|
bro.trigger('input');
|
||||||
|
} else {
|
||||||
bro.val(textarea.value).trigger('input');
|
bro.val(textarea.value).trigger('input');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
wrapper.appendChild(textarea);
|
wrapper.appendChild(textarea);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user