Posted by Screenack on December 18, 2009 at 11:04pm
Drupal 6/WYSIWYG 6.x-2.x-dev/TinyMCE 3.2.7
I'm sure I am using the wrong model.
Say I have the following:
p.big { font-size: 18px; line-height: 22px; }
I'd like to be able to allow a user to select a paragraph and apply, say, the p.big class via the TinyMCE style drop down. Currently, however, it only applies this as a span tag, i.e., span class="big" which I do not want. What have I got backwards?
As always thanks in advance!

Comments
Hmmmm...
Interestingly, if I select all the text in the textarea and apply the .big style, it applies the 'class="big"' to all paragraph tags (which is kinda what I want.) If I select a range of characters (even if it appears to be the entire paragraph) I get the span class="big".
It is inconsistent but I can train around it.
Kyle, Unfortunately, that is
Kyle,
Unfortunately, that is an inherent problem with using WYSIWYG editors. Since you can't see the HTML, you can't purposefully select it, so the WYSIWYG has a hard time knowing the different between selecting all of the text in an element or just part of that text. When using WYSIWYG styles like you are, I usually make my styles apply to the element I want to target as well as anything inside that element.
For example, I would change your CSS to:
p.big,p .big {
font-size: 18px;
line-height: 22px;
}
Interesting
Thanks. I usually don't use WYSIWYG interfaces on sites I personally maintain and the rendered html can get ugly quickly. What do you think of the "lightweight" markup languages, like markdown or textile? I didn't like the idea at first but it may be easier to hand off than the WYSIWYG approach?
After having read a few snippets on markdown and textile, I'm finding some interesting applications of these models that simplify content creation and markup even on stuff I maintain.