我已经建立了一个简单的CSS文件与一个单一的.test类,并在TinyMCE中有以下设置我得到了两个菜单,都是‘段落在顶部。如何编辑CSS样式菜单
tinymce.init({
selector: '#tiny',
menubar:false,
'content_css': 'my-styles.css',
importcss_append: false,
style_formats_merge: true,
plugins: ['importcss'],
toolbar: 'code| insertfile undo redo searchreplace | paste pastetext | formatselect | styleselect '
});格式菜单

css样式菜单

发布于 2020-11-08 02:24:07
下面是一个有效的示例,以防其他人正在查看:
content_style:
'.news-img-left { float: left;margin:1em 1em 1em 0;max-width:400px;height:auto }' +
'.news-img-right { float: right;margin:1em 0 1em 1em;max-width:400px;height:auto }' +
'.news-img-full { margin:1em 0;width:100%;max-width:100%;height:auto }',
style_formats: [
{ title: 'Text Formats' },
{ title: 'Paragraph', format: 'p' },
{ title: 'Heading 1', format: 'h1' },
{ title: 'Heading 2', format: 'h2' },
{ title: 'Heading 3', format: 'h3' },
{ title: 'Image Formats' },
{ title: 'Image Full Width', selector: 'img', classes: 'news-img-full' },
{ title: 'Image Left', selector: 'img', classes: 'news-img-left' },
{ title: 'Image Right', selector: 'img', classes: 'news-img-right' },
],然后我在工具栏中添加了'styleselect‘按钮
发布于 2020-11-17 17:44:23
这个问题也是在中提出的,为了完整起见,我将在这里复制答案。
formatselect和styleselect都会显示当前使用的format。默认格式是“段落”,与<p>标签基本匹配。
样式选择与CSS样式没有任何关系,更多的是从视觉外观的角度来考虑。styleselect和formatselect之间的区别主要在于可用的配置选项:
formatselect按钮是由block_formats option配置的,非常基本。styleselect按钮是通过style_formats option配置的,它要高级得多。它可以包含嵌套菜单,具有组等。https://stackoverflow.com/questions/64537817
复制相似问题