1

Topic: advanced_styles_css and using divs instead of spans

Due to the way a span format's css in Firefox, I need the "custom css styles" option to use a div instead of a span. What/where would I need to change to make these changes accurate???

2

Re: advanced_styles_css and using divs instead of spans

Right, I'm going to post this quick-fix here and a link to it in all the other threads I find with the same question.

Find the following code in tiny_mce.js:

var wrapper=value['wrapper']?value['wrapper']:"span";

and replace the span with div so it reads as follows:

var wrapper=value['wrapper']?value['wrapper']:"div";

Easy eh?



Now, as has been stated in other similar topics it does cause problems as applying a style to a word in the middle of a sentence for example will cause the styled section to go on it's own line and mess up your paragraph, but that's a minor drawback for us folks who need this wink

What I would like to see in future from the developers is a simple switch when calling styles in the editor in advanced mode. As an example, here's some styles I'm playing about with and the line used to include them in the styles list:

theme_advanced_styles : "Image Left=screenshotleft;Highlight=highlight",

Now in this case "screenshotleft" wraps a div around an image which is what I need it to do. But my "higlhight" should really be a span. Wouldn't it be so much easier of you could specify this in the above code so that d = div and s = span? Something like this would be cool:

theme_advanced_styles : "Image Left=screenshotleft:d;Highlight=highlight:s",

So the colon : can be split in the javascript to get the s for span or d for div.

Now all I have to do is bug the developers because the actual code to make this work will be a lot more complicated wink

3

Re: advanced_styles_css and using divs instead of spans

There is a hackier way to do it though - once the style ahs been selected, some custom javascript could be called to change the span to a div after tinymce has finishes applying the style, but that wouldn't be ideal.

4

Re: advanced_styles_css and using divs instead of spans

Thanks for this little workaround. Saved me some time smile

5

Re: advanced_styles_css and using divs instead of spans

May be it is a bit late. But I change the:

var wrapper=value['wrapper']?value['wrapper']:"span";

to

var wrapper = value.wrapper ? value.wrapper : "span";
if (svalue.indexOf("div.") != -1 || svalue.indexOf("span.") != -1) {
  wrapper = svalue.substring(0,svalue.indexOf("."));
  svalue = svalue.substring(svalue.indexOf(".") + 1);
}

With these change, if I write:

theme_advanced_styles : "Div style=div.aDivStyle;Span style=span.aSpanStyle;Default style=defaultStyle",

the final HTML code will look like:

div class="aDivStyle" .......
span class="aSpanStyle" .......
span class="defaultStyle" .......

Pete, your idea was the insperation.