fix(problem-editor): add editor validation handling

This commit is contained in:
cfngc4594 2025-03-25 13:08:29 +08:00
parent a55ef88745
commit 4736f77cbf

View File

@ -32,6 +32,7 @@ export function ProblemEditor() {
hydrated, hydrated,
editor, editor,
setEditor, setEditor,
setMarkers,
setWebSocket, setWebSocket,
currentLang, currentLang,
currentPath, currentPath,
@ -113,6 +114,13 @@ export function ProblemEditor() {
[changeValue] [changeValue]
); );
const handleEditorValidation = useCallback(
(markers: editor.IMarker[]) => {
setMarkers(markers);
},
[setMarkers]
);
if (!hydrated) { if (!hydrated) {
return <Loading />; return <Loading />;
} }
@ -126,6 +134,7 @@ export function ProblemEditor() {
beforeMount={handleEditorWillMount} beforeMount={handleEditorWillMount}
onMount={handleOnMount} onMount={handleOnMount}
onChange={handleEditorChange} onChange={handleEditorChange}
onValidate={handleEditorValidation}
options={DefaultEditorOptionConfig} options={DefaultEditorOptionConfig}
loading={<Loading />} loading={<Loading />}
className="h-full w-full py-2" className="h-full w-full py-2"