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

Projects
None yet
4 participants
@youknowriad
Contributor

youknowriad commented May 19, 2018

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 iseulde and WordPress/gutenberg-core May 19, 2018

@iseulde

This comment has been minimized.

Member

iseulde commented May 20, 2018

Should we require WordPress 4.9.6 with this change?

@youknowriad

This comment has been minimized.

Contributor

youknowriad commented May 20, 2018

@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?

@iseulde

This comment has been minimized.

Member

iseulde commented May 20, 2018

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' ) );

This comment has been minimized.

@iseulde

iseulde May 20, 2018

Member

Does anything break without the jQuery dependency?

This comment has been minimized.

@youknowriad

youknowriad May 20, 2018

Contributor

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

This comment has been minimized.

@iseulde

iseulde May 20, 2018

Member

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',

This comment has been minimized.

@iseulde

iseulde May 20, 2018

Member

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

This comment has been minimized.

@youknowriad

youknowriad May 20, 2018

Contributor

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';
@iseulde

This comment has been minimized.

Member

iseulde commented May 20, 2018

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' );
	} );
} );
@iseulde

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

@mtias

This comment has been minimized.

Contributor

mtias commented May 21, 2018

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

@youknowriad youknowriad merged commit 2bb8e93 into master May 21, 2018

2 checks passed

codecov/project 46.43% remains the same compared to b541282
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@youknowriad youknowriad deleted the update/user-wp-tinymce-version branch May 21, 2018

@rilwis

This comment has been minimized.

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