How to use the @wordpress/keycodes.displayShortcut.primary function in @wordpress/keycodes

To help you get started, we’ve selected a few @wordpress/keycodes 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 front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / editor / build-module / components / post-saved-state / index.js View on Github external
}

    // Once the post has been submitted for review this button
    // is not needed for the contributor role.
    if (! hasPublishAction && isPending) {
      return null;
    }

    const label = isPending ? __('Save as Pending') : __('Save Draft');
    if (! isLargeViewport) {
      return (
        
      );
    }

    return (
      <button>
        { label }
      </button>
    );
  }
github WordPress / gutenberg / packages / editor / src / components / post-saved-state / index.js View on Github external
}

		// Once the post has been submitted for review this button
		// is not needed for the contributor role.
		if ( ! hasPublishAction &amp;&amp; isPending ) {
			return null;
		}

		const label = isPending ? __( 'Save as Pending' ) : __( 'Save Draft' );
		if ( ! isLargeViewport ) {
			return (
				 onSave() }
					shortcut={ displayShortcut.primary( 's' ) }
					icon="cloud-upload"
				/&gt;
			);
		}

		return (
			<button> onSave() }
				shortcut={ displayShortcut.primary( 's' ) }
				isTertiary
			&gt;
				{ label }
			</button>
		);
	}
github WordPress / gutenberg / packages / editor / src / components / rich-text / formatting-controls.js View on Github external
* WordPress dependencies
 */
import { __ } from '@wordpress/i18n';
import { displayShortcut } from '@wordpress/keycodes';

export const FORMATTING_CONTROLS = [
	{
		icon: 'editor-bold',
		title: __( 'Bold' ),
		shortcut: displayShortcut.primary( 'b' ),
		format: 'bold',
	},
	{
		icon: 'editor-italic',
		title: __( 'Italic' ),
		shortcut: displayShortcut.primary( 'i' ),
		format: 'italic',
	},
	{
		icon: 'admin-links',
		title: __( 'Link' ),
		shortcut: displayShortcut.primary( 'k' ),
		format: 'link',
	},
	{
		icon: 'editor-strikethrough',
		title: __( 'Strikethrough' ),
		shortcut: displayShortcut.access( 'd' ),
		format: 'strikethrough',
	},
];
github WordPress / gutenberg / packages / editor / src / components / rich-text / formatting-controls.js View on Github external
{
		icon: 'editor-bold',
		title: __( 'Bold' ),
		shortcut: displayShortcut.primary( 'b' ),
		format: 'bold',
	},
	{
		icon: 'editor-italic',
		title: __( 'Italic' ),
		shortcut: displayShortcut.primary( 'i' ),
		format: 'italic',
	},
	{
		icon: 'admin-links',
		title: __( 'Link' ),
		shortcut: displayShortcut.primary( 'k' ),
		format: 'link',
	},
	{
		icon: 'editor-strikethrough',
		title: __( 'Strikethrough' ),
		shortcut: displayShortcut.access( 'd' ),
		format: 'strikethrough',
	},
];
github WordPress / gutenberg / editor / components / post-saved-state / index.js View on Github external
if ( forceSavedMessage || ( ! isNew &amp;&amp; ! isDirty ) ) {
			return (
				<span>
					
					{ __( 'Saved' ) }
				</span>
			);
		}

		return (
			
				{ __( 'Save Draft' ) }
			
		);
	}
}
github WordPress / gutenberg / packages / editor / src / components / rich-text / formatting-controls.js View on Github external
/**
 * WordPress dependencies
 */
import { __ } from '@wordpress/i18n';
import { displayShortcut } from '@wordpress/keycodes';

export const FORMATTING_CONTROLS = [
	{
		icon: 'editor-bold',
		title: __( 'Bold' ),
		shortcut: displayShortcut.primary( 'b' ),
		format: 'bold',
	},
	{
		icon: 'editor-italic',
		title: __( 'Italic' ),
		shortcut: displayShortcut.primary( 'i' ),
		format: 'italic',
	},
	{
		icon: 'admin-links',
		title: __( 'Link' ),
		shortcut: displayShortcut.primary( 'k' ),
		format: 'link',
	},
	{
		icon: 'editor-strikethrough',
github WordPress / gutenberg / packages / editor / src / components / post-saved-state / index.js View on Github external
if ( forceSavedMessage || ( ! isNew &amp;&amp; ! isDirty ) ) {
			return (
				<span>
					
					{ __( 'Saved' ) }
				</span>
			);
		}

		return (
			
				{ __( 'Save Draft' ) }
			
		);
	}
}