How to use @wordpress/keycodes - 10 common examples

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 WordPress / gutenberg / editor / components / rich-text / index.js View on Github external
onInit() {
		this.registerCustomFormatters();

		this.editor.shortcuts.add( rawShortcut.primary( 'k' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'a' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 's' ), '', () => this.changeFormats( { link: undefined } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'd' ), '', () => this.changeFormats( { strikethrough: ! this.state.formats.strikethrough } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'x' ), '', () => this.changeFormats( { code: ! this.state.formats.code } ) );
		this.editor.shortcuts.add( rawShortcut.primary( 'z' ), '', 'Undo' );
		this.editor.shortcuts.add( rawShortcut.primaryShift( 'z' ), '', 'Redo' );

		// Remove TinyMCE Core shortcut for consistency with global editor
		// shortcuts. Also clashes with Mac browsers.
		this.editor.shortcuts.remove( 'meta+y', '', 'Redo' );
	}
github WordPress / gutenberg / editor / components / rich-text / index.js View on Github external
onInit() {
		this.registerCustomFormatters();

		this.editor.shortcuts.add( rawShortcut.primary( 'k' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'a' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 's' ), '', () => this.changeFormats( { link: undefined } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'd' ), '', () => this.changeFormats( { strikethrough: ! this.state.formats.strikethrough } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'x' ), '', () => this.changeFormats( { code: ! this.state.formats.code } ) );
		this.editor.shortcuts.add( rawShortcut.primary( 'z' ), '', 'Undo' );
		this.editor.shortcuts.add( rawShortcut.primaryShift( 'z' ), '', 'Redo' );

		// Remove TinyMCE Core shortcut for consistency with global editor
		// shortcuts. Also clashes with Mac browsers.
		this.editor.shortcuts.remove( 'meta+y', '', 'Redo' );
	}
github WordPress / gutenberg / editor / components / rich-text / index.js View on Github external
onInit() {
		this.registerCustomFormatters();

		this.editor.shortcuts.add( rawShortcut.primary( 'k' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'a' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 's' ), '', () => this.changeFormats( { link: undefined } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'd' ), '', () => this.changeFormats( { strikethrough: ! this.state.formats.strikethrough } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'x' ), '', () => this.changeFormats( { code: ! this.state.formats.code } ) );
		this.editor.shortcuts.add( rawShortcut.primary( 'z' ), '', 'Undo' );
		this.editor.shortcuts.add( rawShortcut.primaryShift( 'z' ), '', 'Redo' );

		// Remove TinyMCE Core shortcut for consistency with global editor
		// shortcuts. Also clashes with Mac browsers.
		this.editor.shortcuts.remove( 'meta+y', '', 'Redo' );
	}
github WordPress / gutenberg / editor / components / rich-text / index.js View on Github external
onInit() {
		this.registerCustomFormatters();

		this.editor.shortcuts.add( rawShortcut.primary( 'k' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'a' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 's' ), '', () => this.changeFormats( { link: undefined } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'd' ), '', () => this.changeFormats( { strikethrough: ! this.state.formats.strikethrough } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'x' ), '', () => this.changeFormats( { code: ! this.state.formats.code } ) );
		this.editor.shortcuts.add( rawShortcut.primary( 'z' ), '', 'Undo' );
		this.editor.shortcuts.add( rawShortcut.primaryShift( 'z' ), '', 'Redo' );

		// Remove TinyMCE Core shortcut for consistency with global editor
		// shortcuts. Also clashes with Mac browsers.
		this.editor.shortcuts.remove( 'meta+y', '', 'Redo' );
	}
github WordPress / gutenberg / editor / components / rich-text / index.js View on Github external
onInit() {
		this.registerCustomFormatters();

		this.editor.shortcuts.add( rawShortcut.primary( 'k' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'a' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 's' ), '', () => this.changeFormats( { link: undefined } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'd' ), '', () => this.changeFormats( { strikethrough: ! this.state.formats.strikethrough } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'x' ), '', () => this.changeFormats( { code: ! this.state.formats.code } ) );
		this.editor.shortcuts.add( rawShortcut.primary( 'z' ), '', 'Undo' );
		this.editor.shortcuts.add( rawShortcut.primaryShift( 'z' ), '', 'Redo' );

		// Remove TinyMCE Core shortcut for consistency with global editor
		// shortcuts. Also clashes with Mac browsers.
		this.editor.shortcuts.remove( 'meta+y', '', 'Redo' );
	}
