P E N C I L
Login
Slatejs: modify models

Press enter then split the line and apply new line as normal paragraph

if (e.key === "Enter") {
                // press enter will start a new normal paragraph
                // Special case: press enter at the end of header, start a new normal paragraph
                const blocks = editor.value.blocks;
                const getCurrentblock = blocks.get(0);

                if (getCurrentblock.type === type) {
                    return editor.splitBlock().setBlocks(PARAGRAPH);
                }
            }

Has block:

 hasBlock = type => { 
   let blocks = editor.value.blocks;
    return blocks.size > 0 && blocks.some(node => node.type == type)
  }