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

Fix the classic block TinyMCE init array #10966

Closed
azaozz opened this issue Oct 23, 2018 · 2 comments · Fixed by #10968
Closed

Fix the classic block TinyMCE init array #10966

azaozz opened this issue Oct 23, 2018 · 2 comments · Fixed by #10968
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

@azaozz
Copy link
Contributor

azaozz commented Oct 23, 2018

The TinyMCE init array cannot be JSON encoded safely like in $scripts->localize(). Some setting values can be (js) functions, other may be passed as objects or arrays in the tiny_mce_before_init filter. It has to be converted from php to js "by hand" and outputted as raw js from php.

@azaozz
Copy link
Contributor Author

azaozz commented Oct 23, 2018

To test:

add_filter( 'tiny_mce_before_init', 'my_tiny_mce_before_init' );
function my_tiny_mce_before_init( $init ) {
	$init['init_instance_callback'] = 'function(editor) { console.log("Editor: " + editor.id + " is now initialized.") }';
	return $init;
}

@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Oct 30, 2018
@danielbachhuber danielbachhuber added the [Type] Bug An existing feature does not function as intended label Oct 30, 2018
@ellatrix ellatrix added [Block] Classic Affects the Classic Editor Block and removed [Component] TinyMCE [Block] Classic Affects the Classic Editor Block labels Oct 31, 2018
@azaozz
Copy link
Contributor Author

azaozz commented Nov 2, 2018

Also opened https://core.trac.wordpress.org/ticket/45221 for core.

This is a regression and a blocker for WP 5.0.

@mtias mtias added the [Status] In Progress Tracking issues with work in progress label Nov 16, 2018
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

Successfully merging a pull request may close this issue.

4 participants