mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
fix(problem-editor): add editor validation handling
This commit is contained in:
parent
a55ef88745
commit
4736f77cbf
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user