Compare commits

...
2 Commits
Author SHA1 Message Date
wonder b779099bcf fix: 选中子标签选项时同步勾选父标签复选框,并支持再次点击取消选择
- 将 radio 的 onchange 改为 onclick,支持点击已选中的 radio 触发取消
- selectTagOption 中增加父复选框 DOM 同步逻辑
- 再次点击已选中的 radio 时取消选择并重建 DOM 状态
2026-06-26 17:14:17 +08:00
wonder 1bb3978c9a fix: 将生成 Prompt 中的章节标题自定义内容改为用户输入 2026-06-26 17:07:23 +08:00
2 changed files with 15 additions and 4 deletions
+14 -3
View File
@@ -214,7 +214,7 @@
const checked = selectedTags[tag.id] !== undefined;
const optionsHtml = tag.options.map(o => `
<label class="radio-label">
<input type="radio" name="tag_${tag.id}" value="${o.id}" ${selectedTags[tag.id] === o.id ? 'checked' : ''} onchange="selectTagOption(${tag.id}, ${o.id})">
<input type="radio" name="tag_${tag.id}" value="${o.id}" ${selectedTags[tag.id] === o.id ? 'checked' : ''} onclick="selectTagOption(${tag.id}, ${o.id})">
<span class="text-sm">${escapeHtml(o.label)}</span>
</label>
`).join('');
@@ -255,7 +255,18 @@
}
function selectTagOption(tagId, optionId) {
selectedTags[tagId] = optionId;
if (selectedTags[tagId] === optionId) {
// 再次点击已选中的选项 → 取消选择(需要 renderTags 重建 DOM 以取消 radio 的 checked 状态)
delete selectedTags[tagId];
renderTags();
} else {
selectedTags[tagId] = optionId;
// 同步勾选父标签复选框
const checkbox = document.querySelector(`#tag-options-${tagId}`)
?.closest('.mb-2')
?.querySelector('input[type="checkbox"]');
if (checkbox) checkbox.checked = true;
}
updatePreview();
}
@@ -339,7 +350,7 @@
// Custom content
const customContent = document.getElementById('custom-content').value.trim();
if (customContent) {
parts.push(`## 自定义内容\n\n${customContent}`);
parts.push(`## 用户输入\n\n${customContent}`);
}
// Tag constraints
+1 -1
View File
@@ -210,7 +210,7 @@ func AssemblePrompt(projectName string, customContent string, tagOptions []model
// Custom content
if customContent != "" {
parts = append(parts, fmt.Sprintf("## 自定义内容\n\n%s", customContent))
parts = append(parts, fmt.Sprintf("## 用户输入\n\n%s", customContent))
}
// Tag constraints