tinymce.mdx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. title: TinyMCE
  3. libs: tinymce
  4. description: The WYSIWYG editor that is flexible, customizable, and designed with the user in mind. TinyMCE can handle any challenge, from the most simple implementation through to the most complex use case.
  5. ---
  6. [TinyMCE](https://www.tiny.cloud/docs/) documentation.
  7. ## Default text editor
  8. Initialize TinyMCE 6 on any element (or elements) on the web page by passing an object containing a selector value to `tinymce.init()`. The selector value can be any valid CSS selector.
  9. ```html example code centered columns={2} height="25rem"
  10. <form method="post">
  11. <textarea id="tinymce-default">Hello, <b>Tabler</b>!</textarea>
  12. </form>
  13. <script src="$TABLER_CDN/dist/libs/tinymce/tinymce.min.js" defer></script>
  14. <script>
  15. document.addEventListener("DOMContentLoaded", function() {
  16. let options = {
  17. selector: '#tinymce-default',
  18. height: 300,
  19. menubar: false,
  20. statusbar: false,
  21. plugins: [
  22. 'advlist autolink lists link image charmap print preview anchor',
  23. 'searchreplace visualblocks code fullscreen',
  24. 'insertdatetime media table paste code help wordcount'
  25. ],
  26. toolbar: 'undo redo | formatselect | ' +
  27. 'bold italic backcolor | alignleft aligncenter ' +
  28. 'alignright alignjustify | bullist numlist outdent indent | ' +
  29. 'removeformat',
  30. content_style: 'body { font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }'
  31. }
  32. if (localStorage.getItem("tablerTheme") === 'dark') {
  33. options.skin = 'oxide-dark';
  34. options.content_css = 'dark';
  35. }
  36. tinyMCE.init(options);
  37. })
  38. </script>
  39. ```