Allow expanding contenteditables

37bee430757def6d7c106ea45f72ec3c637361b4

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

2 files changed, +11 -3Showing whitespace changes
public/index.html+4 -2
@@ -3085,8 +3085,9 @@
3085 <select id="context_presets" data-preset-manager-for="context" class="flex1 text_pole"></select>3085 <select id="context_presets" data-preset-manager-for="context" class="flex1 text_pole"></select>
3086 </div>3086 </div>
3087 <div>3087 <div>
3088 <label for="context_story_string">3088 <label for="context_story_string" class="flex-container">
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 </label>3091 </label>
3091 <div contenteditable="true" id="context_story_string" class="text_pole textarea_compact"></div>3092 <div contenteditable="true" id="context_story_string" class="text_pole textarea_compact"></div>
3092 <div class="flex-container">3093 <div class="flex-container">
@@ -3236,8 +3237,9 @@
3236 <input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i"></input>3237 <input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i"></input>
3237 </div>3238 </div>
3238 <div>3239 <div>
3239 <label>3240 <label for="instruct_system_prompt" class="flex-container">
3240 <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>
3241 </label>3243 </label>
3242 <div contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact"></div>3244 <div contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact"></div>
3243 </div>3245 </div>
public/scripts/chats.js+7 -1
@@ -1416,6 +1416,7 @@ jQuery(function () {
1416 $(document).on('click', '.editor_maximize', function () {1416 $(document).on('click', '.editor_maximize', function () {
1417 const broId = $(this).attr('data-for');1417 const broId = $(this).attr('data-for');
1418 const bro = $(`#${broId}`);1418 const bro = $(`#${broId}`);
1419 const contentEditable = bro.is('[contenteditable]');
1419 const withTab = $(this).attr('data-tab');1420 const withTab = $(this).attr('data-tab');
14201421
1421 if (!bro.length) {1422 if (!bro.length) {
@@ -1427,11 +1428,16 @@ jQuery(function () {
1427 wrapper.classList.add('height100p', 'wide100p', 'flex-container');1428 wrapper.classList.add('height100p', 'wide100p', 'flex-container');
1428 wrapper.classList.add('flexFlowColumn', 'justifyCenter', 'alignitemscenter');1429 wrapper.classList.add('flexFlowColumn', 'justifyCenter', 'alignitemscenter');
1429 const textarea = document.createElement('textarea');1430 const textarea = document.createElement('textarea');
1430 textarea.value = String(bro.val());1431 textarea.value = String(contentEditable ? bro[0].innerText : bro.val());
1431 textarea.classList.add('height100p', 'wide100p', 'maximized_textarea');1432 textarea.classList.add('height100p', 'wide100p', 'maximized_textarea');
1432 bro.hasClass('monospace') && textarea.classList.add('monospace');1433 bro.hasClass('monospace') && textarea.classList.add('monospace');
1433 textarea.addEventListener('input', function () {1434 textarea.addEventListener('input', function () {
1435 if (contentEditable) {
1436 bro[0].innerText = textarea.value;
1437 bro.trigger('input');
1438 } else {
1434 bro.val(textarea.value).trigger('input');1439 bro.val(textarea.value).trigger('input');
1440 }
1435 });1441 });
1436 wrapper.appendChild(textarea);1442 wrapper.appendChild(textarea);
14371443