set the value in the editor for results (#1799)

This commit is contained in:
sunghyunkang1111 2024-04-13 15:19:56 -05:00 committed by GitHub
parent 953bef404b
commit 00a816c488
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,13 +54,17 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
const existingContent = this.editor.getModel().getValue();
if (this.props.content !== existingContent) {
this.editor.pushUndoStop();
this.editor.executeEdits("", [
{
range: this.editor.getModel().getFullModelRange(),
text: this.props.content,
},
]);
if (this.props.isReadOnly) {
this.editor.setValue(this.props.content);
} else {
this.editor.pushUndoStop();
this.editor.executeEdits("", [
{
range: this.editor.getModel().getFullModelRange(),
text: this.props.content,
},
]);
}
}
}