Wordpress tinymce editor height bug

好久不见. 提交于 2019-12-23 05:22:34

问题


The screenshot shows the issue: toolbar/content height.

tinymcse related code:

// wordpress plugin:

add_filter('admin_head', array($this, 'editor_tiny_mce'));
add_filter('tiny_mce_before_init', array($this, 'change_mce_options'));

function editor_tiny_mce()
{
    wp_enqueue_script('common');
    wp_enqueue_script('jquery-color');
    wp_print_scripts('editor');
    if (function_exists('add_thickbox'))
    {
        add_thickbox();
    }
    wp_print_scripts('media-upload');
    if (function_exists('wp_tiny_mce'))
    {
        wp_tiny_mce();
    }
    wp_admin_css();
    wp_enqueue_script('utils');
    do_action("admin_print_styles-post-php");
    do_action('admin_print_styles');
}

function change_mce_options($init)
{
    $init['height'] = '480px'; // this not works
    return $init;
}

// html code

<?php
echo the_editor(stripslashes($pages_about_us_content), 'pages_about_us_content');
?>

I tried solve it with this code too:

$("iframe[id$='_ifr']").height(500); // this not works

because all tinymce frames ends with _ifr but no luck. This only seems occur when editor shows only one toolbar.

Please any advice is welcome.


回答1:


Try this (just add this code snippet inside your functions.php only for editor's toolbar size)

add_filter('admin_head', 'editor_tiny_mce');
function editor_tiny_mce(){
?>
    <style>
    table td.mceToolbar{
      height:100px !important;
    }
    </style>
<?php
}

The screenshot has been taken with height of 200px and you can also try height:auto !important; Note: It's also possible to enqueue a css file with this code using 'wp_enqueue_style' function.



来源:https://stackoverflow.com/questions/9864318/wordpress-tinymce-editor-height-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!