Custom Fields
Re-Envisioned
Support MB Blocks Strange wysiwyg behavior inside group

  • Creator
    Topic
  • #17764
    Jackky
    Participant

    I’m trying to implement visual editor field inside clonable group like this:

    <?php
    
    $meta_boxes[] = [
        'title'           => 'Текстовые триггеры',
        'id'              => 'text-trigger',
        //'description'     => 'A custom hero content block',
        'type'            => 'block',
        'icon'            => 'awards',
        'category'        => 'tsm',
        'context'         => 'side',
        'render_template' => get_template_directory() . '/gutenberg/text-trigger.php',
        'fields'          => [
            [
                'id'                => 'triggers',
                'type'              => 'group',
                'name'              => 'Контент',
                'clone'             => true,
                'sort_clone'        => true,
                'add_button'        => '+',
                'collapsible'       => true,
                'group_title'       => 'Элемент {#}',
                'save_state'        => true,
                'fields'            => [
                    [
                        'id'                => 'icon',
                        'type'              => 'single_image',
                        'name'              => 'Иконка',
                    ],
                    [
                        'id'                => 'text',
                        'type'            => 'wysiwyg',
                        'name'                => 'Текст',
                        'options'             => [
                                'media_buttons'   => false,
                                'teeny'           => true,
                                'textarea_rows'       => 10,
                        ],
                    ],
                ]
            ],
        ],
    ];

    And that’s what i get (different bugs on load, sorting and adding new):
    null

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #17802
    Anh Tran
    Keymaster

    Hi Jackky, let me check it and will get back to you soon.

    #17845
    Jackky
    Participant

    Also I have noticed, that opts like ‘teeny’, my custom hooks on tinymce, like custom formst select, buttons and styles doesn’t take effect inside getenberg block. TinyMCE rendering as is. And this issue not only inside clonable group.

    #17875
    Anh Tran
    Keymaster

    Hi Jackky,

    I found the problems. It’s kind of a complicated thing in Gutenberg, since the editor is generated on demand using JavaScript. So, some PHP options won’t be applied. And in that case, the default settings of the editor is applied. I’m afraid I don’t have a good solution for it at the moment.

    #17876
    Jackky
    Participant

    I’ve checked now how is working classic editor standart block, and it applying all the hooks and styles from my theme

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash