Merge pull request #3765 from SillyTavern/feat/wi-content-expando Add expand editor for WI content
Signed| @@ -6086,9 +6086,12 @@ | |||
| 6086 | <label for="content "> | 6086 | <label for="content "> |
| 6087 | <small> | 6087 | <small> |
| 6088 | <span class="alignitemscenter flex-container flexnowrap wide100p justifySpaceBetween"> | 6088 | <span class="alignitemscenter flex-container flexnowrap wide100p justifySpaceBetween"> |
| 6089 | <span data-i18n="Content" class="alignitemscenter flex-container flexNoGap mdhotkey_location"> | 6089 | <span class="alignitemscenter flex-container"> |
| 6090 | <span data-i18n="Content" class="mdhotkey_location"> | ||
| 6090 | Content | 6091 | Content |
| 6091 | </span> | 6092 | </span> |
| 6093 | <i class="editor_maximize fa-solid fa-maximize right_menu_button" title="Expand the editor" data-i18n="[title]Expand the editor"></i> | ||
| 6094 | </span> | ||
| 6092 | <span> | 6095 | <span> |
| 6093 | (<span data-i18n="extension_token_counter">Tokens:</span> <span class="world_entry_form_token_counter" data-first-run="true">counting...</span>) | 6096 | (<span data-i18n="extension_token_counter">Tokens:</span> <span class="world_entry_form_token_counter" data-first-run="true">counting...</span>) |
| 6094 | <span class="world_entry_form_uid_value" data-first-run="true"></span> | 6097 | <span class="world_entry_form_uid_value" data-first-run="true"></span> |
| @@ -2680,8 +2680,10 @@ export async function getWorldEntry(name, data, entry) { | |||
| 2680 | $(counter).text(numberOfTokens); | 2680 | $(counter).text(numberOfTokens); |
| 2681 | }, debounce_timeout.relaxed); | 2681 | }, debounce_timeout.relaxed); |
| 2682 | 2682 | ||
| 2683 | const contentInputId = `world_entry_content_${entry.uid}`; | ||
| 2683 | const contentInput = template.find('textarea[name="content"]'); | 2684 | const contentInput = template.find('textarea[name="content"]'); |
| 2684 | contentInput.data('uid', entry.uid); | 2685 | contentInput.data('uid', entry.uid); |
| 2686 | contentInput.attr('id', contentInputId); | ||
| 2685 | contentInput.on('input', async function (_, { skipCount } = {}) { | 2687 | contentInput.on('input', async function (_, { skipCount } = {}) { |
| 2686 | const uid = $(this).data('uid'); | 2688 | const uid = $(this).data('uid'); |
| 2687 | const value = $(this).val(); | 2689 | const value = $(this).val(); |
| @@ -2698,7 +2700,9 @@ export async function getWorldEntry(name, data, entry) { | |||
| 2698 | countTokensDebounced(counter, value); | 2700 | countTokensDebounced(counter, value); |
| 2699 | }); | 2701 | }); |
| 2700 | contentInput.val(entry.content).trigger('input', { skipCount: true }); | 2702 | contentInput.val(entry.content).trigger('input', { skipCount: true }); |
| 2701 | //initScrollHeight(contentInput); | 2703 | |
| 2704 | const contentExpandButton = template.find('.editor_maximize'); | ||
| 2705 | contentExpandButton.attr('data-for', contentInputId); | ||
| 2702 | 2706 | ||
| 2703 | template.find('.inline-drawer-toggle').on('click', function () { | 2707 | template.find('.inline-drawer-toggle').on('click', function () { |
| 2704 | if (counter.data('first-run')) { | 2708 | if (counter.data('first-run')) { |