Skip to content

Commit

Permalink
fix(problems): 修复查找编辑器元素的逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
XYShaoKang committed Jul 15, 2023
1 parent b55a2e4 commit 379a757
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/content/pages/problems/Timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SuccessCheckReturnType,
findElement,
findElementByXPath,
findAllElement,
} from '@/utils'
import { useEvent, useHover, useObserverAncestor } from '@/hooks'
import { ToolTip } from '@/components/ToolTip'
Expand Down Expand Up @@ -375,7 +376,11 @@ const Timer: FC<TimerProps> = ({ 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')
}
Expand Down

0 comments on commit 379a757

Please sign in to comment.