Skip to content

Save As toolbar button should provide default directory and filename #61

@vinsworldcom

Description

@vinsworldcom

When pressing the "Save As" button to save the HTML in the preview panel, the directory and name of the current file should be used to initialize the Save As dialog. Here is a patch:

diff --git a/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs b/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs
index 1fffc1c..eb21a87 100644
--- a/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs
+++ b/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs
@@ -327,6 +327,8 @@ namespace NppMarkdownPanel.Forms
             {
                 saveFileDialog.Filter = "html files (*.html, *.htm)|*.html;*.htm|All files (*.*)|*.*";
                 saveFileDialog.RestoreDirectory = true;
+                saveFileDialog.InitialDirectory = Path.GetDirectoryName(CurrentFilePath);
+                saveFileDialog.FileName = Path.GetFileNameWithoutExtension(CurrentFilePath);
                 if (saveFileDialog.ShowDialog() == DialogResult.OK)
                 {
                     writeHtmlContentToFile(saveFileDialog.FileName);

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions