tinymce教程1–基本例子

1.最简单例子,按照官方文档来,稍微修改了下

<script type="text/javascript" src="/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
    selector: "textarea",
    language : 'zh_CN',
    theme: "modern",
    height: 300,
    plugins: [
         "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
         "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
         "save table contextmenu directionality emoticons template paste textcolor"
   ],
   content_css: "css/content.css",
   toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor fontselect fontsizeselect emoticons", 
   
 }); 
</script> 
 
<form id="form" method="post">
    <input id="title">
    <textarea id="content"></textarea>
</form>

 

 

2.换成中文

http://www.tinymce.com/i18n/ 下载中文zh_CN.js。copy到工程,修改init参数

 

3.添加字体

修改tinymce.min.js,查找fontselect关键字,把自己想要的字体加进去

效果:

 

4.修改默认字体

修改content.min.css,在body的font-family添加SimSun,Microsoft YaHei

 

5.修改行距,即是修改<p>样式

修改content.min.css,在这个文件最前面加入p{margin:5px;padding:0;}

你可能感兴趣的:(tinymce)