How to use the @wordpress/keycodes.isKeyboardEvent.primaryAlt 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 / packages / editor / build-module / components / rich-text / index.js View on Github external
onDeleteKeyDown (event) {
    const { onMerge, onRemove } = this.props;
    if (! onMerge && ! onRemove) {
      return;
    }

    const { keyCode } = event;
    const isReverse = keyCode === BACKSPACE;

    // User is using the Remove Block shortcut, so allow the event to bubble
    // up to the BlockSettingsMenu component
    if (isKeyboardEvent.primaryAlt(event, 'Backspace')) {
      return;
    }

    const { isCollapsed } = getSelection();

    // Only process delete if the key press occurs at uncollapsed edge.
    if (! isCollapsed) {
      return;
    }

    // It is important to consider emptiness because an empty container
    // will include a bogus TinyMCE BR node _after_ the caret, so in a
    // forward deletion the isHorizontalEdge function will incorrectly
    // interpret the presence of the bogus node as not being at the edge.
    const isEmpty = this.isEmpty();
    const isEdge = (