隐藏div中的tinyMCE高度弹出显示

时间:2016-09-19 15:49:28

标签: javascript jquery html tinymce

我有三个tinyMCE textareas。其中两个加载隐藏,一个显示。

当我点击其中一个隐藏的时候,tinyMCE显示全屏高度,然后降到正确的高度。

有没有办法在第一场秀中避免这种“跳跃”的高度?尝试从此网站获得一些答案,例如HTML rows中的em高度的硬编码<textarea id="itcs" placeholder="blah blah" rows="4" style="width: 100%; height: 40em;" class="form-control mceEditor " name="itcs">stuff</textarea> 但它仍然会这样做。感谢您的任何建议。

我的HTML

<div class="form-group tscs-container" id="invoice-tscs-container">
    <label for="invoice_instructions" class="control-label">Editor</label>
    {!! Form::textarea('itcs', $organisation->itcs, ['id'=>'itcs', 'placeholder' => 'This is the editor.',
       'rows' => '4', 'style' => 'width:100%; height:40em', 'class' => 'form-control mceEditor '.(($errors->first('itcs')) ? 'error-input' : '')]) !!}
    @if ($errors->has('itcs')) <label class="error-message">{{ $errors->first('itcs') }}</label> @endif
</div>

每个textarea都在一个div中,通过css隐藏它的id:

// Special Instructions editor
tinymce.init({
    mode : "specific_textareas",
    editor_selector : "mceEditor",
    plugins: [
        "autoresize advlist autolink link image lists preview anchor table textcolor paste textcolor colorpicker"
    ],
    toolbar1: "cut copy paste | alignleft aligncenter | bold italic underline image | bullist numlist link unlink | forecolor table preview",
    menubar: false,
    statusbar: false,
    toolbar_items_size: 'small',
    autoresize_bottom_margin: 0,
    content_css: '/css/tinymce-editor.css',
    autoresize_min_height: 150,
    max_chars: 1000,
    setup: function (ed) {
        ed.on('keydown', function (e) {
            if (tinymce.get(tinymce.activeEditor.id).contentDocument.body.innerHTML.length + 1 > this.settings.max_chars) {
                e.preventDefault();
                e.stopPropagation();
                return false;
            }
            return true;
        });
    },
    paste_preprocess: function (plugin, args) {
        var editor = tinymce.get(tinymce.activeEditor.id);
        if (editor.contentDocument.body.innerHTML.length + args.content.length > editor.settings.max_chars) {
            alert('Pasting this exceeds the maximum allowed number of ' + editor.settings.max_chars + ' characters.');
            args.content = '';
        }
    }
});

我的tinyMCE初始化代码是:

$people = "array(".$content.")";

0 个答案:

没有答案
相关问题