mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 14:59:27 +08:00
fix(code-block): on arrow down move to next node (#4721)
This commit is contained in:
parent
618bca91e8
commit
4e5b2d89cd
5
.changeset/silly-socks-work.md
Normal file
5
.changeset/silly-socks-work.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tiptap/extension-code-block": patch
|
||||
---
|
||||
|
||||
code-block: on arrow down move into the next node
|
@ -1,5 +1,10 @@
|
||||
import { mergeAttributes, Node, textblockTypeInputRule } from '@tiptap/core'
|
||||
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state'
|
||||
import {
|
||||
Plugin,
|
||||
PluginKey,
|
||||
Selection,
|
||||
TextSelection,
|
||||
} from '@tiptap/pm/state'
|
||||
|
||||
export interface CodeBlockOptions {
|
||||
/**
|
||||
@ -222,7 +227,10 @@ export const CodeBlock = Node.create<CodeBlockOptions>({
|
||||
const nodeAfter = doc.nodeAt(after)
|
||||
|
||||
if (nodeAfter) {
|
||||
return false
|
||||
return editor.commands.command(({ tr }) => {
|
||||
tr.setSelection(Selection.near(doc.resolve(after)))
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
return editor.commands.exitCode()
|
||||
|
Loading…
Reference in New Issue
Block a user