The code above had a bug which I somehow didn't notice since now. It forgot to insert the paragraph tag to put the toolbar in a separate page, so sometimes (in wide pages) the toolbar shows to the left of the textarea, which is ugly. The fix would be trivial: change
tot.parentNode.insertBefore(l,t);
However, this is a bit ugly, because the paragraph tag adds some vertical space between the toolbar and the image, so I'll soon fix the code to add a br tag instead of a p tag.t.parentNode.insertBefore(p,t);
The original node will contain the fixed code (it does now), so here's a backup copy of the old code.
<script type="text/javascript" defer><!-- function edittoolbar_help(){window.alert('Separate paragraphs with "<p +>", put "<c>".."<\x2fc>" around code or data (linebreaks inside it ar +e taken literally) and you\x27ll be okay. Don\x27t forget to check i +f the preview looks right.');} (function(){ var d=document,c="createElement",i="appendChild"; var t=d.getElementsByTagName("textarea")[0]; if(t){ var p=d[c]("p"),l=d[c]("a"),m=d[c]("img"); m.src="http://www.math.bme.hu/~ambrus/pu/edittoolbar"; m.border=0; l.href="javascript:edittoolbar_help()"; l[i](m);p[i](l); t.parentNode.insertBefore(l,t); } })(); //--></script>
In reply to Re: Javascript formatting toolbar for perlmonks
by ambrus
in thread Javascript formatting toolbar for perlmonks
by ambrus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |