>From what I can see of your code at a quick glance, you are using 
widget.dispatchEvent rather than invokeAction. Furthermore there are no 
parameters on the event.

I am pretty sure you need to specify param (the template to be used for 
saving). It is not optional, see 
https://tiddlywiki.com/#WidgetMessage%3A%20tm-save-wiki

You can see here how the tm-save-wiki message is handled:

https://github.com/Jermolene/TiddlyWiki5/blob/0c2689dd78e47b211ed4f2ec7586dea03dcc3a9a/core/modules/saver-handler.js#L96

Add the necessary parameters to the message and it should be handled 
correctly.


On Friday, June 26, 2020 at 9:47:48 AM UTC+2, Souf K wrote:
>
> Hello everyone!
> I'm trying to fix the 'Save wiki' that is bundled with Command Palette (
> https://github.com/souk21/TW-commandpalette).
> For the moment, it shows the notification "Saved wiki", but nothing else 
> append. (no download, no error as well)
>
> The first thing I tried was to check how `$:/core/ui/Buttons/save-wiki` is 
> implemented.
> I ended up with this:
>
> <$wikify name="site-title" text={{$:/config/SaveWikiButton/Filename}}>
> <$action-sendmessage $message="tm-save-wiki" 
> $param={{$:/config/SaveWikiButton/Template}} filename=<<site-title>>/>
> </$wikify>
>
> Which works, as if I save it as a tiddler, it actually asks me to download 
> the wiki.
>
> But if I try to invoke it using JS `invokeActionString()` it only shows 
> the notification and doesn't prompt for download.
>
> Is there an inherent difference between executing tiddlytext in a tiddler 
> or invoking it from JS?
>
> I also tried sending the message directly from JS 
> `$tw.rootWidget.dispatchEvent('tm-save-wiki')`
>
> I tried to fiddle a bit with parameters, but the doc says its two 
> parameters are optional, so I guess the problem is somewhere else.
>
> If anyone can shine some light on this issue, I'll be grateful.
>
> Thanks!
> Souk21
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/1fd51739-2f6a-4e6e-92af-c8947dbac5e7o%40googlegroups.com.

Reply via email to