mirror of
https://github.com/Minidoracat/mcp-feedback-enhanced.git
synced 2025-07-27 02:22:26 +08:00
✨ 新增 ctrl + I 聚焦輸入框功能,感謝 @penn201500 提供方法
This commit is contained in:
parent
82a7473f85
commit
91e99a69fd
@ -19,7 +19,7 @@
|
||||
"description": "Please provide your feedback on the AI assistant's work. You can enter text feedback and upload related images.",
|
||||
"textLabel": "Text Feedback",
|
||||
"placeholder": "Please enter your feedback here...",
|
||||
"detailedPlaceholder": "Please enter your feedback here...\n\n💡 Tips:\n• Press Ctrl+Enter/Cmd+Enter (numpad supported) for quick submit\n• Press Ctrl+V/Cmd+V to paste clipboard images directly",
|
||||
"detailedPlaceholder": "Please enter your feedback here...\n\n💡 Tips:\n• Press Ctrl+Enter/Cmd+Enter (numpad supported) for quick submit\n• Press Ctrl+I/Cmd+I to focus input box\n• Press Ctrl+V/Cmd+V to paste clipboard images directly",
|
||||
"imageLabel": "Image Attachments (Optional)",
|
||||
"imageUploadText": "📎 Click to select images or drag and drop images here\nSupports PNG, JPG, JPEG, GIF, BMP, WebP formats",
|
||||
"submit": "✅ Submit Feedback",
|
||||
|
@ -19,7 +19,7 @@
|
||||
"description": "请提供您对 AI 工作成果的反馈意见。您可以输入文字反馈并上传相关图片。",
|
||||
"textLabel": "文字反馈",
|
||||
"placeholder": "请在这里输入您的反馈...",
|
||||
"detailedPlaceholder": "请在这里输入您的反馈...\n\n💡 小提示:\n• 按 Ctrl+Enter/Cmd+Enter (支持数字键盘) 可快速提交\n• 按 Ctrl+V/Cmd+V 可直接粘贴剪贴板图片",
|
||||
"detailedPlaceholder": "请在这里输入您的反馈...\n\n💡 小提示:\n• 按 Ctrl+Enter/Cmd+Enter (支持数字键盘) 可快速提交\n• 按 Ctrl+I/Cmd+I 可聚焦输入框\n• 按 Ctrl+V/Cmd+V 可直接粘贴剪贴板图片",
|
||||
"imageLabel": "图片附件(可选)",
|
||||
"imageUploadText": "📎 点击选择图片或拖放图片到此处\n支持 PNG、JPG、JPEG、GIF、BMP、WebP 等格式",
|
||||
"submit": "✅ 提交反馈",
|
||||
|
@ -24,7 +24,7 @@
|
||||
"description": "請提供您對 AI 工作成果的回饋意見。您可以輸入文字回饋並上傳相關圖片。",
|
||||
"textLabel": "文字回饋",
|
||||
"placeholder": "請在這裡輸入您的回饋...",
|
||||
"detailedPlaceholder": "請在這裡輸入您的回饋...\n\n💡 小提示:\n• 按 Ctrl+Enter/Cmd+Enter (支援數字鍵盤) 可快速提交\n• 按 Ctrl+V/Cmd+V 可直接貼上剪貼板圖片",
|
||||
"detailedPlaceholder": "請在這裡輸入您的回饋...\n\n💡 小提示:\n• 按 Ctrl+Enter/Cmd+Enter (支援數字鍵盤) 可快速提交\n• 按 Ctrl+I/Cmd+I 可聚焦輸入框\n• 按 Ctrl+V/Cmd+V 可直接貼上剪貼板圖片",
|
||||
"imageLabel": "圖片附件(可選)",
|
||||
"imageUploadText": "📎 點擊選擇圖片或拖放圖片到此處\n支援 PNG、JPG、JPEG、GIF、BMP、WebP 等格式",
|
||||
"submit": "✅ 提交回饋",
|
||||
|
@ -1304,3 +1304,45 @@ h3.combined-section-title {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Placeholder 文本換行修復 - 全局樣式 */
|
||||
textarea::placeholder,
|
||||
#feedbackText::placeholder,
|
||||
#combinedFeedbackText::placeholder {
|
||||
white-space: pre-line !important;
|
||||
line-height: 1.4 !important;
|
||||
font-family: inherit !important;
|
||||
color: var(--text-secondary) !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
|
||||
/* 跨瀏覽器兼容的 placeholder 樣式 */
|
||||
textarea::-webkit-input-placeholder,
|
||||
#feedbackText::-webkit-input-placeholder,
|
||||
#combinedFeedbackText::-webkit-input-placeholder {
|
||||
white-space: pre-line !important;
|
||||
line-height: 1.4 !important;
|
||||
font-family: inherit !important;
|
||||
color: var(--text-secondary) !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
|
||||
textarea::-moz-placeholder,
|
||||
#feedbackText::-moz-placeholder,
|
||||
#combinedFeedbackText::-moz-placeholder {
|
||||
white-space: pre-line !important;
|
||||
line-height: 1.4 !important;
|
||||
font-family: inherit !important;
|
||||
color: var(--text-secondary) !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
|
||||
textarea:-ms-input-placeholder,
|
||||
#feedbackText:-ms-input-placeholder,
|
||||
#combinedFeedbackText:-ms-input-placeholder {
|
||||
white-space: pre-line !important;
|
||||
line-height: 1.4 !important;
|
||||
font-family: inherit !important;
|
||||
color: var(--text-secondary) !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
|
||||
|
@ -260,6 +260,12 @@
|
||||
self.submitFeedback();
|
||||
}
|
||||
|
||||
// Ctrl+I 聚焦輸入框
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'i') {
|
||||
e.preventDefault();
|
||||
self.focusInput();
|
||||
}
|
||||
|
||||
// Esc 取消
|
||||
if (e.key === 'Escape') {
|
||||
self.cancelFeedback();
|
||||
@ -743,6 +749,43 @@
|
||||
this.clearFeedback();
|
||||
};
|
||||
|
||||
/**
|
||||
* 聚焦到輸入框 (Ctrl+I 快捷鍵)
|
||||
*/
|
||||
FeedbackApp.prototype.focusInput = function() {
|
||||
console.log('🎯 執行聚焦輸入框...');
|
||||
|
||||
// 根據當前佈局模式選擇正確的輸入框
|
||||
let targetInput = null;
|
||||
const layoutMode = this.settingsManager ? this.settingsManager.get('layoutMode') : 'combined-vertical';
|
||||
|
||||
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 (targetInput) {
|
||||
// 聚焦並滾動到可見區域
|
||||
targetInput.focus();
|
||||
targetInput.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
|
||||
console.log('✅ 已聚焦到輸入框');
|
||||
} else {
|
||||
console.warn('⚠️ 未找到目標輸入框');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 執行命令
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user