()
| 101 | |
| 102 | let isSaving = false; |
| 103 | async function save() { |
| 104 | if (!monacoRef.current) { |
| 105 | return |
| 106 | } |
| 107 | |
| 108 | await monacoRef.current.getAction('editor.action.formatDocument')?.run() |
| 109 | const value = monacoRef.current.getValue(); |
| 110 | |
| 111 | let innerIsDirty = value !== selectedFile?.content |
| 112 | |
| 113 | if (!innerIsDirty || isSaving) { |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | await props.onSave(value); |
| 118 | } |
| 119 | |
| 120 | function onValueChange(value: string | undefined) { |
| 121 | // editedValue.current = value || ""; |