简体   繁体   中英

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. Do not wanna use an separat .css file. Have no access to the configuration of the editor, no tinmce.init(). Weirdly, cannot access the tinymce editor with style.

<!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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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