From 06991c51ec77f1342e101bad0af73657251ba931 Mon Sep 17 00:00:00 2001
From: "Matt Parker [SSW]" <61717342+MattParkerDev@users.noreply.github.com>
Date: Fri, 10 Jan 2025 21:24:19 +1000
Subject: [PATCH] File name heading
---
.../Components/CodeViewer.razor | 24 +++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/SharpIDE.Photino/Components/CodeViewer.razor b/src/SharpIDE.Photino/Components/CodeViewer.razor
index 9932c86..2df6ac9 100644
--- a/src/SharpIDE.Photino/Components/CodeViewer.razor
+++ b/src/SharpIDE.Photino/Components/CodeViewer.razor
@@ -1,16 +1,23 @@
-
+
+ @Path.GetFileName(FilePath)
+ @if (_unsavedEdits)
+ {
+ *
+ }
+
-
+
@code {
[Parameter, EditorRequired]
public string FilePath { get; set; } = null!;
private string? _fileContent;
+ private bool _unsavedEdits = false;
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
{
@@ -36,4 +43,17 @@
_fileContent = fileContent;
}
+ private async Task SaveFileToDisk(object obj)
+ {
+ if (_unsavedEdits is false)
+ {
+ return;
+ }
+ var editor = obj as StandaloneCodeEditor;
+ ArgumentNullException.ThrowIfNull(editor, nameof(editor));
+ var editorTextValue = await editor.GetValue();
+ await File.WriteAllTextAsync(FilePath, editorTextValue);
+ _unsavedEdits = false;
+ }
+
}