Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save ToHtml #1000

Closed
joemclain opened this issue Jan 22, 2023 · 11 comments
Closed

Save ToHtml #1000

joemclain opened this issue Jan 22, 2023 · 11 comments
Assignees
Labels
Approved Enhancement Enhancement that's been approved for implementation feature discussion

Comments

@joemclain
Copy link

Does File->SaveTo->SaveToHtml have a toggle to keep it from opening an Explorer window after the file is saved? If not, I'd like to suggest you add one. I've been using SaveToHtml quite a bit the last few days and noticed all these Explorer windows but did not associate it with MM and SaveToHtml until this morning.

Thanks,

-joe-mclain-

@RickStrahl
Copy link
Owner

No there's no option for that.

All export operations pretty much do something similar. PDF generation opens the exported PDF, HTML export opens the Explorer in the output folder. Backups show the file in explorer.

The problem with a setting is that these operations happen without a configurable dialog in front them - most let you pick a file name or location using a file dialog which can't be customized (at least not easily).

That would leave a global option which would be difficult to discover and would probably be used by... well, you 😄

@joemclain
Copy link
Author

That would leave a global option which would be difficult to discover and would probably be used by... well, you 😄

I would hazard a guess that not a lot of people regularly using the "Save To" dialog, otherwise it would drive them crazy, as it does me! And by regularly, I mean is every few minutes.

You could always use a custom save file dialog with an open/don't open checkbox. Of course you'd have to save the value returned in setting!

Look, I know this isn't a big deal, but I thought I would raise the issue. I don't have the time right now to crawl through the source code looking to see if you're using the default save as dialog in all these places, so I can hardly expect you to expend the time.

So, just a suggestion.

-joe-mclain-

@RickStrahl
Copy link
Owner

MM uses the default save as dialogs.

The problem with a custom dialog (not based on the default Windows Save dialog) is that you're adding another window in front of the file selection which IMHO is more of a hassle than closing an explorer window.

If you can figure out a clean way to make this work using a customized save file dialog I certainly can add it to the right places - it would be useful, but if I remember correctly customizing a Windows dialog is not trivial and taking a quick look all I see for .NET based code is completely custom dialogs which I'm not going to do for

Perhaps another, simpler path to this would be a global option like DontOpenExplorerForExportedFiles and that would apply for things that create files and open explorer now (and perhaps also for PDF export).

The reason I'm hesitant on this because it seems like an extreme edge case. Exporting files tends to be pretty rare...

@joemclain
Copy link
Author

If this is the first complaint you've had then I agree with you, it's an edge case. I'm fairly sure I never wrote a WPF save file dialog, but I'll investigate it. Give me a couple of weeks.

Close this item if you want to, I'll open a new one if I come up with anything.

@joemclain
Copy link
Author

Okay, I just spent a few minutes looking at open/save file dialogs in WPF. I will not being writing one of those anytime soon, life is too short. So, how about a

DontOpenExplorerForSaveToFiles

Or maybe I should just write a plugin for a more robust SaveToHtml where the HTML can be saved by itself, or encapsulated in an actual webpage. I wrote one of those 5 or 6 years ago for a project that I ultimately abandoned.

@RickStrahl
Copy link
Owner

RickStrahl commented Jan 25, 2023

I'm still curious to hear what you're using this for that requires you to do this frequently...

So here are a couple of additional thoughts on this:

The whole Save As Html functionality is not optimal at the moment, any way you look at it. I'm using different file drop down options to specify the options which works but isn't particularly obvious. I actually thought about a custom dialog at the time I built this functionality but decided against it because of the extra step it adds.

If the file picker could be part of the dialog itself (ie. an Explorer style Save As select list basically that is integrated into it that would work, but I think that's a pain to do actually as there are no controls that provide that functionality in a reasonably easy integration.

At the end of the day if there was a dialog it would probably be something like the Save to PDF dialog which has a reason to be there since it has a lot of options to set and configure and which has its own set of saved values that are restored on next load.

@joemclain
Copy link
Author

I'm still curious to hear what you're using this for that requires you to do this frequently...

Simplest thing: I have an app that generates PDF from HTML files. I write using markdown in MM, save as HTML, then run the app which combines some templates, the md/html I've written, and some dynamic content. The app then splits out the PDF files (hundreds of them when I do final builds).

The truth is I will only be doing the fast iteration (write / save html / build) for a short period of time as I create the static parts of the output PDF files. The annoying part is the other day I switch desktops to check some email and I see the taskbar notifying me that there's an Explorer window I haven't looked at. I click on Explorer icon on the taskbar and I get a flyout with dozens of little Explorer windows to choose from. In addition to that the taskbar was flaky across desktops until I closed all the windows.

I expect most people would have noticed all the Explorer windows stacking up, but I have 3 monitors and the Explorer windows are on the rightmost monitor which I was not looking at.

@RickStrahl
Copy link
Owner

I've been playing around with this some more in MM and given that originally I actually wanted to use a dialog, I think I'll end up creating a custom one that will be similar to the PDF output window, with clear options and descriptions for the different HTML output modes which is confusing currently because of the selection through the file type drop down in the Save File dialog.

@RickStrahl RickStrahl added enhancement Approved Enhancement Enhancement that's been approved for implementation and removed enhancement labels Jan 31, 2023
@RickStrahl
Copy link
Owner

So started work on this and it's mostly complete:

image

Should be pretty self explanatory how this works. Clicking Export to Html open the file or folder selection dialog and then performs the export. The checkbox determines whether the file/folder is show in Explorer. There's now a global flag that is set on whether files are opened by default.

This definitely is a lot nicer than the old file open dialog only which at best was not obvious and more likely confusing.

It'll be in the next update, but it needs a little more work - there were a few other problems in the existing UI code that need to be taken care of.

@joemclain
Copy link
Author

This looks good. The last option where you export to a zip file, you might want to put "Zip" as part of the radio button label.

If you have a pre-release build you would like someone to look at let me know.

@RickStrahl
Copy link
Owner

You can install v2.8.2+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Enhancement Enhancement that's been approved for implementation feature discussion
Projects
None yet
Development

No branches or pull requests

2 participants