如何在tinymce编辑器中启用字体系列和颜色选项?

问题描述 投票:0回答:4

我在我的cms上使用tinymce编辑器,它有一个普通的文本工具栏,其中有粗体、斜体、下划线和对齐选项,但它没有字体系列更改选项,甚至没有颜色更改。如何启用?

javascript fonts tinymce
4个回答
12
投票

我就是这样做的

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",
)};

8
投票

对于升级版本,这里是全功能示例

  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/


5
投票

在我的旧版本 TinyMCE 4.0.10 中,除了其他初始化工具栏和插件选项之外,字体和颜色控件也像这样添加到tinymce.init:

toolbar: "styleselect fontselect fontsizeselect | forecolor backcolor",
plugins: "textcolor"

0
投票

你能告诉我在哪个文件中进行更改吗?在这个editor_styles.css中?

© www.soinside.com 2019 - 2024. All rights reserved.