+
+
+
+ {t("vocalTagsDialog.mappingTitle", "演唱者标签")}
+
+
+
+
+
+
+
+
+ {vocalTags.length === 0 && (
+
+ {t("vocalTagsDialog.empty", "暂无演唱者标签。")}
+
+ )}
+
+ {vocalTags.map((tag, index) =>
+ editingIndex === index ? (
+
setEditingValue(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ if (e.key !== "Enter") return;
+ const trimmed = editingValue.trim();
+ setLyricLines((draft) => {
+ if (!draft.vocalTags) return;
+ if (!trimmed) {
+ draft.vocalTags.splice(index, 1);
+ reassignVocalIds(draft);
+ return;
+ }
+ if (hasDuplicateTag(draft.vocalTags, trimmed, index)) return;
+ const target = draft.vocalTags[index];
+ if (target) target.value = trimmed;
+ });
+ setEditingIndex(null);
+ }}
+ onBlur={() => setEditingIndex(null)}
+ />
+ ) : (
+
+ ),
+ )}
+ {isAdding ? (
+ setNewTagValue(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ if (e.key !== "Enter") return;
+ const trimmed = newTagValue.trim();
+ if (!trimmed) {
+ setIsAdding(false);
+ return;
+ }
+ setLyricLines((draft) => {
+ draft.vocalTags ??= [];
+ if (hasDuplicateTag(draft.vocalTags, trimmed)) return;
+ const nextId = getNextVocalId(
+ draft.vocalTags.map((tag) => tag.key),
+ );
+ draft.vocalTags.push({ key: nextId, value: trimmed });
+ });
+ setIsAdding(false);
+ setNewTagValue("");
+ }}
+ onBlur={() => setIsAdding(false)}
+ />
+ ) : (
+
+ )}
+
+