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

PluginPostPublishPanel uses icon and inherits from registerPlugin #16383

Conversation

ryanwelcher
Copy link
Contributor

@ryanwelcher ryanwelcher commented Jul 2, 2019

Description

This PR updates the PluginPostPublishPanel SlotFill to accept an icon or inherit from registerPlugin()

Screenshots

post-publish-panel

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ryanwelcher ryanwelcher force-pushed the try/plugin-post-publish-panel-inherit-icon branch from bea9ce1 to e872a87 Compare September 6, 2019 16:39
@ryanwelcher
Copy link
Contributor Author

Confirm that custom SVGs are rendered in greyscale

Edit_Post_‹gutenberg-dev_test—_WordPress

@ryanwelcher
Copy link
Contributor Author

@mapk wondering if you can sign off on this PR as well?

@mapk
Copy link
Contributor

mapk commented Sep 6, 2019

@ryanwelcher Can you guide me through some steps to test this? How do I get a custom panel to show in the post-publish slideout?

@ryanwelcher
Copy link
Contributor Author

@mapk it might be easiest to install this plugin I wrote for a talk I gave on SlotFill - https://github.com/ryanwelcher/the-gutenberg-slotfill-system. It demos all of the slots and if you have this branch active and built, you'll see the icons.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Nice work. Thanks for sorting it out 👍

I tested with:

( function() {
	var el = wp.element.createElement;
	var Fragment = wp.element.Fragment;
	var __ = wp.i18n.__;
	var registerPlugin = wp.plugins.registerPlugin;
	var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
	var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;

	function PanelContent() {
		return el(
			'p',
			{},
			__( 'Here is the panel content!' )
		);
	}

	function MyPublishPanelPlugin() {
		return el(
			Fragment,
			{},
			el(
				PluginPrePublishPanel,
				{
					className: 'my-publish-panel-plugin__pre',
					title: __( 'My pre publish panel' )
				},
				el(
					PanelContent,
					{}
				)
			),
			el(
				PluginPostPublishPanel,
				{
					className: 'my-publish-panel-plugin__post',
					title: __( 'My post publish panel' )
				},
				el(
					PanelContent,
					{}
				)
			)
		);
	}

	registerPlugin( 'my-publish-panel-plugin', {
		icon: 'palmtree',
		render: MyPublishPanelPlugin
	} );
} )();

@mapk - I copied it over from the existing plugin which we use for e2e tests and can be activated in the plugins section for the default Gutenberg env:

Screen Shot 2019-09-09 at 11 57 25

However, I had to add the icon property. We might want to update the e2e test as well to have it covered.

@gziolo gziolo merged commit 7547215 into WordPress:master Sep 9, 2019
@gziolo gziolo added this to the Gutenberg 6.5 milestone Sep 9, 2019
@ryanwelcher ryanwelcher deleted the try/plugin-post-publish-panel-inherit-icon branch September 9, 2019 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants