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

Editor: Move printing TinyMCE scripts into an action #232

Closed
wants to merge 3 commits into from

Conversation

sarayourfriend
Copy link

This is a draft PR to start addressing the issue in the ticket. Moving this logic into an action allows plugins to override how/when TinyMCE is loaded. Specifically, Gutenberg needs to be able to prevent TinyMCE scripts from being written into the page when TinyMCE should be loaded asynchronously when it is actually needed.

This is the first time I've made changes in WordPress core and I had a hard time deciding where to put the wp_print_tinymce_scripts function (or what to name it, for that matter).

I'm also not even sure that this is exactly the correct approach for the issue described in the ticket, so any and all feedback is super welcome!

Trac ticket: https://core.trac.wordpress.org/ticket/49964


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Moving this logic into an action allows plugins to override
how/when TinyMCE is loaded. Specifically, Gutenberg needs to
be able to prevent TinyMCE scripts from being written into
the page when TinyMCE should be loaded asynchronously when it
is actually needed.
…t handle

Based on WordPress/gutenberg#21244 but pulled into
Core so that this functionality can be used when retriving the URIs for
TinyMCE's dependencies when it is being asynchronously loaded.
This is necessary in order to support lazily loading TinyMCE for the
classic block. Because some custom meta boxes may depend on TinyMCE,
if they are present we must pre-load TinyMCE as normal. To be able to
support making that decision at runtime, we need to have already
processed and initialized the `$wp_meta_boxes` global when we call
to wp_enqueue_editor, which the Gutenberg plugin hooks into through
a new action also added as part of this patch to programatically
decide whether or not TinyMCE needs to be pre-loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants