mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-23 19:19:03 +08:00
Update code.ts
At the end of the paragraph, press the right key and then jump out of the inlineCode wrapper
This commit is contained in:
parent
0e82b50fde
commit
63f5f07d32
@ -92,11 +92,10 @@ export const Code = Mark.create<CodeOptions>({
|
||||
ArrowRight: event => {
|
||||
const state: EditorState = event?.editor?.state;
|
||||
const { $cursor }: any = state.selection || {};
|
||||
// At the end of the paragraph, press the right key and jump out of the inlineCode wrapper
|
||||
// At the end of the paragraph, press the right key and then jump out of the inlineCode wrapper
|
||||
const isInlineCode = $cursor?.nodeBefore?.marks?.some((mark: Mark) => mark.type?.name === 'code');
|
||||
if ($cursor && isInlineCode && !$cursor.nodeAfter) {
|
||||
this.editor.chain().unsetCode().insertContent(' ').run();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user