github WordPress / gutenberg / editor / components / rich-text / index.js View on Github external
onInit() {
		this.registerCustomFormatters();

		this.editor.shortcuts.add( rawShortcut.primary( 'k' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'a' ), '', () => this.changeFormats( { link: { isAdding: true } } ) );
		this.editor.shortcuts.add( rawShortcut.access( 's' ), '', () => this.changeFormats( { link: undefined } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'd' ), '', () => this.changeFormats( { strikethrough: ! this.state.formats.strikethrough } ) );
		this.editor.shortcuts.add( rawShortcut.access( 'x' ), '', () => this.changeFormats( { code: ! this.state.formats.code } ) );
		this.editor.shortcuts.add( rawShortcut.primary( 'z' ), '', 'Undo' );
		this.editor.shortcuts.add( rawShortcut.primaryShift( 'z' ), '', 'Redo' );

		// Remove TinyMCE Core shortcut for consistency with global editor
		// shortcuts. Also clashes with Mac browsers.
		this.editor.shortcuts.remove( 'meta+y', '', 'Redo' );
	}
github front / gutenberg-js / src / js / gutenberg-overrides / packages / editor / build-module / components / rich-text / index.js View on Github external
onInit () {
    this.registerCustomFormatters();

    this.editor.shortcuts.add(rawShortcut.primary('k'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('a'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('s'), '', () => this.changeFormats({ link: undefined }));
    this.editor.shortcuts.add(rawShortcut.access('d'), '', () => this.changeFormats({ strikethrough: ! this.state.formats.strikethrough }));
    this.editor.shortcuts.add(rawShortcut.access('x'), '', () => this.changeFormats({ code: ! this.state.formats.code }));
    this.editor.shortcuts.add(rawShortcut.primary('z'), '', 'Undo');
    this.editor.shortcuts.add(rawShortcut.primaryShift('z'), '', 'Redo');

    // Remove TinyMCE Core shortcut for consistency with global editor
    // shortcuts. Also clashes with Mac browsers.
    this.editor.shortcuts.remove('meta+y', '', 'Redo');
  }
github front / gutenberg-js / src / js / gutenberg-overrides / packages / editor / build-module / components / rich-text / index.js View on Github external
onInit () {
    this.registerCustomFormatters();

    this.editor.shortcuts.add(rawShortcut.primary('k'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('a'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('s'), '', () => this.changeFormats({ link: undefined }));
    this.editor.shortcuts.add(rawShortcut.access('d'), '', () => this.changeFormats({ strikethrough: ! this.state.formats.strikethrough }));
    this.editor.shortcuts.add(rawShortcut.access('x'), '', () => this.changeFormats({ code: ! this.state.formats.code }));
    this.editor.shortcuts.add(rawShortcut.primary('z'), '', 'Undo');
    this.editor.shortcuts.add(rawShortcut.primaryShift('z'), '', 'Redo');

    // Remove TinyMCE Core shortcut for consistency with global editor
    // shortcuts. Also clashes with Mac browsers.
    this.editor.shortcuts.remove('meta+y', '', 'Redo');
  }
github front / gutenberg-js / src / js / gutenberg-overrides / packages / editor / build-module / components / rich-text / index.js View on Github external
onInit () {
    this.registerCustomFormatters();

    this.editor.shortcuts.add(rawShortcut.primary('k'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('a'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('s'), '', () => this.changeFormats({ link: undefined }));
    this.editor.shortcuts.add(rawShortcut.access('d'), '', () => this.changeFormats({ strikethrough: ! this.state.formats.strikethrough }));
    this.editor.shortcuts.add(rawShortcut.access('x'), '', () => this.changeFormats({ code: ! this.state.formats.code }));
    this.editor.shortcuts.add(rawShortcut.primary('z'), '', 'Undo');
    this.editor.shortcuts.add(rawShortcut.primaryShift('z'), '', 'Redo');

    // Remove TinyMCE Core shortcut for consistency with global editor
    // shortcuts. Also clashes with Mac browsers.
    this.editor.shortcuts.remove('meta+y', '', 'Redo');
  }
github front / gutenberg-js / src / js / gutenberg-overrides / packages / editor / build-module / components / rich-text / index.js View on Github external
onInit () {
    this.registerCustomFormatters();

    this.editor.shortcuts.add(rawShortcut.primary('k'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('a'), '', () => this.changeFormats({ link: { isAdding: true } }));
    this.editor.shortcuts.add(rawShortcut.access('s'), '', () => this.changeFormats({ link: undefined }));
    this.editor.shortcuts.add(rawShortcut.access('d'), '', () => this.changeFormats({ strikethrough: ! this.state.formats.strikethrough }));
    this.editor.shortcuts.add(rawShortcut.access('x'), '', () => this.changeFormats({ code: ! this.state.formats.code }));
    this.editor.shortcuts.add(rawShortcut.primary('z'), '', 'Undo');
    this.editor.shortcuts.add(rawShortcut.primaryShift('z'), '', 'Redo');

    // Remove TinyMCE Core shortcut for consistency with global editor
    // shortcuts. Also clashes with Mac browsers.
    this.editor.shortcuts.remove('meta+y', '', 'Redo');
  }