From dd1e1be6e82026be179d4f8f4c6dbbca2f3b6292 Mon Sep 17 00:00:00 2001 From: nineMangos Date: Fri, 26 Apr 2024 00:05:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dui.click.target=E7=9A=84targe?= =?UTF-8?q?tprompt=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/ui/click/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/noname/ui/click/index.js b/noname/ui/click/index.js index b07f17755..f3e66a5ef 100644 --- a/noname/ui/click/index.js +++ b/noname/ui/click/index.js @@ -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 = ")";