[fix:] wiki preview reloading after saving changes
This commit is contained in:
@@ -212,6 +212,11 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
|
|
||||||
private async void NavTree_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
private async void NavTree_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ReloadWikiItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ReloadWikiItem()
|
||||||
{
|
{
|
||||||
if (NavTree.SelectedItem is TreeViewItem t && t.Tag is WikiItem item && !item.IsFolder)
|
if (NavTree.SelectedItem is TreeViewItem t && t.Tag is WikiItem item && !item.IsFolder)
|
||||||
{
|
{
|
||||||
@@ -255,6 +260,8 @@ public partial class MainWindow : Window
|
|||||||
ExpandAndFindNode(nodes, selectPath, out var selectedNode) &&
|
ExpandAndFindNode(nodes, selectPath, out var selectedNode) &&
|
||||||
selectedNode != null)
|
selectedNode != null)
|
||||||
NavTree.SelectedItem = selectedNode;
|
NavTree.SelectedItem = selectedNode;
|
||||||
|
|
||||||
|
ReloadWikiItem();
|
||||||
}catch (Exception ex)
|
}catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Log($"Error while populating nav tree: {ex.Message}", Logger.LogType.Error);
|
Logger.Log($"Error while populating nav tree: {ex.Message}", Logger.LogType.Error);
|
||||||
@@ -494,7 +501,13 @@ public partial class MainWindow : Window
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var editedWikiFilePath = _selectedWikiFilePath;
|
||||||
EditorWindow ew = new(_selectedWikiFilePath);
|
EditorWindow ew = new(_selectedWikiFilePath);
|
||||||
|
ew.Closed += (_, _) =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(editedWikiFilePath) && File.Exists(editedWikiFilePath))
|
||||||
|
PopulateNavTree(editedWikiFilePath, editedWikiFilePath);
|
||||||
|
};
|
||||||
ew.Show();
|
ew.Show();
|
||||||
|
|
||||||
//await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled");
|
//await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public partial class EditorWindow : Window
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(filename, TbContent.Text);
|
File.WriteAllText(filename, TbContent.Text);
|
||||||
MainWindow._instance.PopulateNavTree();
|
MainWindow._instance.PopulateNavTree(filename, filename);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user