2013-11-25 17 views
14

Tôi muốn thêm thay đổi kiểu phông chữ cho văn bản;TinyMCE 4 Thay đổi kiểu phông chữ như thế nào?

Đối với nó, tôi sử dụng kịch bản này:

tinymce.init({ 
    selector: selector_id, 
    theme: "modern", 
    theme_modern_font_sizes: ["6px,7px,8px,9px,10px,11px,12px,13px,14px,15px,16px,17px,18px,19px,20px,21px,22px,23px,24px,25px,26px,27px,28px,29px,30px,31px,32px,36px,38px,40px"], 
    font_size_style_values: ["6px,7px,8px,9px,10px,11px,12px,13px,14px,15px,16px,17px,18px,19px,20px,21px,22px,23px,24px,25px,26px,27px,28px,29px,30px,31px,32px,36px,38px,40px"], 
/* width: 300, 
    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 template paste textcolor" 
    ], 
    content_css: "./style.css", 
    toolbar: "insertfile undo redo | fontsizeselect | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor", 
    style_formats: [ 
     {title: 'Bold text', inline: 'b'}, 
     {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, 
     {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, 
     {title: 'Example 1', inline: 'span', classes: 'example1'}, 
     {title: 'Example 2', inline: 'span', classes: 'example2'}, 
     {title: 'Table styles'}, 
     {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} 
    ], 
    file_browser_callback : elFinderBrowser , 
    spellchecker_languages : '+Русский=ru,English=en' 
}); 

Nhưng bên trong font-size của tôi (6px, 7px, 8px, 9px một khác) tôi thấy 8pt, 10px, 12pt và khác.

Hãy cho tôi biết lý do tôi không thấy kích thước phông chữ của mình được chọn và làm cách nào để làm cho đúng?

Trả lời

26

Đường nối thiết lập của bạn là dành cho tinymce 3.x. Quên rằng, nâng cấp lên 4.x và sử dụng như sau:

tinymce.init({ 
     fontsize_formats: "8pt 9pt 10pt 11pt 12pt 26pt 36pt", 
     theme: 'modern', 

và sau đó trong thanh công cụ:

toolbar: "undo redo pastetext | styleselect | fontselect | fontsizeselect" 
0

Làm thế nào để thay đổi kích thước phông chữ trong wordpress & MCE nhỏ, không cần mã hóa ... chỉ -

1.Use plugin 'TinyMCE Advanced'

  1. Kích hoạt nó trong cài đặt.

Hướng dẫn chi tiết khác here.

-2

Đối với phiên bản Version 4.1.9

Bạn sẽ cần phải chỉnh sửa chủ đề đang hoạt động functions.php với điều này:

// Customize mce editor font sizes 
if (! function_exists('wpex_mce_text_sizes')) { 
    function wpex_mce_text_sizes($initArray){ 
     $initArray['fontsize_formats'] = "9px 10px 12px 13px 14px 16px 18px 21px 24px 28px 32px 36px"; 
     return $initArray; 
    } 
} 
add_filter('tiny_mce_before_init', 'wpex_mce_text_sizes'); 

tham khảo: http://www.wpexplorer.com/wordpress-tinymce-tweaks/

Các vấn đề liên quan