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

  • Creator
    Topic
  • #17764
    Resolved 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 11 replies (of 11 total)
  • Author
    Replies
  • #27622
    Jackky
    Participant

    I think you should make some filters for default settings of tinyMCE. Like as for me: I'm using in most cases very "tinyfied" tinyMCE editor and for cases like this I'm writing some simple helper functions, like 'mb_tinymce_defaults( $extend = false )', that is returns an array of defaults, merged with $extend array if it set

Viewing 11 replies (of 11 total)
  • You must be logged in to reply to this topic.