michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
339 stars 71 forks source link

Error: TinyMCE Buttons on repeatable Sections #100

Closed patrickf0 closed 10 years ago

patrickf0 commented 10 years ago

When you repeat a section with an RichTextEditor in it, the TinyMCE buttons are empty (see image below).

Besides a reload of the page solves the problem.

bildschirmfoto 2014-04-28 um 15 32 13

 $this->addSettingSections(
        array(
            'section_id'    =>  'slider',
            'repeatable'    =>  array(
                'max'   =>  5,
                'min'   =>  1,
            ),
        )
    );

    $this->addSettingFields(
        array(
            'field_id'      =>  'slider_text',
            'section_id'    =>  'slider',
            'title'         =>  'Slidertext',
            'type'          =>  'textarea',
            'rich'          =>  true
        ),
        array(
            'field_id'              =>  'slider_image',
            'section_id'            =>  'slider',
            'title'                 =>  'Teaser Icon',
            'description'           =>  'Format: max. 410 x 510px',
            'type'                  =>  'image',
            'attributes_to_store'   =>  array( 'alt', 'id', 'title' ),
            'attributes'    => array(
                'preview'   => array(
                    'style' => 'max-width:200px;'
                ),
            ),
        )
    );
michaeluno commented 10 years ago

Yeah. The rich text editor is not supported for repeatable fields as well as some other custom field types that rely on jQuery. The problem is that I have not found a solution for it.

If you know a way and can suggest some code, it would be appreciated. I've found this article and it may help: http://www.kathyisawesome.com/426/multiple-wordpress-wysiwyg-visual-editors/

michaeluno commented 10 years ago

I've been working on this enhancement and made it almost done except quick tags. I could only make TinyMCE editors repeatable. It seems quick tags cannot be repeated as reported here.

michaeluno commented 10 years ago

Updated the 3.1.6b branch: https://github.com/michaeluno/admin-page-framework/tree/3.1.6b Download. https://github.com/michaeluno/admin-page-framework/archive/3.1.6b.zip

It supports repeating TinyMCE editors. However, it still has a problem with repeating WordPress Quick Tags. What I did was simply remove the element holding quick tags if the field is repeated.

Also, it includes a change that affects the behavior of repeating form sections. So anybody using repeatable sections, please test it if it does not break anything.