From 379a757d723ffeed7aea0f4b6c0e6ed4a5421a98 Mon Sep 17 00:00:00 2001 From: XYShaoKang <38753204+XYShaoKang@users.noreply.github.com> Date: Sat, 15 Jul 2023 22:24:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(problems):=20=E4=BF=AE=E5=A4=8D=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=E7=BC=96=E8=BE=91=E5=99=A8=E5=85=83=E7=B4=A0=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content/pages/problems/Timer.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/content/pages/problems/Timer.tsx b/src/content/pages/problems/Timer.tsx index 4932130..601b3c6 100644 --- a/src/content/pages/problems/Timer.tsx +++ b/src/content/pages/problems/Timer.tsx @@ -7,6 +7,7 @@ import { SuccessCheckReturnType, findElement, findElementByXPath, + findAllElement, } from '@/utils' import { useEvent, useHover, useObserverAncestor } from '@/hooks' import { ToolTip } from '@/components/ToolTip' @@ -375,7 +376,11 @@ const Timer: FC = ({ beta, root, dynamicLayout }) => { let editEl: HTMLElement if (beta) { - editEl = await findElement('.monaco-editor') + const editEls = await findAllElement('.monaco-editor') + editEl = editEls.find( + el => el.parentElement?.dataset.modeId !== 'plaintext' + )! + if (!editEl) throw new Error('未找到编辑器元素') } else { editEl = await findElement('.euyvu2f0') }