I'm trying to integrate tinyMCE with my component but I'm getting issues with embedding tinyMCE JS and switching it from default. I've tried removing WYSIWYG.attach and replacing with the below. Then renaming textarea id= to textarea id=\"mytextarea1\" but no luck.

<script src='https://cloud.tinymce.com/stable/tinymce.min.js'></script>
        selector: '.mytextarea1'
if ($type=="text") {
        if (strpos($name,"color")) { 
            $picker = "<a href=\"javascript:TCP.popup(document.forms[3].elements['$name'], 1)\"><img width=\"15\" height=\"13\" border=\"0\" alt=\"Click Here to Pick up the color\" src=\"img/sel.gif\"></a>";
        $this->form .= "<tr><td>$display : </td><td><input type=\"text\" size=\"$size\" name=\"$name\" value=\"$value\">$picker</td></tr>";         
    if ($type=="textarea") {
        $this->form .= "<tr><td>$display : </td><td><textarea rows=\"$size\" cols=\"40\" name=\"$name\">$value</textarea></td></tr>";           
    if ($type=="ow") {
        $size = $size."px";
        $this->form .= "
            <script type=\"text/javascript\">
                WYSIWYG.attach('text', full);

                <td>$display : </td>
                <td><textarea id=\"text\" style=\"width:80%;height:$size;\" name=\"$name\">$value</textarea></td>
    if ($type=="hidden") {
        $this->form .= "<input type=\"hidden\" name=\"$name\" value=\"$value\">";           

  • 1
    To elicit a useful response, I suggest elaborating on "issues". For example, is there a specific error message or what's not working? – Neil Robertson Jun 18 '19 at 5:31
  • @NeilRobertson There's no errors, it's essentially only allowing the default text editor, I cannot embed the tinyMCE regardless of the text area ID and class There's lots of variables but the essential piece of code its above which dictates the form values. I amend the above and it still remains text default. – ABC Group Jun 18 '19 at 5:42
  • Why do you want to force the use of tinyMCE in your component? It seems counter intuitive to the idea of having a default Editor and allowing the end users to override it to suit their own preferences. ACYmailing has its own editor that is used instead of the default/user-defined editor so you may be able to look at how they implement that for your own code. – Irata Jun 18 '19 at 6:31
  • @Irata its editor is text only. This is in the admin dashboard, we want it to have a visual editor so it's simplified for the other admin to insert images and text etc. I've placed the JS for tinyMCE at the head and it allows me to mark up with html now, however no visual editor. – ABC Group Jun 18 '19 at 7:08
  • You don't seem to be using JForm API for your form. If you were, you could just change the editor in the form definition. We may need more context here. How and where is this code generated. What are the variables in your code and where do they come from? – Sharky Jun 18 '19 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.