mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: always use string for monaco.editor.setValue(value) / handle undefined
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
5093b094f6
commit
adbe6cad69
@ -244,15 +244,15 @@ export class MonacoEditor extends React.Component<MonacoEditorProps> {
|
||||
return editor.createModel(value, language, uri);
|
||||
}
|
||||
|
||||
setValue(value: string) {
|
||||
setValue(value = "") {
|
||||
if (value == this.getValue()) return;
|
||||
|
||||
this.editor.setValue(value);
|
||||
this.validateOnChange(value);
|
||||
}
|
||||
|
||||
getValue(opts?: { preserveBOM: boolean; lineEnding: string; }) {
|
||||
return this.editor.getValue(opts);
|
||||
getValue(opts?: { preserveBOM: boolean; lineEnding: string; }): string {
|
||||
return this.editor?.getValue(opts) ?? "";
|
||||
}
|
||||
|
||||
// avoid excessive validations during typing
|
||||
|
||||
Loading…
Reference in New Issue
Block a user