Recent Topics

1 Feb 19, 2008 17:33    

How would one go about ading a new quicktag. I have found the file


and see how they are generally laid out but I'm having a bit of trouble.

I'm trying to do something like this:

		b2evoButtons[b2evoButtons.length] = new b2evoButton(
				,'img', 'margin-left:8px; class="leftmargin";'
				,'<?php echo T_('IMaGe [Alt-G]') ?>'
			); // special case

The button shows up but does not appear to do anything...What am I doing wrong?

2 Feb 19, 2008 17:40

Well I see I am totally on the wrong track there but I'm still curious the correct way to do it.

3 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 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.


Congratulations then!

5 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 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(
				,'img_left', 'margin-left:8px;'
				,'<?php echo T_('IMaGe [Alt-X]') ?>'
			); // 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( == 'b2evo_img_left' )
				document.write('<input type="button" id="' + + '" accesskey="' + button.access + '" title="' + button.tit
						+ '" 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 );

Form is loading...