Home > Blockchain >  Why is the styleselect-button not showing up in my toolbar menu in Tinymce?
Why is the styleselect-button not showing up in my toolbar menu in Tinymce?

Time:05-18

I added the enter image description here

CodePudding user response:

TinyMCE 6 renamed a number of options, UI components, commands, etc... for better consistency (among other reasons). The styleselect toolbar was one of those as can be seen in the Migration Guide: https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/#things-we-renamed.

So to get this working you'd just need to change styleselect to styles in your TinyMCE configuration. For example:

//tinymce_controller.js
import "tinymce"
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = [ "textarea", "css", "output" ]

  connect() {
    tinymce.init({
      selector: ".tinymce-textarea",
      plugins: 'advlist autolink lists link image charmap preview anchor pagebreak code table',
      menubar: true,
      toolbar: "styles | h1 h2 h3 | undo redo | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | code styles table",
      //toolbar_mode: 'floating',
    })
  }

  disconnect () {
    tinymce.remove()
  }

}
  • Related