• Resolved mumbomedia

    (@mumbomedia)


    Hi,

    As I have mentioned in the title I want to set up a custom color palette for the tinyMCE-Editor used by the newsletter-plugin. On WordPress itself I have set up this using a hook. But I couldn’t find a hook for this editor and I don’t want to alter the plugin code, because then I had to made the changes after each update. So this isn’t an option for me.

    This is the code I used for WordPress:

    function my_custom_tinymce($init) {
    	$default_colours =  '"990000", "H6 rot",
    										"1C5288", "h3 blau",
    										"ffff00","Marker"';
    	$init['toolbar2'] = str_replace("forecolor,","forecolor,backcolor,",$init['toolbar2']);
    	$init['toolbar1'] = str_replace('wp_more,','wp_more,charmap,',$init['toolbar1']);
    	$init['textcolor_map'] = '['.$default_colours.']';
    
    	// enable 6th row for custom colours in grid
    	$init['textcolor_rows'] = 6;
    	return $init;
    }
    add_filter('tiny_mce_before_init', 'my_custom_tinymce');
Viewing 1 replies (of 1 total)
  • Thread Starter mumbomedia

    (@mumbomedia)

    I’ve figured it out by myself.
    Simple copy the edit.php to the extensions/newsletter/emails folder.
    Then in this file you can alter the initialisation of the tinyMCE-Editor as you wish.

    e.g.

    tinyMCE.init({
            height: 700,
            mode: "specific_textareas",
            editor_selector: "visual",
            theme: "advanced",
            entity_encoding: "raw",
            plugins: "table,fullscreen,legacyoutput",
            theme_advanced_disable: "styleselect",
            theme_advanced_buttons1_add: "forecolor,,backcolor,blockquote,code,fontsizeselect,fontselect",
            theme_advanced_buttons3_add: "tablecontrols,fullscreen",
            relative_urls: false,
            theme_advanced_statusbar_location: "bottom",
            remove_script_host: false,
            theme_advanced_resizing: true,
            theme_advanced_toolbar_location: "top",
            document_base_url: "<?php echo get_option('home'); ?>/",
            content_css: ["<?php echo plugins_url('newsletter') ?>/emails/editor.css", "<?php echo home_url('/') . '?na=emails-css&id=' . $email_id . '&' . time(); ?>"],
            theme_advanced_background_colors: "ffff00",
            theme_advanced_text_colors :"990000,1C5288"
        });

    Then this file will be loaded instead of the original one.
    But keep in my to compare the versions after each update, so updates made by the plugin author will be in your customisation as well.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom color palette for the tinyMCE editor’ is closed to new replies.