Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyMCE textcolor_map #11147

Closed
ghost opened this issue Oct 27, 2018 · 9 comments
Closed

TinyMCE textcolor_map #11147

ghost opened this issue Oct 27, 2018 · 9 comments
Labels
[Block] Classic Affects the Classic Editor Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@ghost
Copy link

ghost commented Oct 27, 2018

Describe the bug
When filtering the TinyMCE textcolor_map option the colors are replaced with blanks.

To Reproduce
Steps to reproduce the behavior:
Filter the editor as so:

add_filter('tiny_mce_before_init', 'change_tinymce_color_options');
function change_tinymce_color_options($options) {
$custom_colours = '
"000000", "Black",
"993300", "Burnt orange",
"333300", "Dark olive",
"003300", "Dark green",
"003366", "Dark azure",
"000080", "Navy Blue",
"333399", "Indigo",
"333333", "Very dark gray",
"800000", "Maroon",
$options['textcolor_map'] = '['.$custom_colours.']';

return $options;

}

Expected behavior
the custom colors should be visible in the tinymce editor when using a classic editor block

Screenshots
image

@becomevocal
Copy link

On beta version 4.9.9-alpha-43656 on Mac, Chrome latest (70.0.3538.77), with Gutenberg v4.1.1, I can reproduce.

Steps to reproduce

Add filter:

    $default_colours = '
        "FF0000", "Red",
        "FF9900", "Amber",
        "33CCCC", "Turquoise",
        "3366FF", "Royal blue",
        "800080", "Purple",
        "FF00FF", "Magenta",
        "FFCC00", "Gold",
        "FFFF00", "Yellow"
        ';
    $custom_colours = '
        "edf1ff", "Color 1",
        "ebebec", "Color 2",
        "f1f8fe", "Color 3",
        "eee6f9", "Color 4"
        ';
    $init['textcolor_map'] = '['.$default_colours.','.$custom_colours.']';
    $init['textcolor_rows'] = 1;
    return $init;
}
add_filter('tiny_mce_before_init', 'change_tinymce_colors');

Screenshot

screen shot 2018-10-28 at 4 30 58 pm

Notes

You can see that the colors aren't respected but the number of rows config is.

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Component] TinyMCE labels Oct 30, 2018
@danielbachhuber
Copy link
Member

This is being worked on with #10966

Can you test #10968 to verify it works as expected?

@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Oct 30, 2018
@becomevocal
Copy link

@danielbachhuber yep. #10968 fixes the default colors list, however it doesn't show the custom colors properly.

screen shot 2018-10-30 at 8 34 38 am

@ghost
Copy link
Author

ghost commented Oct 30, 2018 via email

@azaozz
Copy link
Contributor

azaozz commented Oct 30, 2018

@becomevocal sorry but I'm not sure what is the intent of the example code. Having $init['textcolor_rows'] = 1; means "hide all colors table rows except the first one", and that is what happens. If you remove that setting, the extra colors show up.

@ellatrix ellatrix added [Block] Classic Affects the Classic Editor Block and removed [External Package] TinyMCE labels Oct 31, 2018
@ghost
Copy link
Author

ghost commented Oct 31, 2018 via email

@becomevocal
Copy link

@azaozz you're right :) Seems like this is being fixed in #10968 so this ticket can probably be marked duplicate?

@sshelby1 I got this to work by making the changes to my install as listed here: https://github.com/WordPress/gutenberg/pull/10968/files

@mtias
Copy link
Member

mtias commented Nov 12, 2018

For reference, this can also be made to work on new blocks like this:
color

@mtias mtias added the [Status] In Progress Tracking issues with work in progress label Nov 16, 2018
@youknowriad
Copy link
Contributor

closed by #10968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Classic Affects the Classic Editor Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants