Add support for maximizing alternate greeting editor (#4413) * Add support for maximizing alternate greeting editor. * Use a common style class --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -7152,7 +7152,10 @@ | |||
| 7152 | <details open> | 7152 | <details open> |
| 7153 | <summary> | 7153 | <summary> |
| 7154 | <div class="title_restorable"> | 7154 | <div class="title_restorable"> |
| 7155 | <strong><span data-i18n="Alternate Greeting #">Alternate Greeting #</span><span class="greeting_index"></span></strong> | 7155 | <div class="flex-container alignItemsCenter"> |
| 7156 | <strong><span data-i18n="Alternate Greeting #">Alternate Greeting #</span><span class="greeting_index"></span></strong> | ||
| 7157 | <i class="editor_maximize fa-solid fa-maximize right_menu_button" title="Expand the editor" data-i18n="[title]Expand the editor"></i> | ||
| 7158 | </div> | ||
| 7156 | <div class="menu_button menu_button_icon delete_alternate_greeting"> | 7159 | <div class="menu_button menu_button_icon delete_alternate_greeting"> |
| 7157 | <i class="fa-solid fa-trash-alt"></i> | 7160 | <i class="fa-solid fa-trash-alt"></i> |
| 7158 | <span data-i18n="Delete">Delete</span> | 7161 | <span data-i18n="Delete">Delete</span> |
| @@ -8266,11 +8266,14 @@ function openAlternateGreetings() { | |||
| 8266 | */ | 8266 | */ |
| 8267 | function addAlternateGreeting(template, greeting, index, getArray, popup) { | 8267 | function addAlternateGreeting(template, greeting, index, getArray, popup) { |
| 8268 | const greetingBlock = $('#alternate_greeting_form_template .alternate_greeting').clone(); | 8268 | const greetingBlock = $('#alternate_greeting_form_template .alternate_greeting').clone(); |
| 8269 | greetingBlock.find('.alternate_greeting_text').on('input', async function () { | 8269 | greetingBlock.find('.alternate_greeting_text') |
| 8270 | const value = $(this).val(); | 8270 | .attr('id', `alternate_greeting_${index}`) |
| 8271 | const array = getArray(); | 8271 | .on('input', async function () { |
| 8272 | array[index] = value; | 8272 | const value = $(this).val(); |
| 8273 | }).val(greeting); | 8273 | const array = getArray(); |
| 8274 | array[index] = value; | ||
| 8275 | }).val(greeting); | ||
| 8276 | greetingBlock.find('.editor_maximize').attr('data-for', `alternate_greeting_${index}`); | ||
| 8274 | greetingBlock.find('.greeting_index').text(index + 1); | 8277 | greetingBlock.find('.greeting_index').text(index + 1); |
| 8275 | greetingBlock.find('.delete_alternate_greeting').on('click', async function (event) { | 8278 | greetingBlock.find('.delete_alternate_greeting').on('click', async function (event) { |
| 8276 | event.preventDefault(); | 8279 | event.preventDefault(); |
| @@ -1924,7 +1924,10 @@ export function initChatUtilities() { | |||
| 1924 | embedMessageFile(messageId, messageBlock); | 1924 | embedMessageFile(messageId, messageBlock); |
| 1925 | }); | 1925 | }); |
| 1926 | 1926 | ||
| 1927 | $(document).on('click', '.editor_maximize', async function () { | 1927 | $(document).on('click', '.editor_maximize', async function (e) { |
| 1928 | e.preventDefault(); | ||
| 1929 | e.stopPropagation(); | ||
| 1930 | |||
| 1928 | const broId = $(this).attr('data-for'); | 1931 | const broId = $(this).attr('data-for'); |
| 1929 | const bro = $(`#${broId}`); | 1932 | const bro = $(`#${broId}`); |
| 1930 | const contentEditable = bro.is('[contenteditable]'); | 1933 | const contentEditable = bro.is('[contenteditable]'); |