1 sdotson Feb 19, 2008 17:33
3 sdotson Feb 19, 2008 17:48
OK, got it figured out. I was not following how the javascript worked. Not it makes sense. Just needed to talk to myself a bit.
4 edb Feb 19, 2008 17:49
Not really on the wrong track, just not done with the process is all. I'm busy playing with antispam right now, but adding your own button to quicktags isn't so hard.
oops
Congratulations then!
5 edb Feb 19, 2008 17:50
Hey how about posting what you ended up doing so the next person that wants to do the same can benefit from your efforts?
6 sdotson Feb 19, 2008 23:23
ok so in the quicktags.plugin.php file find the button codesimilar to what you want. So for example we wanted to add another IMG tag so find the IMG tge and then modify it as desired
b2evoButtons[b2evoButtons.length] = new b2evoButton(
'b2evo_img_left'
,'img_left', 'margin-left:8px;'
,'',''
,'x'
,'<?php echo T_('IMaGe [Alt-X]') ?>'
,-1
); // special case
So we gave it a new name (b2evo_img_left) a new caption (img_left) and a
new ALT code (x).
Now at the bottom of this file you'll find the javascript. Find the function function b2evoShowButton that determines what other function to call ased on the button name. You'll see code for the image tag. Add another else if statement to cover your new button.
else if( button.id == 'b2evo_img_left' )
{
document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" title="' + button.tit
+ '" style="' + button.style + '" class="quicktags" onclick="b2evoInsertImageLeft(b2evoCanvas);" value="' + button.display + '" />');
}
Notice we changed the function it will call to b2evoInsertImageLeft
now towards the bottom we'll find the function b2evoInsertImage. Copy it to b2evoInsertImageLeft and modify the code and save. In this example we add a class tag to the code.
function b2evoInsertImageLeft(myField)
{
var myValue = prompt( '<?php echo T_('URL') ?>:', 'http://' );
if (myValue) {
myValue = '<img class="leftmargin" src="'
+ myValue
+ '" alt="' + prompt('<?php echo T_('ALTernate text') ?>:', '')
+ '" title="' + prompt('<?php echo T_('Title') ?>:', '')
+ '" />';
textarea_wrap_selection( myField, myValue, '', 1 );
}
}
7 edb Feb 20, 2008 00:01
:D
Well I see I am totally on the wrong track there but I'm still curious the correct way to do it.