4

I’ve been looking for a way to do this. I have a style sheet that is loaded into TinyMCE. The style sheet is generated via my content management system based of the active template. Problem is I can not get TinyMCE to let me select multiple CSS classes to a signle element. Here is a example:

.left_round_thumb_small { 
    width:65px;
    height:65px;
    border-radius:35px;
    -moz-border-radius:35px;
    -webkit-border-radius:35px;
    -khtml-border-radius:35px;
    background:url(/skins/msc_2013/images/lines.png) repeat; 
    float:left; 
    margin:0 25px 0 0;
}
.center_round_thumb_large { 
    width:162px;
    height:162px;
    border-radius:85px;
    -moz-border-radius:85px;
    -webkit-border-radius:85px;
    -khtml-border-radius:85px;
    background:url(/skins/msc_2013/images/lines.png) repeat; 
    position:relative;
    margin:0 25px 0 0;
}

.round_border_black {border:1px solid black;}
.round_border_red {border:1px solid red;}
.round_border_blue {border:1px solid #00aeef;}
.round_border_green {border:1px solid #3cb64b;}

Now I know I could go in and do something like:

tinyMCE.init({
    style_formats : [
        {title: 'Left Thumb Black', classes: 'left_round_thumb_small round_border_black'},
        {title: 'Center Thumb Blue', classes: 'center_round_thumb_small round_border_blue'},
    ]
});

Now seeing that this style sheet loaded into TinyMCE is generated based of the CMS’s active template. If I were to change the template I would also have to change the style code. Which will be come a major hassle in the future.

So anyone knows of a code patch to the style selector or plugin that will let me do this?

4

2 に答える 2

-1

名前に基づいてclasses-複数形であり、他の構成設定の例の構文にも基づいて、次のようになるはずです。

tinyMCE.init({
    style_formats : [
        {title : 'Style1', classes : {'left_round_thumb_small','round_border_black'} },
        {title : 'Style2', classes : {'center_round_thumb_small','round_border_blue'} },
    ]
});
于 2013-07-19T12:09:24.160 に答える