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

providing custom CSS classes to user

Support forum for WYMeditor.

providing custom CSS classes to user

Postby moonlightinred on Mon Nov 30, 2009 3:39 pm

How is this done? It seems pretty straightforward to me, but for some reason, none of my custom classes are available in the drop-down.
This is my javascript (in test.php):
Code: Select all
<script language="javascript" src="wymeditor/jquery.wymeditor.min.js" type="text/javascript"></script>
<script language="javascript" type="application/javascript">
jQuery(function() {
   jQuery('.wymeditor').wymeditor({
      stylesheet: 'wymeditor.css',
      skin: 'twopanels',
                toolsItems: [
                   {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'},
                   {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'},
                   {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'},
                   {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'},
                   {'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'},
                   {'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'},
                   {'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'},
                   {'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'},
                   {'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}
               ]
   });
});
</script>

And then this is my CSS file (wymeditor.css):
Code: Select all
/* WYMeditor */

/* PARA: banana */
.banana {
   background-color: yellow;
}

/* /WYMeditor */

I've also tried variations of this, with no success so far:
Code: Select all
$(document).ready(function() {
   $('.wymeditor').wymeditor({stylesheet: 'wymeditor.css'});
});

When I use the custom CSS reference, it removes all of the formatting from the skin and WYMeditor is useless. When I remove it, it returns to normal, but of course there aren't any selectable classes for me to provide a user. I'm sure I'm doing this wrong and it's a stupid mistake on my part...I'd appreciate any suggestions that y'all might have. If there's an existing thread, please excuse me making another one and direct me to it.

Thanks!
moonlightinred
 
Posts: 4
Joined: Mon Nov 30, 2009 3:29 pm

Re: providing custom CSS classes to user

Postby moonlightinred on Mon Nov 30, 2009 7:07 pm

I thought about just editing my original post, but I decided to respond in case anyone misses me saying I figured it out :oops:

I didn't realize that you can have element-independent classes. For example, my use of ".banana" could be applied to a number of different elements (<p>, <ul>, etc.), so I didn't think I would want to limit it by making it specific (p.banana, ul.banana, etc.). I suppose, though, that it makes sense since this is more about limiting functionality for the end user than maximizing code behind the scenes.

Sorry about that :P
moonlightinred
 
Posts: 4
Joined: Mon Nov 30, 2009 3:29 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest