Hi gurus (especially Eric),

i tried to implement my first Plugin: SaveCollapseTiddlerPlugin:  a
toolbar macro add-in to save and then collapse the Tiddler in-work
immediately. It should work similar to Simon Baird's
SaveCloseTiddlerPlugin.
To collapse the tiddler in took part of the Eric's
CollapseTiddlerPlugin code. My plugin works like a regular save but do
not collapse the tiddler.
I'am afraid not to be acquainted enough with the TW internals ;-(

Cheers Michael


/***
|Name|SaveCollapseTiddlerPlugin|
|Version|1.0.0|
|Source||
|Author|[[MichaelTarnowski]]|
|Type|Toolbar Macro Extension|
|Requires|CollapseTiddlerPlugin|
|~CoreVersion|2.0+|
|Description|Extends the TiddlyWiki commands for the toolbar macro by
adding a button to save and then collapse the Tiddler immediately.|

!Description
<<tiddler [[SaveCollapseTiddlerPlugin::Description]]>>

!Useage
Add to your EditTemplate, e.g.:
{{{
<!-- ********* -->
<div class='toolbar' macro='toolbar +saveTiddler saveClose
saveCollapse -cancelTiddler deleteTiddler closeTiddler'></div>
}}}
It does a save followed by a collapse.

!Code
***/
//{{{
version.extensions.saveClose = {
 major: 1, minor: 0, revision: 0, date: new Date("Oct 16, 2009"),
type: 'macro',
};

config.commands.saveCollapse = {
 text: "save/collapse", tooltip: "Save then collapse this tiddler"
}

config.commands.saveCollapse.handler = function(event,src,title) {
      story.saveTiddler(title,event.shiftKey);
      var t=config.commands.collapseTiddler.getCollapsedTemplate(); //
Eric's collapse Code
      config.commands.collapseTiddler.saveTemplate(tiddler);
      config.commands.collapseTiddler.display(title,t);
      tiddler.folded=true;
      return false;
}
//}}}
/***
This plugin is released under the "Do whatever you like at your own
risk" license.
***/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to