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

Text Block + TinyMCE Custom Styles = Bug #1739

Closed
meneldil opened this issue Jul 7, 2016 · 11 comments
Closed

Text Block + TinyMCE Custom Styles = Bug #1739

meneldil opened this issue Jul 7, 2016 · 11 comments
Assignees
Labels

Comments

@meneldil
Copy link

meneldil commented Jul 7, 2016

Hello,
I use custom styles on my WordPress, but I have a problem with the Text Block module since the last (or before last) update.
The WYSIWYG editor does not show the tools and text. (see screenshots below)

Here is the code that generates the bug:

add_filter( 'tiny_mce_before_init', 'fb_mce_before_init' );
function fb_mce_before_init( $settings ) {
    $style_formats = array(
        array(
            'title' => 'Majuscule',
            'block' => 'p',
            'classes' => 'uppercase'
        ),
    );
    $settings['style_formats'] = json_encode( $style_formats );
    return $settings;
}

With the code
with-code

Without the code
without-code

Thanks in advance!

@ghost ghost assigned andreiglingeanu Jul 7, 2016
@ghost ghost added the bug label Jul 7, 2016
@ghost
Copy link

ghost commented Jul 7, 2016

Reproduced

@andreiglingeanu
Copy link
Collaborator

On it.

@ghost
Copy link

ghost commented Jul 7, 2016

@andreiglingeanu There are other tinymce parameters that can be set https://www.tinymce.com/docs/configure/content-formatting/
I think we should add a general way to handle them or add them to a hardcoded list and process each.

@andreiglingeanu
Copy link
Collaborator

andreiglingeanu commented Jul 7, 2016

That's once again JSON parsing error.. I can do a fix for this particular issue then think about a general solution later.

Maybe try to JSON.parse each field that has [, ], { and }?

@andreiglingeanu
Copy link
Collaborator

andreiglingeanu commented Jul 7, 2016

@meneldil How I can check that this style_formats was applied correctly? Is there some specific thing I should notice in the edotir's UI?

@andreiglingeanu
Copy link
Collaborator

651bebc

@meneldil
Copy link
Author

meneldil commented Jul 7, 2016

@andreiglingeanu Normally, this format appears in the WYSIWYG editor. (Pages and posts)

ui

I forgot to also put the first part of the code that displays this list:

add_filter('mce_buttons_2', 'my_mce_buttons_2');
function my_mce_buttons_2( $buttons ) {
    array_unshift( $buttons, 'styleselect' );
    return $buttons;
}

@andreiglingeanu
Copy link
Collaborator

andreiglingeanu commented Jul 7, 2016

Yes, it works now. Please check it.

@meneldil
Copy link
Author

meneldil commented Jul 7, 2016

I forgot to mention that the problem happens in Text Block's popup. ;)

@andreiglingeanu
Copy link
Collaborator

andreiglingeanu commented Jul 7, 2016

@meneldil There you go.

@meneldil
Copy link
Author

meneldil commented Jul 7, 2016

Great! :D
Thank you. I'm looking forward that the plugin is updated on WordPress. :)

@ghost ghost closed this as completed in 1bf8b36 Jul 7, 2016
ghost pushed a commit that referenced this issue Jul 7, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants