I have a little annoying problem with my litle shitty code.. I try add TinyMCE to my wp_customize but it doesnt work properly. I try click on formatselect but it doesnt show list where i can choose heading and i dont know why.. everything else work fine...
this is my custom-editor.js
jQuery(document).ready(function($) {
$('.wysiwyg-editor').each(function() {
var textareaId = $(this).attr('id');
tinymce.init({
selector: '#' + textareaId,
height: 150,
plugins: 'lists',
toolbar: 'formatselect | bold italic underline bullist numlist',
menubar: false,
valid_elements: '*[*]',
setup: function(editor) {
editor.on('change', function() {
editor.save();
var content = $('#' + textareaId).val();
if (content.indexOf('<p>') === -1) {
content = '<p>' + content + '</p>';
}
content = content.replace(/<p>(\s| )*<\/p>/g, '<br>');
$('#' + textareaId).val(content);
$('#' + textareaId).trigger('input');
});
}
});
});
});
And this is my function.php
function add_custom_header( $wp_customize ) {
$wp_customize->add_section( 'header_content', array(
'title' => __( 'Treść' ),
'panel' => 'header_panel',
'priority' => 10,
) );
$wp_customize->add_setting( 'header_content_header', array(
'default' => '',
'transport' => 'refresh',
) );
$wp_customize->add_control( 'header_content_header_control', array(
'label' => __( 'Nagłówek' ),
'section' => 'header_content',
'settings' => 'header_content_header',
'type' => 'textarea',
'input_attrs' => array(
'class' => 'wysiwyg-editor',
'textarea_rows' => 5,
),
) );
}
add_action( 'customize_register', 'add_custom_header' );
I dont know how can i fix it. I use newest wordpress if that information helps