From 9a07a0dbabdb6b17b30755df65005c0d776b3cbd Mon Sep 17 00:00:00 2001 From: Minidoracat Date: Mon, 16 Jun 2025 14:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20=E7=A7=BB=E9=99=A4=E8=88=8A?= =?UTF-8?q?=E7=89=88=E5=9B=9E=E9=A5=8B=E5=88=86=E9=A0=81=E7=9B=B8=E9=97=9C?= =?UTF-8?q?=E7=A8=8B=E5=BC=8F=E7=A2=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/locales/en/translation.json | 1 - .../web/locales/zh-CN/translation.json | 1 - .../web/locales/zh-TW/translation.json | 1 - .../web/static/css/styles.css | 4 -- .../web/static/js/app.js | 47 +++++----------- .../web/static/js/modules/ui-manager.js | 28 ++++------ .../web/templates/feedback.html | 55 ++----------------- 7 files changed, 27 insertions(+), 110 deletions(-) diff --git a/src/mcp_feedback_enhanced/web/locales/en/translation.json b/src/mcp_feedback_enhanced/web/locales/en/translation.json index 8b51b80..aecb830 100644 --- a/src/mcp_feedback_enhanced/web/locales/en/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/en/translation.json @@ -12,7 +12,6 @@ "updateFailed": "Failed to update content, please manually refresh the page to view new AI work summary" }, "tabs": { - "feedback": "💬 Feedback", "summary": "📋 AI Summary", "commands": "⚡ Commands", "command": "⚡ Commands", diff --git a/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json b/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json index a2f072c..17a7402 100644 --- a/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json @@ -12,7 +12,6 @@ "updateFailed": "更新内容失败,请手动刷新页面以查看新的 AI 工作摘要" }, "tabs": { - "feedback": "💬 反馈", "summary": "📋 AI 总结", "commands": "⚡ 命令", "command": "⚡ 命令", diff --git a/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json b/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json index 4265cf3..b09336e 100644 --- a/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json @@ -17,7 +17,6 @@ "updateFailed": "更新內容失敗,請手動刷新頁面以查看新的 AI 工作摘要" }, "tabs": { - "feedback": "💬 回饋", "summary": "📋 AI 摘要", "commands": "⚡ 命令", "command": "⚡ 命令", diff --git a/src/mcp_feedback_enhanced/web/static/css/styles.css b/src/mcp_feedback_enhanced/web/static/css/styles.css index 6c5c773..afd2f5e 100644 --- a/src/mcp_feedback_enhanced/web/static/css/styles.css +++ b/src/mcp_feedback_enhanced/web/static/css/styles.css @@ -1380,7 +1380,6 @@ h3.combined-section-title { /* Placeholder 文本換行修復 - 全局樣式 */ textarea::placeholder, -#feedbackText::placeholder, #combinedFeedbackText::placeholder { white-space: pre-line !important; line-height: 1.4 !important; @@ -1391,7 +1390,6 @@ textarea::placeholder, /* 跨瀏覽器兼容的 placeholder 樣式 */ textarea::-webkit-input-placeholder, -#feedbackText::-webkit-input-placeholder, #combinedFeedbackText::-webkit-input-placeholder { white-space: pre-line !important; line-height: 1.4 !important; @@ -1401,7 +1399,6 @@ textarea::-webkit-input-placeholder, } textarea::-moz-placeholder, -#feedbackText::-moz-placeholder, #combinedFeedbackText::-moz-placeholder { white-space: pre-line !important; line-height: 1.4 !important; @@ -1411,7 +1408,6 @@ textarea::-moz-placeholder, } textarea:-ms-input-placeholder, -#feedbackText:-ms-input-placeholder, #combinedFeedbackText:-ms-input-placeholder { white-space: pre-line !important; line-height: 1.4 !important; diff --git a/src/mcp_feedback_enhanced/web/static/js/app.js b/src/mcp_feedback_enhanced/web/static/js/app.js index a50b5bd..57e9b17 100644 --- a/src/mcp_feedback_enhanced/web/static/js/app.js +++ b/src/mcp_feedback_enhanced/web/static/js/app.js @@ -468,9 +468,8 @@ promptModal: this.promptModal }); - // 初始化輸入按鈕到所有回饋輸入區域 + // 初始化輸入按鈕到回饋輸入區域 const inputContainers = [ - '#feedbackText', // 回饋分頁的 textarea '#combinedFeedbackText' // 工作區分頁的 textarea ]; this.promptInputButtons.init(inputContainers); @@ -925,17 +924,10 @@ * 收集回饋數據 */ FeedbackApp.prototype.collectFeedbackData = function() { - // 根據當前佈局模式獲取回饋內容 + // 獲取合併模式的回饋內容 let feedback = ''; - const layoutMode = this.settingsManager ? this.settingsManager.get('layoutMode') : 'combined-vertical'; - - if (layoutMode.startsWith('combined')) { - const combinedFeedbackInput = window.MCPFeedback.Utils.safeQuerySelector('#combinedFeedbackText'); - feedback = combinedFeedbackInput ? combinedFeedbackInput.value.trim() : ''; - } else { - const feedbackInput = window.MCPFeedback.Utils.safeQuerySelector('#feedbackText'); - feedback = feedbackInput ? feedbackInput.value.trim() : ''; - } + const combinedFeedbackInput = window.MCPFeedback.Utils.safeQuerySelector('#combinedFeedbackText'); + feedback = combinedFeedbackInput ? combinedFeedbackInput.value.trim() : ''; const images = this.imageHandler ? this.imageHandler.getImages() : []; @@ -1068,21 +1060,12 @@ FeedbackApp.prototype.focusInput = function() { console.log('🎯 執行聚焦輸入框...'); - // 根據當前佈局模式選擇正確的輸入框 - let targetInput = null; - const layoutMode = this.settingsManager ? this.settingsManager.get('layoutMode') : 'combined-vertical'; + // 聚焦到合併模式的輸入框 + const targetInput = window.MCPFeedback.Utils.safeQuerySelector('#combinedFeedbackText'); - if (layoutMode.startsWith('combined')) { - // 工作區模式:聚焦合併模式的輸入框 - targetInput = window.MCPFeedback.Utils.safeQuerySelector('#combinedFeedbackText'); - } else { - // 分離模式:聚焦回饋分頁的輸入框 - targetInput = window.MCPFeedback.Utils.safeQuerySelector('#feedbackText'); - - // 如果不在當前可見的分頁,先切換到回饋分頁 - if (this.uiManager && this.uiManager.getCurrentTab() !== 'feedback') { - this.uiManager.switchTab('feedback'); - } + // 確保在工作區分頁 + if (this.uiManager && this.uiManager.getCurrentTab() !== 'combined') { + this.uiManager.switchTab('combined'); } if (targetInput) { @@ -1459,14 +1442,10 @@ } // 設定提示詞內容到回饋輸入框 - const feedbackInputs = [ - window.MCPFeedback.Utils.safeQuerySelector('#feedbackText'), - window.MCPFeedback.Utils.safeQuerySelector('#combinedFeedbackText') - ].filter(function(input) { return input !== null; }); - - feedbackInputs.forEach(function(input) { - input.value = prompt.content; - }); + const feedbackInput = window.MCPFeedback.Utils.safeQuerySelector('#combinedFeedbackText'); + if (feedbackInput) { + feedbackInput.value = prompt.content; + } // 顯示自動提交訊息 const message = window.i18nManager ? diff --git a/src/mcp_feedback_enhanced/web/static/js/modules/ui-manager.js b/src/mcp_feedback_enhanced/web/static/js/modules/ui-manager.js index 966f197..15bc62c 100644 --- a/src/mcp_feedback_enhanced/web/static/js/modules/ui-manager.js +++ b/src/mcp_feedback_enhanced/web/static/js/modules/ui-manager.js @@ -74,7 +74,6 @@ this.tabContents = document.querySelectorAll('.tab-content'); // 回饋相關元素 - this.feedbackText = Utils.safeQuerySelector('#feedbackText'); this.submitBtn = Utils.safeQuerySelector('#submitBtn'); console.log('✅ UI 元素初始化完成'); @@ -257,15 +256,12 @@ * 更新回饋輸入框狀態 */ UIManager.prototype.updateFeedbackInputs = function() { - const feedbackInputs = [ - Utils.safeQuerySelector('#feedbackText'), - Utils.safeQuerySelector('#combinedFeedbackText') - ].filter(function(input) { return input !== null; }); - + const feedbackInput = Utils.safeQuerySelector('#combinedFeedbackText'); const canInput = this.feedbackState === Utils.CONSTANTS.FEEDBACK_WAITING; - feedbackInputs.forEach(function(input) { - input.disabled = !canInput; - }); + + if (feedbackInput) { + feedbackInput.disabled = !canInput; + } }; /** @@ -491,15 +487,11 @@ console.log('🔄 重置回饋表單...'); // 清空回饋輸入 - const feedbackInputs = [ - Utils.safeQuerySelector('#feedbackText'), - Utils.safeQuerySelector('#combinedFeedbackText') - ].filter(function(input) { return input !== null; }); - - feedbackInputs.forEach(function(input) { - input.value = ''; - input.disabled = false; - }); + const feedbackInput = Utils.safeQuerySelector('#combinedFeedbackText'); + if (feedbackInput) { + feedbackInput.value = ''; + feedbackInput.disabled = false; + } // 重新啟用提交按鈕 const submitButtons = [ diff --git a/src/mcp_feedback_enhanced/web/templates/feedback.html b/src/mcp_feedback_enhanced/web/templates/feedback.html index df0c52e..a55b117 100644 --- a/src/mcp_feedback_enhanced/web/templates/feedback.html +++ b/src/mcp_feedback_enhanced/web/templates/feedback.html @@ -483,13 +483,10 @@
- - - @@ -510,51 +507,7 @@ - -
-
- 請提供您對 AI 工作成果的回饋意見。您可以輸入文字回饋並上傳相關圖片。 -
- - {% set id = "feedbackStatusIndicator" %} - {% set status = "waiting" %} - {% set icon = "⏳" %} - {% set title = "等待回饋" %} - {% set message = "請提供您的回饋意見" %} - {% include 'components/status-indicator.html' %} - -
- - - -
- - -
- - -
- - - {% set id_prefix = "feedback" %} - {% include 'components/image-upload.html' %} -
@@ -598,8 +551,8 @@
- -
+ +