Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
VFE how to create a custom command
kajjubee
Hi
I added a button in the Visual format editor to wrap the user text with <span class="pdfsize"> & then </span>. Couple of issues:
1. I am not able to get the style="toggle" to work. It shows me a dot when I add this style. But if I don't have this style, then I get a normal button. Here's my command statement block in the visualformatconfig.xml:
<command name="jspdfsizeselection" style="toggle">
<caption localeRef="btnPDF" />
<tooltiptext localeRef="cmdPDF" />
</command>
2. I believe that I need to write the javascript in the ewebeditproevents.js but don't know how to implement this. All i need is to wrap the highlighted text by the user (or by having the button pressed like in "bold" using the toggle style above) with <span> & </span>
Can someone please help.
Thanks
K
Find more posts tagged with
Comments
LooseCannon
Add the following to ewebeditproevents.js:
eWebEditProExecCommandHandlers["jspdfsizeselection"] = function(sEditorName, strCmdName, strTextData, lData)
{
var sSelectedText = eWebEditPro[sEditorName].getSelectedText();
eWebEditPro.instances[sEditorName].editor.pasteHTML('<span>'+sSelectedText+'</span>');
}
kajjubee
Thanks a lot, that worked! but I still couldn't get the toggle style to work. Any ideas....?
kajjubee
Although I got the span to work for highlighted text, it continues to wrap with <span> for all the following text. How do I prevent that?
Thanks
LooseCannon
Your seeing the dot because the cfg cannot locate your button image. Try something like:
<command name="jspdfsizeselection" style="toggle">
<image src="[eWebEditProPath]/some_button_image.gif"/>
<tooltiptext>tool_tip_text</tooltiptext>
</command>
sortcolumn.rptdesign
kajjubee
Thanks cannon, I figured that out, but I am still intrigued by the span carrying over to the following text. Any ideas?
Regards,
K
LooseCannon
This is normal behavior for toggled items, bold, italic, etc... You just need to turn the formatting off, toggle, before entering more text.
kajjubee
Thanks Cannon for the reply, but the toggle feature doesn't seem to work for me. It does give me the toggle button, but I don't get the on/off behavior