转自:http://outofmemory.cn/code-snippet/3763/tinymce-language
tinymce4发布了,比以前的更简洁更漂亮了,下载下来简单的折腾了一下,发现默认的langs目录下没有文件,可以到这里来下载需要的语言包。
下载语言包之后需要放在<your tinymce path>/js/tinymce/js/langs/目录下面。
然后再配置tinymce时指定language属性即可,例如下面的例子
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>tinymce 4 editor</title> 5 </head> 6 <body> 7 8 <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script> 9 <script type="text/javascript" src="./js/tinymce/tinymce.min.js"></script> 10 <script type="text/javascript" src="./js/tinymce/jquery.tinymce.min.js"></script> 11 <script type="text/javascript"> 12 tinymce.init({ 13 selector: "textarea", 14 plugins: [ 15 "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker", 16 "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", 17 "table contextmenu directionality emoticons template textcolor paste fullpage textcolor" 18 ], 19 20 toolbar1: "undo redo | cut copy paste | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect", 21 toolbar2: " searchreplace | bullist numlist | outdent indent blockquote | link unlink anchor image media code | inserttime preview | forecolor backcolor", 22 toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft", 23 24 menubar: false, 25 toolbar_items_size: ‘small‘, 26 27 style_formats: [ 28 {title: ‘Bold text‘, inline: ‘b‘}, 29 {title: ‘Red text‘, inline: ‘span‘, styles: {color: ‘#ff0000‘}}, 30 {title: ‘Red header‘, block: ‘h1‘, styles: {color: ‘#ff0000‘}}, 31 {title: ‘Example 1‘, inline: ‘span‘, classes: ‘example1‘}, 32 {title: ‘Example 2‘, inline: ‘span‘, classes: ‘example2‘}, 33 {title: ‘Table styles‘}, 34 {title: ‘Table row 1‘, selector: ‘tr‘, classes: ‘tablerow1‘} 35 ], 36 37 templates: [ 38 {title: ‘Test template 1‘, content: ‘Test 1‘}, 39 {title: ‘Test template 2‘, content: ‘Test 2‘} 40 ], 41 language:‘zh_CN‘ 42 });</script> 43 44 <form method="post" action="somepage"> 45 <textarea name="content" style="width:100%"></textarea> 46 </form> 47 48 </body> 49 </html>
TinyMCE编辑器
时间: 2025-01-06 23:42:03