Example (execute from Firebug):
config.shadowTiddlers.ToolbarCommands.replace("editTiddler", "");
config.shadowTiddlers.ToolbarCommands.replace("saveTiddler", "");
Even after (re)opening tiddlers in view or edit mode, the edit/save
commands are still present in the toolbar.
I've spent some time tracing this, but couldn't quite figure out what's
going on. The toolbar macro is passed a slice reference from the
respective template ("[[ToolbarCommands::{View,Edit}Toolbar]]") - but
rather than doing its own getTiddlerText call for this parameter, its
handler is somehow invoked directly with the respective list of
commands, which appears to be cached on startup.
It seems like I'm missing something obvious, so a sanity check would be
appreciated.
background:
When I'm not utilizing TiddlyWeb for plugin development, I sometimes use
dynamic script loading to simplify the dev cycle:
http://fnd.lewcid.org/misc/PluginLoader.html
(uses http://github.com/FND/jsutil/blob/master/loadScript.js)
While this allows me to edit plugins' .js file and test changes with a
simple page reload (much like when using TiddlyWeb's devstore), scripts
are loaded asynchronously - which led to the observed effect.
-- F.
> The <<toolbar>> macro takes a list of toolbar handler names (e.g.,
> "editTiddler", "saveTiddler"), *not* a slice reference. The reason
> the [[ToolbarCommands::...]] slice reference works at all is because
> it occurs within a *template*
I had arrived at the same conclusion - yet I haven't been able to figure
out why my shadow tiddler modifications* are not taken into account (I'd
tried all sorts of refresh calls and whatever else I could think of).
I'll let this settle for a bit and revisit it at a later time, hopefully
with a fresh mind.
-- F.
* I've just noticed my previous Firebug example was missing the actual
assignment - that's just an omission in the post; I correctly assigned
the new values in my test case.
I'm afraid not - there's no theme involved.
The issue be reproduced in a vanilla TiddlyWiki by executing the
following lines after startup (e.g. from Firebug):
config.shadowTiddlers.ToolbarCommands =
config.shadowTiddlers.ToolbarCommands.
replace("+editTiddler", "").
replace("+saveTiddler", "");
When (re)opening a tiddler afterwards, I would expect the save/edit
commands to have disappeared - but that's not the case.
> B) On the other hand doesn't the core provide some theme-switiching
> capability via story.switchTheme() so you could call a refresh on the
> current theme?
I've tried that (along with various other refresh functions) - no joy.
> C) What's the purpose of loadShadowTiddlers and would that somehow
> play a role in your refresh problems?
loadShadowTiddlers only populates config.shadowTiddlers, doesn't it?
> D) Finally, I hope I am not getting off-topic here, but how would...
> jQuery().trigger("loadShadows");
> ...in function main() do anything? I can't find "loadShadows" being
> attached anywhere.
http://trac.tiddlywiki.org/ticket/1228
> I just watched...
> http://www.youtube.com/watch?v=WzHRHLd7tyk
> ...and something rather curious happens from 6:30 up until 7:10.
I'm not quite following - but I reckon the issue there is related to
TiddlyWeb permissions.
That's excellent, Eric - thanks a lot!
This makes perfect sense now, of course, and I'm a bit annoyed with
myself for not having thought of it. Luckily, the TiddlyWiki community
can always count on Eric to go the extra mile...
-- F.