修复ui.click.target的targetprompt有问题

This commit is contained in:
nineMangos 2024-04-26 00:05:17 +08:00
parent 5c2dff7c1a
commit dd1e1be6e8
1 changed files with 15 additions and 5 deletions

View File

@ -2843,10 +2843,20 @@ export class Click {
}
if (targetprompt) {
if (Array.isArray(targetprompt)) {
targetprompt =
targetprompt[
Math.min(targetprompt.length - 1, ui.selected.targets.indexOf(this))
];
const targets = ui.selected.targets.slice();
let index = ui.selected.targets.indexOf(this);
for (let i = 0; i < targetprompt.length; i++) {
const target = targets.find(
(cur) => cur.node.prompt && cur.node.prompt.innerText === targetprompt[i]
);
if (target) {
targets.remove(target);
} else {
index = i;
break;
}
}
targetprompt = targetprompt[Math.min(targetprompt.length - 1, index)];
} else if (typeof targetprompt == "function") {
targetprompt = targetprompt(this);
}
@ -3706,7 +3716,7 @@ export class Click {
showSkillNamePinyin == "showCodeIdentifier"
? derivation
: lib.translate[`${derivation}_rt`] ||
get.pinyin(derivationName).join(" ");
get.pinyin(derivationName).join(" ");
ruby.appendChild(rt);
const rightParenthesisRP = document.createElement("rp");
rightParenthesisRP.textContent = "";