diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 7af6557..a45990e 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -127,6 +127,9 @@ "placeholder_please_input": { "message": "Please enter" }, + "placeholder_prompt_input_tips":{ + "message":"Pressing tab can move to the next cell, and pressing shift + tab can move back to the previous cell." + }, "placeholder_supper_prompt_desc": { "message": "Using {{}} can represent a field. You can set the field name and default value in {{}}, for example: {{ role || chef }}." }, diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json index 06a0ad6..b9957c3 100644 --- a/_locales/ja/messages.json +++ b/_locales/ja/messages.json @@ -127,6 +127,9 @@ "placeholder_please_input": { "message": "入力してください" }, + "placeholder_prompt_input_tips":{ + "message":"タブを押すと次のセルに移動できます。Shift + タブを押すと前のセルに戻ることができます。" + }, "placeholder_supper_prompt_desc": { "message": "{{}} を使用すると、フィールドを表すことができます。{{}} 内にフィールド名とデフォルト値を設定できます。例えば、{{ ロール || シェフ }}。" }, diff --git a/_locales/ko/messages.json b/_locales/ko/messages.json index 7c43029..33e4b71 100644 --- a/_locales/ko/messages.json +++ b/_locales/ko/messages.json @@ -127,6 +127,9 @@ "placeholder_please_input": { "message": "입력해주세요" }, + "placeholder_prompt_input_tips":{ + "message":"Tab을 누르면 다음 셀로 이동할 수 있으며, Shift + Tab을 누르면 이전 셀로 이동할 수 있습니다." + }, "placeholder_supper_prompt_desc": { "message": "{{}}를 사용하면 필드를 나타낼 수 있습니다. {{}} 내에 필드 이름과 기본값을 설정할 수 있습니다. 예를 들어, {{ 역할 || 요리사 }} 입니다." }, diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index 1d9f0ec..33e7e9f 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -127,6 +127,9 @@ "placeholder_please_input": { "message": "请输入" }, + "placeholder_prompt_input_tips":{ + "message":"按下 Tab 可以移动到下一个单元格,按下 Shift + Tab 可以移回上一个单元格。" + }, "placeholder_supper_prompt_desc": { "message": "使用{{}}可以代表一个字段,{{}}里面可以设置字段名称和默认值,例如:{{ 角色 || 厨师 }}。" }, diff --git a/_locales/zh_TW/messages.json b/_locales/zh_TW/messages.json index 33a847c..8f42e1a 100644 --- a/_locales/zh_TW/messages.json +++ b/_locales/zh_TW/messages.json @@ -127,6 +127,9 @@ "placeholder_please_input": { "message": "請輸入" }, + "placeholder_prompt_input_tips":{ + "message":"按下 tab 可移動到下一格,按下 shift + tab 可移動回上一格。" + }, "placeholder_supper_prompt_desc": { "message": "使用{{}}可以代表一個欄位,{{}}裡面可以設定欄位名稱和預設值,例如: {{ 角色 || 廚師 }}。" }, diff --git a/format.html b/format.html index e336bd4..588a98e 100644 --- a/format.html +++ b/format.html @@ -1,145 +1,333 @@ - + \ No newline at end of file diff --git a/js/content.js b/js/content.js index a478f64..4add139 100644 --- a/js/content.js +++ b/js/content.js @@ -1578,17 +1578,17 @@ function findGroupAndIndex(promptId) { border-bottom: 1px solid #ccc; padding-right:4px; } - .super-table-form { + .scroll-table-form { width: 100%; border-collapse: collapse; margin:0px; } - .super-table-form thead tr { + .scroll-table-form thead tr { position: sticky; top: 0; z-index:999; } - .dark .super-table-form thead th { + .dark .scroll-table-form thead th { background-color: #757575; } .dark .super-prompt-id{ @@ -1635,385 +1635,347 @@ function findGroupAndIndex(promptId) { // 設定模版的表單視窗 HTML const formDialogHTML = ` - + + + `; // 快捷鍵提示視窗 HTML const keyboardShortcutHTML = `
-
+
@@ -2581,7 +2543,7 @@ function findGroupAndIndex(promptId) {
-
+
@@ -2756,7 +2718,6 @@ function findGroupAndIndex(promptId) { const settingsDialogOkBtn = document.querySelector("#dialog2-ok"); const settingsDialogCancelBtn = document.querySelector("#dialog2-cancel"); const settingsTableForm = settingsDialog.querySelector("#table-form"); - const settingsTableForm2 = settingsDialog.querySelector("#table-form2"); // Shortcut Key Hint const shortcutKeyHintDialog = document.getElementById("dialog3"); @@ -2815,9 +2776,6 @@ function findGroupAndIndex(promptId) { let isComposing = false; - /** 1:form or 2:form2 */ - let currentSettingFormType; - /** 1:form or 2:form2 .... 6:form6 */ let currentSuperSettingFormType; @@ -2961,9 +2919,6 @@ function findGroupAndIndex(promptId) { W. ${i18n( "menu_prompt_template_settings" )} - S. ${i18n( - "menu_prompt_template2_settings" - )}E. ${i18n( "menu_reply_message_settings" )} @@ -2990,22 +2945,16 @@ function findGroupAndIndex(promptId) { menuItems[0].addEventListener("click", (event) => { event.stopPropagation(); chatgptDropdownContentEl.classList.remove("show"); - showSettingsDialog(1); + showSettingsDialog(); }); menuItems[1].addEventListener("click", (event) => { - event.stopPropagation(); - chatgptDropdownContentEl.classList.remove("show"); - showSettingsDialog(2); - }); - - menuItems[2].addEventListener("click", (event) => { event.stopPropagation(); chatgptDropdownContentEl.classList.remove("show"); showQuickReplySettingsDialog(); }); - menuItems[3].addEventListener("click", (event) => { + menuItems[2].addEventListener("click", (event) => { event.stopPropagation(); chatgptDropdownContentEl.classList.remove("show"); openExportAndImportDialog(); @@ -3368,7 +3317,7 @@ function findGroupAndIndex(promptId) { event.key.toLocaleLowerCase() === "w" ) { event.preventDefault(); - showSettingsDialog(1); + showSettingsDialog(); return; } @@ -3385,7 +3334,7 @@ function findGroupAndIndex(promptId) { event.key.toLocaleLowerCase() === "s" ) { event.preventDefault(); - showSettingsDialog(2); + showSettingsDialog(); return; } @@ -3852,10 +3801,8 @@ function findGroupAndIndex(promptId) { } questionDialogEditBtn.addEventListener("click", () => { - const groupSize = 5; - const group = Math.floor((questionId - 1) / groupSize) + 1; questionDialog.style.display = 'none'; - showSettingsDialog(group, questionId - 1); + showSettingsDialog(questionId - 1); }); questionDialogTextarea.addEventListener("keydown", (event) => { @@ -3919,34 +3866,17 @@ function findGroupAndIndex(promptId) { } // ------------ 設定視窗相關 程式碼 ------------ - function showSettingsDialog(formType, focusElementIndex = null) { - currentSettingFormType = formType; + function showSettingsDialog(focusElementIndex = null) { settingsDialog.style.display = "flex"; - settingsTableForm.style.display = "none"; - settingsTableForm2.style.display = "none"; - - if (currentSettingFormType === 1) { - settingsTableForm.style.display = "table"; - settingsTableForm.style.width = "100%"; - } else { - settingsTableForm2.style.display = "table"; - settingsTableForm2.style.width = "100%"; - } - const btnTextInputElements = document.querySelectorAll(".btnTextInput"); const prefixInputElements = document.querySelectorAll(".prefixInput"); const suffixInputElements = document.querySelectorAll(".suffixInput"); const promptSlideElements = document.querySelectorAll(".promptSlide"); let startIndex = 0; - let endIndex = 5; - - if (formType == 2) { - startIndex = 5; - endIndex = 10; - } + let endIndex = 10; for (let index = startIndex; index < endIndex; index++) { btnTextInputElements[index].value = promptList[index].text; @@ -3961,9 +3891,7 @@ function findGroupAndIndex(promptId) { if (focusElementIndex) { btnTextInputElements[focusElementIndex].focus(); } else { - currentSettingFormType === 1 - ? btnTextInputElements[0].focus() - : btnTextInputElements[5].focus(); + btnTextInputElements[0].focus() } } @@ -3974,12 +3902,7 @@ function findGroupAndIndex(promptId) { const promptSlideElements = document.querySelectorAll(".promptSlide"); let startIndex = 0; - let endIndex = 5; - - if (currentSettingFormType == 2) { - startIndex = 5; - endIndex = 10; - } + let endIndex = 10; const previousPromptList = JSON.parse(JSON.stringify(promptList)); @@ -4119,8 +4042,9 @@ function findGroupAndIndex(promptId) { // ------------ super 樣板視窗 程式碼 ------------ - const showSuperPromptTextareaPlaceholder = i18n("placeholder_please_input"); - + const PlaceholderPromptInputTips = i18n("placeholder_prompt_input_tips"); + const PlaceholderPromptTextarea = i18n('placeholder_prompt_textarea') + function showSuperPromptDialog() { superPromptDialog.style.display = "flex"; @@ -4160,7 +4084,7 @@ function findGroupAndIndex(promptId) {
+ }" class="super-prompt-text superPromptText" placeholder="${PlaceholderPromptInputTips}">${fieldValue}
`; @@ -4174,7 +4098,7 @@ function findGroupAndIndex(promptId) { const textarea = table.querySelectorAll('.superPromptText')[0]; textarea.style = "width:100%;height:380px;" - textarea.placeholder = i18n('placeholder_prompt_textarea'); + textarea.placeholder = PlaceholderPromptTextarea; textarea.addEventListener("keydown", (event) => { // prevent submitting blank on enter @@ -5156,48 +5080,17 @@ function findGroupAndIndex(promptId) { const tableFormLastTabindexElement = tableFormTabindexElements[tableFormTabindexElements.length - 1]; - // tableForm2 tabindexElements - let tableForm2TabindexElements = settingsTableForm2.querySelectorAll( - "input, textarea, button" - ); - - tableForm2TabindexElements = [ - ...tableForm2TabindexElements, - settingsDialogOkBtn, - settingsDialogCancelBtn, - ]; - - const tableForm2FirstTabindexElement = tableForm2TabindexElements[0]; - const tableForm2LastTabindexElement = - tableForm2TabindexElements[tableForm2TabindexElements.length - 1]; - // settingsDialog keydown event settingsDialog.addEventListener("keydown", function (e) { - if (settingsTableForm.style.display === "table") { - if (e.key === "Tab" && !e.shiftKey) { - if (document.activeElement === tableFormLastTabindexElement) { - e.preventDefault(); - tableFormFirstTabindexElement.focus(); - } - } else if (e.key === "Tab" && e.shiftKey) { - if (document.activeElement === tableFormFirstTabindexElement) { - e.preventDefault(); - tableFormLastTabindexElement.focus(); - } + if (e.key === "Tab" && !e.shiftKey) { + if (document.activeElement === tableFormLastTabindexElement) { + e.preventDefault(); + tableFormFirstTabindexElement.focus(); } - } - - if (settingsTableForm2.style.display === "table") { - if (e.key === "Tab" && !e.shiftKey) { - if (document.activeElement === tableForm2LastTabindexElement) { - e.preventDefault(); - tableForm2FirstTabindexElement.focus(); - } - } else if (e.key === "Tab" && e.shiftKey) { - if (document.activeElement === tableForm2FirstTabindexElement) { - e.preventDefault(); - tableForm2LastTabindexElement.focus(); - } + } else if (e.key === "Tab" && e.shiftKey) { + if (document.activeElement === tableFormFirstTabindexElement) { + e.preventDefault(); + tableFormLastTabindexElement.focus(); } } });
#