如何在tinymce编辑器中启用字体系列和颜色选项
how to enable font family and color options in tinymce editor?
我在cms上使用了一个tinymce编辑器,它有一个普通的文本工具栏,其中有粗体、斜体、下划线和对齐选项,但它没有字体族更改选项,甚至没有颜色更改。如何实现这一点?
我已经用这种方式完成了
tinyMCE.init({
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
)};
对于升级版本,这里是完整的示例
tinymce.init({
selector: 'textarea',
height: 500,
theme: 'modern',
plugins: ['advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools'
],
toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
toolbar2: 'print preview media | forecolor backcolor emoticons',
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
content_css: ['//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css',
'//www.tinymce.com/css/codepen.min.css'
]
});
更多参考访问https://www.tinymce.com/docs/demo/full-featured/
在我的旧版本TinyMCE 4.0.10中,除了其他初始化工具栏和插件选项外,字体和颜色控件也像这样添加到了TinyMCE.init中:
toolbar: "styleselect fontselect fontsizeselect | forecolor backcolor",
plugins: "textcolor"
相关文章:
- 如何在tinymce编辑器中启用字体系列和颜色选项
- 无法将字体系列设置为“”;Arial黑色”;通过Firefox中的JavaScript
- 如何在draft.js中设置默认的字体系列和大小
- 无法更改类的字体系列
- Jquery attr() - Mozilla在设计方面表现不同(不同的字体系列或字体大小?)
- 只能使用 jQuery 更改文本的字体系列一次
- 设置内容样式包含字体系列、字体大小和颜色的可编辑列表 (
- )
- 在 CKEditor 中设置字体大小和字体系列
- 使用爬网程序查找多个网站的字体系列
- 按一定间隔自动更改字体系列
- JQuery Mobile-覆盖整个主体的字体系列主题
- 使用javascript更改字体系列字体大小和字体粗细不起作用
- @font face在Chrome中无法呈现正确的字体系列
- 如何获取浏览器支持的字体系列列表
- 选择具有不同字体系列的列表选项-如何做到这一点
- 如何更改新窗口的字体系列
- 选择选项字体系列在MAC os(chrome和safari浏览器问题)和windows safari浏览器问题中不工作
- 允许用户编辑字体系列
- HTML / 更改字体系列
- 如何在 Fabric 中获取整个字体系列列表.js