Handle enter press but with different node type

Hi guys, i’m trying insert different type of nodes on Enter, Shift + Enter and by clicking on the button outside of editor. All of them should have the same behavior just create different type of nodes. I found package Prosemirror-commands which handle Enter press pretty well ("Enter": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),) but i need to create different type of node, not default. I have these types of nodes, they are exactly the same just with different classes:

new Schema({
  nodes: {
    n: {
      group: 'block',
      content: 'text*',
      toDOM() {
        return ['p', {class: 'tagP'}, 0]
      }
    }
  }
})

How to do it?

You’ll need to write your own command the implements the desired behavior and bind that to enter, possibly, if it doesn’t always take effect, as part as a chain of other commands.

thanks for reply, is it possible somehow to use setBlockType from prosemirror-commands after creating new block? I’m afraid my function will work incorrectly and only chance to do it is to change type of default block right after creating