How to use the @wordpress/plugins.registerPlugin function in @wordpress/plugins

To help you get started, we’ve selected a few @wordpress/plugins examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / apps / full-site-editing / full-site-editing-plugin / starter-page-templates / index.js View on Github external
return (
				
			);
		},
	} );
}

// Always register ability to open from document sidebar.
registerPlugin( 'page-templates-sidebar', {
	render: () => {
		return (
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / edit-post / build-module / plugins / index.js View on Github external
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { registerPlugin } from '@wordpress/plugins';

// GUTENBERG JS - use addQueryArgs instead of hard coding
// 'edit.php?post_type=wp_block'
import { addQueryArgs } from '@wordpress/url';

/**
 * Internal dependencies
 */
import CopyContentMenuItem from './copy-content-menu-item';
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';

registerPlugin( 'edit-post', {
	render() {
		return (
			
				
					{ ( { onClose } ) => (
						
							<menuitem href="{" role="menuitem">
								{ __( 'Manage All Reusable Blocks' ) }
							</menuitem>
							
							
						
					) }
github Automattic / wp-calypso / apps / wpcom-block-editor / src / wpcom / features / tracking.js View on Github external
// Simple track - just based on the event name.
							tracksRecordEvent( tracker );
						} else if ( typeof tracker === 'function' ) {
							// Advanced tracking - call function.
							tracker( ...args );
						}
						return originalAction( ...args );
					};
				} );
			}
			return actions;
		},
	} ) );

	// Registers Plugin.
	registerPlugin( 'wpcom-block-editor-tracking', {
		render: () => {
			EVENT_TYPES.forEach( eventType =>
				document.addEventListener( eventType, delegateEventTracking )
			);
			return null;
		},
	} );
}
github DefinitelyTyped / DefinitelyTyped / types / wordpress__plugins / wordpress__plugins-tests.tsx View on Github external
import * as plugins from '@wordpress/plugins';

plugins.registerPlugin('my-plugin', {
    icon: 'welcome-learn-more',
    render: () =&gt; <h1>Hello World</h1>,
});

plugins.getPlugins();

plugins.getPlugin('my-plugin');

plugins.unregisterPlugin('my-plugin');

interface OwnProps {
    foobar: number;
}

interface ContextProps {
    iconName: string;
github Automattic / wp-calypso / apps / full-site-editing / full-site-editing-plugin / wpcom-block-editor-nux / src / wpcom-nux.js View on Github external
InserterIconImage: (
								<img src="data:image/svg+xml;charset=utf8,%3Csvg width='18' height='18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.824 0C3.97 0 0 3.97 0 8.824c0 4.853 3.97 8.824 8.824 8.824 4.853 0 8.824-3.971 8.824-8.824S13.677 0 8.824 0zM7.94 5.294v2.647H5.294v1.765h2.647v2.647h1.765V9.706h2.647V7.941H9.706V5.294H7.941zm-6.176 3.53c0 3.882 3.176 7.059 7.059 7.059 3.882 0 7.059-3.177 7.059-7.06 0-3.882-3.177-7.058-7.06-7.058-3.882 0-7.058 3.176-7.058 7.059z' fill='%234A4A4A'/%3E%3Cmask id='a' maskUnits='userSpaceOnUse' x='0' y='0' width='18' height='18'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.824 0C3.97 0 0 3.97 0 8.824c0 4.853 3.97 8.824 8.824 8.824 4.853 0 8.824-3.971 8.824-8.824S13.677 0 8.824 0zM7.94 5.294v2.647H5.294v1.765h2.647v2.647h1.765V9.706h2.647V7.941H9.706V5.294H7.941zm-6.176 3.53c0 3.882 3.176 7.059 7.059 7.059 3.882 0 7.059-3.177 7.059-7.06 0-3.882-3.177-7.058-7.06-7.058-3.882 0-7.058 3.176-7.058 7.059z' fill='%23fff'/%3E%3C/mask%3E%3Cg mask='url(%23a)'%3E%3Cpath fill='%23444' d='M0 0h17.644v17.644H0z'/%3E%3C/g%3E%3C/svg%3E" alt="{">
							),
						}
					) }
				<p></p>
			
		
	);
}

registerPlugin( 'wpcom-block-editor-nux', {
	render: () =&gt; ,
} );
github Automattic / wp-calypso / apps / full-site-editing / full-site-editing-plugin / full-site-editing / plugins / template-selector-sidebar / index.js View on Github external
{ __( 'Select a template' ) }
					
				
			
		
	);
} );

if ( 'page' === fullSiteEditing.editorPostType ) {
	registerPlugin( 'fse-template-selector-sidebar', {
		render: TemplateSelectorSidebar,
	} );
}
github Charitable / Charitable / src / editor-sidebar / index.js View on Github external
import { icon } from './icon.js';

/**
 * Load dependencies.
 */
import { compose } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
import { registerPlugin } from '@wordpress/plugins';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
import { PanelBody, PanelRow, TextControl, NumberControl, RangeControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
 * Register the plugin.
 */
registerPlugin( 'charitable-sidebar', {
	icon: icon,
	render: () =&gt; {
		return (
			&lt;&gt;
				
					{ __( 'Campaign Settings', 'charitable' ) }
github Automattic / newspack-theme / newspack-theme / js / src / post-subtitle / index.js View on Github external
appendSubtitleToTitleDOMElement( subtitle );
	}, [ subtitle ] );

	return (
		
			{ __( 'Set a Subtitle for the Article', 'newspack' ) }
			
		
	);
};

registerPlugin( 'plugin-document-setting-panel-newspack-subtitle', {
	render: connectWithSelect( NewspackSubtitlePanel ),
	icon: null,
} );
github youknowriad / dropit / scripts / sidebar / index.js View on Github external
import SidebarUnsplash from "./components/unsplash/sidebar";
import SidebarGiphy from "./components/giphy/sidebar";
import MenuItemUnsplash from "./components/unsplash/menu-item";
import MenuItemGiphy from "./components/giphy/menu-item";

const Dropit = () =&gt; (
  
    
    
    
    
  
);

registerPlugin("dropit", {
  render: Dropit
});
github Automattic / jetpack / extensions / shared / jetpack-plugin-sidebar.js View on Github external
import { createSlotFill } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
import { registerPlugin } from '@wordpress/plugins';

/**
 * Internal dependencies
 */
import './jetpack-plugin-sidebar.scss';
import JetpackLogo from './jetpack-logo';

const { Fill, Slot } = createSlotFill( 'JetpackPluginSidebar' );

export { Fill as default };

registerPlugin( 'jetpack-sidebar', {
	render: () =&gt; (
		
			{ fills =&gt; {
				if ( ! fills.length ) {
					return null;
				}

				return (
					
						 }&gt;
							Jetpack
						
						 }&gt;
							{ fills }