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 use the Core TinyMCE version to avoid conflicts #6848

Merged
merged 2 commits into from
May 21, 2018

Conversation

youknowriad
Copy link
Contributor

This PR uses the TinyMCE core scripts instead of using TinyMCE from the CDN to avoid conflicts between the classic editor/wysiwyg metaboxes and the Gutenberg editor.

We're still loading the TinyMCE script two times because there's no registered script for TinyMCE in Core but at least this fixes the compatibility issues.

closes #6809 #6847 #3302 #3731

@youknowriad youknowriad requested review from ellatrix and a team May 19, 2018 22:36
@youknowriad youknowriad force-pushed the update/user-wp-tinymce-version branch from 1699e93 to 77fdc7e Compare May 19, 2018 23:02
@ellatrix
Copy link
Member

Should we require WordPress 4.9.6 with this change?

@youknowriad
Copy link
Contributor Author

@iseulde I thought about this and I think it's fine if we don't, an older version of TinyMCE will be used with probably some small writing flow bugs but Gutenberg still works. @mtias Thoughts?

@ellatrix
Copy link
Member

Hm, not sure if we have a list of all the bugs it will cause. I think it'd be good to avoid a bunch of reports caused merely by an older WordPress version.

@@ -76,6 +76,8 @@ function gutenberg_register_scripts_and_styles() {
gutenberg_register_vendor_scripts();

// WordPress packages.
wp_register_script( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array( 'jquery' ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anything break without the jQuery dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know :) Probably not. It started as a copy/paste from my old PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's required for some custom WordPress plugins, but we're not loading those.

'tinymce-latest',
'https://unpkg.com/tinymce@' . $tinymce_version . '/tinymce' . $suffix . '.js'
);
$tinymce_version = '4.7.11';
gutenberg_register_vendor_script(
'tinymce-latest-lists',
'https://unpkg.com/tinymce@' . $tinymce_version . '/plugins/lists/plugin' . $suffix . '.js',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could load these from core too, except the table plugin. Maybe better like this though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought they were loaded automatically so I removed this but it didn't work. I believe we could use the Core provided once but it's not as urgent as TinyMCE.

'tinymce-latest',
'https://unpkg.com/tinymce@' . $tinymce_version . '/tinymce' . $suffix . '.js'
);
$tinymce_version = '4.7.11';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellatrix
Copy link
Member

Testing with:

add_action( 'add_meta_boxes', function() {
	add_meta_box( 'wp_editor_test_box_1', 'wp_editor() test box', function( $post ) {
		wp_editor( $post->post_content, 'wp_editor_test_1' );
	} );
} );

Copy link
Member

@ellatrix ellatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me! Just wondering if we should maybe load an unminified version for script debug mode.

@mtias
Copy link
Member

mtias commented May 21, 2018

It's fine to bump the version. But maybe let's wait until 3.0 for doing the bump.

@rilwis
Copy link

rilwis commented May 22, 2018

@youknowriad Thanks a lot for the merge!

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.

Classic Editor breaks - WP 4.9.6+Gutenberg+Yoast
4 participants