mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 19:59:02 +08:00
refactoring
This commit is contained in:
parent
71740687f4
commit
55d430ef8f
@ -22,7 +22,6 @@
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^2.0.0-beta.1",
|
||||
"prosemirror-commands": "^1.1.3"
|
||||
"@tiptap/core": "^2.0.0-beta.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Command, Node, mergeAttributes } from '@tiptap/core'
|
||||
import { exitCode } from 'prosemirror-commands'
|
||||
|
||||
export interface HardBreakOptions {
|
||||
HTMLAttributes: Record<string, any>,
|
||||
@ -41,16 +40,10 @@ export const HardBreak = Node.create<HardBreakOptions>({
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
setHardBreak: () => ({ commands, state, dispatch }) => {
|
||||
setHardBreak: () => ({ commands }) => {
|
||||
return commands.first([
|
||||
() => exitCode(state, dispatch),
|
||||
() => {
|
||||
if (dispatch) {
|
||||
state.tr.replaceSelectionWith(this.type.create()).scrollIntoView()
|
||||
}
|
||||
|
||||
return true
|
||||
},
|
||||
() => commands.exitCode(),
|
||||
() => commands.insertContent({ type: this.name }),
|
||||
])
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user