简体   繁体   English

如何在嵌入TinyMCE编辑器的页面中使用内部样式表?

[英]How to Use an Internal Style Sheet in The Page Where The TinyMCE Editor Is Embedded?

Want to modify the tinymce editor through embedded style within the html. 要通过html中的嵌入式样式修改tinymce编辑器。 Do not wanna use an separat .css file. 不想使用separat .css文件。 Have no access to the configuration of the editor, no tinmce.init(). 无权访问编辑器的配置,无tinmce.init()。 Weirdly, cannot access the tinymce editor with style. 奇怪的是,无法使用样式访问tinymce编辑器。

<!DOCTYPE html>
<html>
<head>
<script src='https://cloud.tinymce.com/stable/tinymce.min.js'></script>
<style>
    body#tinymce.mce-content-body {
        background-color:red !important;
    }
</style>
<script>
    tinymce.init({
        selector: '#mytextarea'
    });
</script>
</head>

<body>
    <h1>TinyMCE Quick Start Guide</h1>
    <form method="post">
        <textarea id="mytextarea">Hello, World!</textarea>
    </form>
</body>
</html>

Any ideas? 有任何想法吗?

Have you looked at the content_style option for the TinyMCE configuration? 您是否看过TinyMCE配置的content_style选项?

https://www.tinymce.com/docs/configure/content-appearance/#content_style https://www.tinymce.com/docs/configure/content-appearance/#content_style

You could also just pass an entire HTML document into TinyMCE and place CSS in the head of the document. 您也可以将整个HTML文档传递到TinyMCE中,然后将CSS放在文档的开头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM