Help: turning plugin macro into toolbar item, MailTiddler

17 views
Skip to first unread message

brianburnham

unread,
Mar 1, 2007, 10:09:35 AM3/1/07
to TiddlyWiki
Okay, this is my first plugin. I wanted a button to click and send the
current tiddler to my mail client. And the below plugin/macro works,
more or less depending on the content of the tiddler.

What I'd like to do now is

1. change this from a macro to a toolbar command
2. find a way to prevent tiddler content from escaping the body field

Here's the plugin code:

config.macros.mailtiddler = {};
config.macros.mailtiddler.handler = function
(place,macroName,params,wikifier,paramString,tiddler) {

wikify("<html><a href=\"mailto:?subject=" + tiddler.title +
"&body=" + tiddler.text + "\">mail</a></html>", place);
}

I am using <html></html> to prevent ]]'s from escaping, and this seems
to work on simple tiddlers, but not on more complex ones. Not sure if
it is the carriage returns or embeded tiddlers or what.

Anyway, can anyone help me translate the above into a toolbar command?
Any additional insight is appreciated.

It is probably obvious by the code, but I am building mailto links to
send the tiddler title and body to my email client. Right now I'm
adding it as a <span macro="mailtiddler"></span> in my view template.

Thanks!

Eric Shulman

unread,
Mar 1, 2007, 11:45:09 AM3/1/07
to TiddlyWiki
> 2. find a way to prevent tiddler content from escaping the body field

try using:
tiddler.text.htmlEncode()
instead of just
tiddler.text

That should help with embedded newlines, as well as "<" and ">"...

HTH
-e
Eric Shulman
TiddlyTools / ELS Design Studios

brianburnham

unread,
Mar 1, 2007, 12:15:02 PM3/1/07
to TiddlyWiki
Awesome, thanks. That worked like a charm.

dotCdot

unread,
Mar 1, 2007, 1:12:05 PM3/1/07
to TiddlyWiki
Brian, on my tiddlies i find all the carriage returns have been
stripped out ... do you have that happening too?
(even so, its a great leap forward!)

brianburnham

unread,
Mar 2, 2007, 10:07:41 PM3/2/07
to TiddlyWiki
Yep- I'm losing carriage returns too, and I don't know if this is
something that can be fixed. I don't know if the mailto tag accepts
carriage returns and don't know enough about JavaScript either.
Reply all
Reply to author
Forward
0 new messages