DEV Community

Samson Adesanoye
Samson Adesanoye

Posted on

1

How to use TinyMCE In Your Custom Voyager View

TinyMCE is an online rich-text editor released as open-source software, its website describe it as the most advanced WYSIWYG HTML editor designed to simplify website content creation. It has the ability to convert HTML textarea fields or other HTML elements to editor instances. It is the default textarea fields editor used in Voyager (The Missing Laravel Admin).

Here are the steps in including TinyMCE in your custom voyager view:

  1. Create textarea field add the class richTextBox to the textarea. i.e
<textarea  class="form-control richTextBox" name="body" required>
{!!  old('body') !!}
 </textarea> 
Enter fullscreen mode Exit fullscreen mode

Here is an example commit to voyager source code where TinyMCE was implemented and you can draw some ideas from it.

  1. Customize the minimum height of TinyMCE: The default minimum height of TinyMCE in Voyager is 600 in height, and it is represented with the min_height variable.
var additionalConfig = {
      min_height: 100,
}

$.extend(additionalConfig, {!! json_encode($options->tinymceOptions ?? '{}') !!})

tinymce.init(window.voyagerTinyMCE.getConfig(additionalConfig));
Enter fullscreen mode Exit fullscreen mode

Source:

List of possible key and value

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay