7

私は以下を使用しています:

    <textarea
    data-ui-tinymce="tinymceOptions"
    data-ng-disabled="modal.action=='delete'"
    data-ng-model="modal.formData.text"
    id="inputText"
    rows="20"
    required></textarea>

Tinymce が表示されたときの高さはわずか数センチです。デフォルトが最初に表示されたときの高さを変更するにはどうすればよいですか?

私が使用しているオプションのリストは次のとおりです。

selector: "textarea",           
plugins: [
                        "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
                        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                        "table contextmenu template textcolor paste fullpage textcolor"
                ],

                toolbar1: "bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect fontselect fontsizeselect",
                toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | code | inserttime preview | forecolor backcolor",
                toolbar3: "table | hr removeformat | subscript superscript | charmap | print fullscreen | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft",

                menubar: false,
                toolbar_items_size: 'small',

                templates: [
                        {title: 'Test template 1', content: 'Test 1'},
                        {title: 'Test template 2', content: 'Test 2'}

]

4

6 に答える 6

23

JavaScript から

tinymce.init({
   selector: 'textarea',
   height: 200
});

またはhtmlから

<textarea style="height: 200px;">
于 2016-11-21T10:46:48.733 に答える
0

それは私にとってはうまくいきます(setTimeoutの部分を参照)

$(function () {
    window.init_tinymce = function (id, custom_config) {
        var textarea = $('#' + id);

        // Default TinyMCE configuration
        var basic_config = {
            mode: 'none',
            plugins: "link",
            menu: 'none',
            toolbar: 'bold | formatselect | link'
        };

        tinymce.init($.extend(basic_config, custom_config));
        ...

        setTimeout(function(){ //wait for tinymce to load
            console.log('timeout');
            $(tinymce.editors[0].iframeElement).contents().find('body')
                .css('min-height', $(tinymce.editors[0].contentAreaContainer).height() * .9);
        }, 1000);
    };
});

于 2015-05-31T15:54:51.837 に答える