是否有任何方法可以防止某些自定义wysiwyg样式应用于某些HTML元素?
假设我有两种风格,叫做“红色”和“框架式”。一种颜色是红色文本,而另一种颜色则是在照片周围放置一个框架。
当高亮显示文本或图像时,我能控制哪些样式可用吗?例如,我希望样式“框架”在突出显示文本时不可用,而样式“红色”在突出显示图像时不显示在“样式”下拉菜单中。
发布于 2015-05-12 08:44:57
Tinymce的配置在银色条纹中有点棘手,不过一旦你开始运行它,它看起来就很容易了。
Jonom写下了一些心里话,并把它写到了Github上,叫做一尘不染模块在那里你可能会找到一个可行的解决方案。。因此,最好是尝试这个模块,因为它添加了一些自定义css到编辑器。
从那里复制,放入/mysite/_config.php
$formats = array(
// Define the styles that will be available in TinyMCE's dropdown style menu
// * Use 'selector' to specify which elements a style can be applied to
// * See Headings example below for explanation of different settings
// * Using 'classes' allows a class to be combined with others while 'attributes'=>'style' removes other classes before applying
// Text styles
array(
'title' => 'Selected text'
),
array(
'title' => 'highlight red',
'classes' => 'red',
'inline' => 'span',
'selector' => 'i,em,b,strong,a'
),
array(
'title' => 'Images',
),
array(
'title' => 'Put a frame around a photo',
'attributes' => array('class'=>'framed'),
'selector' => 'img'
)
);
//Set the dropdown menu options
HtmlEditorConfig::get('cms')->setOption('style_formats',$formats);
希望这会有帮助,wmk
https://stackoverflow.com/questions/30129379
复制相似问题