Wordpress tinymce编辑器高度错误 [英] Wordpress tinymce editor height bug

查看:150
本文介绍了Wordpress tinymce编辑器高度错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

屏幕截图显示了问题:工具栏/内容高度。

The screenshot shows the issue: toolbar/content height.

tinymcse相关代码:

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

因为所有的tinymce帧以 _ifr 但没有运气。仅当编辑器仅显示一个工具栏时才会出现这种情况

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

欢迎任何建议。

推荐答案

试试这个(只是只在编辑器的工具栏大小中将此代码段添加到functions.php中。

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
}

屏幕截图的高度为200px,你也可以尝试 height:auto!important;
注意:也可以使用'wp_enqueue_style'函数将此代码排入css文件。

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.

这篇关于Wordpress tinymce编辑器高度错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