如何设置tinymce textarea的高度

how to set height of tinymce textarea

无法设置tinymce 文本区域的高度。根据documentation,它应该与原来替换的文本区域的高度相同,在我的例子中 - 500px。

tinymce.init({
    selector: "#texedit",
    body_class: 'tiny01',
    content_css: "content.css",
});

content.css

.tiny01{
    background:lightgreen;
    overflow-y:scroll;
    height:500px;  // deosn't work
}

#texedit{
    height:500px;  // deosn't work
}

main.css

#texedit{
    height:500px;  // deosn't work
}

texedit 不是 500px 而是大约 100px 高度。

您需要在初始化调用中设置此值。

tinymce.init({
    selector: "#texedit",
    body_class: 'tiny01',
    content_css: "content.css",
    height: "500"
});

在您的 css 文件中添加您的 ID 并指定高度

tinymce.init({
  selector: "#mytextarea"
});
#mytextarea {
  height: 700px;
  /*edit this*/
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/tinymce/4.1.2/tinymce.min.js">
</script>
<textarea id="mytextarea">Congratulations!</textarea>