blockPasteFromStorageContextMenu(typeErrorCallback) {
    /** @type {!Blockly.ContextMenuRegistry.RegistryItem} */
    const pasteFromStorageOption = {
      displayText: function () {
        if (Blockly.Msg['CROSS_TAB_PASTE']) {
          return Blockly.Msg['CROSS_TAB_PASTE'];
        }
        return 'Paste';
      },
      preconditionFn: function (
        /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope,
      ) {
        const copyData = JSON.parse(localStorage.getItem('blocklyStash'));
        if (
          copyData &&
          scope.workspace.isCapacityAvailable(copyData.typeCounts)
        ) {
          return 'enabled';
        }
        return 'disabled';
      },
      callback: function (
        /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope,
      ) {
        const copyData = JSON.parse(localStorage.getItem('blocklyStash'));
        try {
          Blockly.clipboard.paste(copyData, scope.workspace);
        } catch (e) {
          if (e instanceof TypeError && typeErrorCallback) {
            typeErrorCallback();
          } else {
            throw e;
          }
        }
      },
      scopeType: Blockly.ContextMenuRegistry.ScopeType.WORKSPACE,
      id: 'blockPasteFromStorage',
      weight: 0,
    };
    Blockly.ContextMenuRegistry.registry.register(pasteFromStorageOption);
  }
Adds a paste command to the block context menu.
@param {Function=} typeErrorCallback
callback function to handle type errors