From 4736f77cbf0ce532bdab3190e7655f0f1c5d90da Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Tue, 25 Mar 2025 13:08:29 +0800 Subject: [PATCH] fix(problem-editor): add editor validation handling --- src/components/problem-editor.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/problem-editor.tsx b/src/components/problem-editor.tsx index 5c1fba7..118f123 100644 --- a/src/components/problem-editor.tsx +++ b/src/components/problem-editor.tsx @@ -32,6 +32,7 @@ export function ProblemEditor() { hydrated, editor, setEditor, + setMarkers, setWebSocket, currentLang, currentPath, @@ -113,6 +114,13 @@ export function ProblemEditor() { [changeValue] ); + const handleEditorValidation = useCallback( + (markers: editor.IMarker[]) => { + setMarkers(markers); + }, + [setMarkers] + ); + if (!hydrated) { return ; } @@ -126,6 +134,7 @@ export function ProblemEditor() { beforeMount={handleEditorWillMount} onMount={handleOnMount} onChange={handleEditorChange} + onValidate={handleEditorValidation} options={DefaultEditorOptionConfig} loading={} className="h-full w-full py-2"