我在PHP脚本中使用tinyMCE4。我使用css类选择器,我的配置位于我自己的tinymce.js文件中:
tinymce.init({
entity_encoding : "raw",
selector: '.wysiwyg',
toolbar: 'styleselect | undo redo | bold italic underline | link image | forecolor backcolor | hr | table code | alignleft aligncenter alignright alignjustify',
menubar: "",
contextmenu: "bold italic underline forecolor backcolor | bullist numlist | link | cell row column deletetable",
content_css : ["/css/style-tinymce.css", "//fonts.googleapis.com/css?family=Lato:300,300i,400,400i"],
//valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
image_caption: true,
image_advtab: true,
style_formats_merge: true,
style_formats: [
{title: 'Imagen a la Izquierda', selector: 'img', styles: {
'float' : 'left',
'margin': '0 10px 0 10px',
'width': '100%',
'height': 'auto'
}},
{title: 'Imagen a la Derecha', selector: 'img', styles: {
'float' : 'right',
'margin': '0 10px 0 10px',
'width': '100%',
'height': 'auto'
}},
{title: 'Imagen Centrada', selector: 'img', styles: {
'margin-left': 'auto !important',
'margin-right': 'auto !important',
'width': '100%',
'height': 'auto'
}},
{ title: 'Encabezado',
block: 'h2',
styles: { 'color': '#0871ad' }
},
{ title: 'Texto Resaltado',
inline: 'span',
styles: { 'color': '#000000',
'background-color': '#f6f433'
}
}
]
});
tinymce.init({
selector: '.wysiwygUser',
inline: true,
menubar: false,
toolbar: 'bold | italic'
});
出现在.wysiwyg
类的文本区域中的选择器工作正常,而类.wysiwygUser
则什么也没有显示。
为什么不起作用?