Forum closed. New forum available at http://community.wymeditor.org/

<hr /> custom button

Support forum for WYMeditor.

<hr /> custom button

Postby mykel_suthertun on Mon Sep 08, 2008 4:09 pm

I've added a custom button to add horizontal rules. When I click the button, it appears to automatically add another blank paragraph above it, but when I view the source there's no paragraph tag added. I assume it's just a problem with my styles, but I'm not positive.

Here's my custom button js:
Code: Select all
// Horizontal Rule
var html = "<li class='wym_tools_hr'>"
    + "<a name='HorizontalRule' href='##'"
    + " style='background-image:"
    + " url(#request.LayoutRoot#images/icon_wymeditor.png)'>"
    + "Horizontal Rule"
    + "<\/a><\/li>";
//add the button to the tools box
jQuery(wym._box)
    .find(wym._options.toolsSelector + wym._options.toolsListSelector)
    .append(html);
//handle click event
jQuery(wym._box)
    .find('li.wym_tools_hr a').click(function() {
    //do something
    wym.paste('<hr />');
    return(false);
});


Do I need to include anything else in my script or my styles to get this to function correctly? Thanks!
mykel_suthertun
 
Posts: 3
Joined: Fri Sep 05, 2008 6:41 pm

Re: <hr /> custom button

Postby mr_lundis on Tue Sep 09, 2008 6:28 pm

Hi !

You can't use the paste function to insert block-level html into the editor (I know, it's kind of confusing), check out this thread for more info.

Cheers.
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron