My app injects a js to TiddlyWiki webview, which is a modified version of
scripts inside the desktop app TiddlyDesktop:
var enableSaving = function(doc) {
var messageBox = doc.createElement("div");
messageBox.id = "tiddlyfox-message-box";
doc.body.appendChild(messageBox);
messageBox.addEventListener("tiddlyfox-save-file",function(event) {
var message = event.target,
filepath = message.getAttribute("data-tiddlyfox-path"),
content = message.getAttribute("data-tiddlyfox-content");
window.client.saveWiki(filepath,content);
message.parentNode.removeChild(message);
var event = doc.createEvent("Events");
event.initEvent("tiddlyfox-have-saved-file",true,false);
event.savedFilePath = filepath;
message.dispatchEvent(event);
return false;
},false);
};
enableSaving(document);
It seems that the code provides no downloading interface. The only thing
they do is to get the content of current page.
在 2019年4月27日星期六 UTC+8下午9:49:39,Jeremy Ruston写道:
>
> Hi Donmor
>
> The "Download Empty" button in the wiki page does not work in my app. I'm
> not sure whether this function can be handled by injecting js, just like
> saving function handled by TiddlyFox or TiddlyDesktop. The button invokes
> an method in $:/core/modules/widgets/action-sendmessage.js, which will pass
> an url begins with "blob:" to the browser, but WebView won't support this
> scheme. I'm now finding a way to change the blob things to a base64 string
> so that I can decode it to a byte array. Anyone can help? :-)
>
>
> Just to be clear, does ordinary saving work in your app? Have you injected
> a custom saver?
>
> Downloads are handled by the same saver module mechanism that we use for
> saving, but with the “method” parameter to the saver passed as “download”
> instead of “save” or “autosave”.
>
> Perhaps you can share some more details of how your app is working at the
> moment?
>
> Best wishes
>
> Jeremy
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at https://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/c32330c5-74a7-4aad-9d3f-cee8a11eda6d%40googlegroups.com
>
> <https://groups.google.com/d/msgid/tiddlywikidev/c32330c5-74a7-4aad-9d3f-cee8a11eda6d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/60be369a-539e-4050-a411-cc11cd39b739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.