feat: insert spaces when tab key down in code-block

This commit is contained in:
fantasticit 2022-04-24 20:56:13 +08:00
parent 3fe45ee80f
commit 98ba8ce098
1 changed files with 6 additions and 0 deletions

View File

@ -214,6 +214,12 @@ export const BuiltInCodeBlock = Node.create<CodeBlockOptions>({
return editor.commands.exitCode();
},
'Tab': ({ editor }) => {
const { selection } = this.editor.state;
const { $anchor } = selection;
return editor.chain().insertContentAt($anchor.pos, ' ').run();
},
};
},