PDA

View Full Version : How to add icon to insert bbtag around some text.


mtha
09-26-2005, 05:20 AM
I want to add some custom icons (like [superscript], ) to editor toolbar, and have them clickable, some bbcode [sub] or [sup] will wrap around the selected text.

In WYSIWYG, it should display the text as superscript or subscript.

base on kirby's file, I have the code added

https://vborg.vbsupport.ru/showthread.php?t=83268


In editor_toolbar_on template, I have the icon added

<td><div class="imagebutton" id="{$editorid}_cmd_subscript"><img src="$stylevar[imgdir_editor]/subscript.gif" width="21" height="20" alt="subscript" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_superscript"><img src="$stylevar[imgdir_editor]/superscript.gif" width="21" height="20" alt="superscript" /></div></td>

These icons are clickable in WYSIWYG,

If I switch to standard editor, the icon is not clickable.

How can I make it so that when I click on the icon, [sub] will wrap around some selected text?

PS. Adding custom BBCode in admincp just wrap the [sub] around selected text, but not display them as designed in WYSIWYG mode



.........



:) got it.

In vbulletin_textedit, I need to add


case 'subscript':
case 'superscript':
{
this.wrap_tags(cmd.substr(0, 3), false);
return;
}

above
case 'justifyleft':
case 'justifycenter':


Dont know if there's another way to do it :)