We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7155
    • 160 Posts
    How do I use TinyMCE in my own module?

    I want the user to be able to type in rich text content that will be saved in the database for my specific purposes.
      • 241
      • 8 Posts
      I am working on the same issue myself- building a custom module and I want to use tinyMCE for textareas. Now, I’ve used tinyMCE before, so I know how to call it if I just want to assume the current install directory, however, Modx seems to put it in assets/plugins/tinymce3201, which seems a bit odd and left me thinking that maybe there’s a nifty API which returns the current install directory of the installed tinyMCE. If not, I’ll happily plug-along with hard-coding it, just seems like something that’ll break at some point.

      Any clues on whether such an API exists?

      - Aaron Anderson
      • Not that I know of. The plugin is hard-coded.
        // Set the name of the plugin folder
        $pluginfolder = "tinymce3201";
        
        include_once $modx->config['base_path'].'assets/plugins/'.$pluginfolder.'/tinymce.lang.php';
        

          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 241
          • 8 Posts
          Thanks - I’ll give it a shot tomorrow - looks more elegant than what I was going to do smiley

          - Aaron
          • You can set this in the module’s configuration to make it easier to change.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 23304
              • 3 Posts
              Hi,

              I too want to have tinymce (or another rte) available in the 'front-part' of my site (not just in the manager). What adaptations do I have to make?

              Thnx for your answer in advance.