Changing save location #50

Open
opened 4 months ago by gabaryza · 4 comments

Is there any way to change the location to which SAVE places the resulting HTML file?

<!-- Please be courteous and respectful toward others --> Is there any way to change the location to which SAVE places the resulting HTML file?
gabaryza added the
question
label 4 months ago

That's a browser preference. You should probably set it to ask every time, even if it's somewhat annoying.

That's a browser preference. You should probably set it to ask every time, even if it's somewhat annoying.
Owner

That is correct. This section on the website has some details that might help you get started: https://feather.wiki/?page=upgrading#handling_downloads

Firefox allows you to set this preference by file type, so you can choose to "always ask" where to save for just HTML files, but that's not something all other browsers can do. (To be honest though, even though it can get annoying, it's good to always know when your browser is trying to download something, for security reasons.)

That is correct. This section on the website has some details that might help you get started: https://feather.wiki/?page=upgrading#handling_downloads Firefox allows you to set this preference by file type, so you can choose to "always ask" where to save for _just_ HTML files, but that's not something all other browsers can do. (To be honest though, even though it can get annoying, it's good to always know when your browser is trying to download something, for security reasons.)

This will soon be possible on all browsers, already works on some browsers and is experimental at the moment. It could be added as a extension maybe. May add bloat to FeatherWiki:

https://caniuse.com/native-filesystem-api
https://web.dev/file-system-access/#create-a-new-file
https://web.dev/file-system-access/#ask-the-user-to-pick-a-file-to-read

Credit: https://stackoverflow.com/a/70001920

Workaround for all browsers until the above feature becomes mainstream:

Probably a trick that can be used is to generate data url that holds the featherwiki data. The user could right click and use save as.

Here is similar example in scope that I found:

https://codepen.io/chriddyp/pen/aVammp

I have attached a HTML file that demonstrates this with FeatherWiki. Open it and right click the link, do a save as to name and save the file to your prefered location (or you could alternatively just click the link and it will be downloaded into downloads folder which is not what you want).

Template:

<a download="FeatherWikiSaveAs.html" id="fdl" href="data:text/html;base64,

Fill with Base64 encoded output of FeatherWiki Html save data. 
See native support: https://developer.mozilla.org/en-US/docs/Glossary/Base64)

" target="_blank">Download FeatherWiki</a>

Now this could be easy to implement and could propably enabled with a check mark in settings so that the main save wiki link itself could contain the data uri.

One could implement filename templates too as extra bonus, such as YourFileName_YYYYMMDDHHMM.html, MyNote_June_13_Save_1.html so that the downloaded files do not get the pesky (1) (2) etc appended to it.

This will soon be possible on all browsers, already works on some browsers and is experimental at the moment. It could be added as a extension maybe. May add bloat to FeatherWiki: https://caniuse.com/native-filesystem-api https://web.dev/file-system-access/#create-a-new-file https://web.dev/file-system-access/#ask-the-user-to-pick-a-file-to-read Credit: https://stackoverflow.com/a/70001920 Workaround for all browsers until the above feature becomes mainstream: Probably a trick that can be used is to generate data url that holds the featherwiki data. The user could right click and use save as. Here is similar example in scope that I found: https://codepen.io/chriddyp/pen/aVammp I have attached a HTML file that demonstrates this with FeatherWiki. Open it and right click the link, do a save as to name and save the file to your prefered location (or you could alternatively just click the link and it will be downloaded into downloads folder which is not what you want). Template: ``` <a download="FeatherWikiSaveAs.html" id="fdl" href="data:text/html;base64, Fill with Base64 encoded output of FeatherWiki Html save data. See native support: https://developer.mozilla.org/en-US/docs/Glossary/Base64) " target="_blank">Download FeatherWiki</a> ``` Now this could be easy to implement and could propably enabled with a check mark in settings so that the main save wiki link itself could contain the data uri. One could implement filename templates too as extra bonus, such as YourFileName_YYYYMMDDHHMM.html, MyNote_June_13_Save_1.html so that the downloaded files do not get the pesky (1) (2) etc appended to it.
Owner

I almost certainly won't be integrating the FileSystem API, but it would be trivial to make a plugin that alters the save behavior. The way you describe saving the file is actually already how Feather Wiki handles its saves—it just simulates the click automatically to begin the download and removes the a tag. It would be very easy to make an extension that just either doesn't remove the a tag after clicking it or that simply leaves the clicking up to the user so they can right click and use "Save As" instead.

That being said, I really believe this is more of a matter having to do with leveraging your own browser than it is of being something Feather Wiki needs to handle.

I almost certainly won't be integrating the FileSystem API, but it would be trivial to make a plugin that alters the save behavior. The way you describe saving the file is actually already how Feather Wiki handles its saves—it just simulates the click automatically to begin the download and removes the `a` tag. It would be very easy to make an extension that just either doesn't remove the `a` tag after clicking it or that simply leaves the clicking up to the user so they can right click and use "Save As" instead. That being said, I really believe this is more of a matter having to do with leveraging your own browser than it is of being something Feather Wiki needs to handle.
Sign in to join this conversation.
No Milestone
No Assignees
4 Participants
Notifications
Due Date

No due date set.

Reference: Alamantus/FeatherWiki#50
Loading…
There is no content yet.