dynamic WYSIWYG?

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
von-hamster
Power Poster
Power Poster
Posts: 339
Joined: Thu Nov 01, 2007 3:11 pm

dynamic WYSIWYG?

Post by von-hamster »

My form with textarea loading with AJAX, but if textarea with wysiwyg - it not worked.
Module generate Initial wysiwyg javascript file for static page with predefined textarea fields. Can I use (and how) standart functional for turn wysiwyg on any new created fields?

PS. Sorry 4 my english :(
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: dynamic WYSIWYG?

Post by JohnnyB »

You might try the Advanced settings tab for TinyMCE. There is an option called, Extra Configurations.

You can try adding something like:
elements : "elm1,elm2"

Where elm1 is the div ID or class you need as a WYSIWYG.

There's also this:
http://www.tinymce.com/wiki.php/Configu ... r_selector
http://www.tinymce.com/wiki.php/Configu ... x:elements

Other than that, the alternative is setting TInyMCE to use a Static configuration file which is placed into the /tmp/ directory. Then you can manually edit the Javascript init() call in that file.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
von-hamster
Power Poster
Power Poster
Posts: 339
Joined: Thu Nov 01, 2007 3:11 pm

Re: dynamic WYSIWYG?

Post by von-hamster »

Thanks.
But my module has dynamic textarea id's, not predefined.
I found next solution:
1. On main page (for include tinymce scripts):

Code: Select all

        $module = cms_utils::get_wysiwyg_module();
        $module->wysiwygactive = true;
        $module->WYSIWYGTextArea('fakeTextAreaForLoadTiny');
        echo $module->WYSIWYGGenerateHeader();
2. for each textarea with wysiwyg add property: data-wysiwyg="true"
3. after ajax form load:

Code: Select all

    // dlg - form container
    $('textarea[data-wysiwyg="true"]', dlg).each(function(){
        var tId = $(this).attr('id');
        try {
            var ins = tinyMCE.getInstanceById(tId);
            if (ins) {
                tinyMCE.remove(ins);
            }
        } catch(e) {
            console.log(e);
        }
        tinyMCE.execCommand('mceAddControl', true, tId);
    });
Post Reply

Return to “The Lounge”