refactoring
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tiptap/core": "^2.0.0-beta.1",
|
"@tiptap/core": "^2.0.0-beta.1"
|
||||||
"prosemirror-commands": "^1.1.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Command, Node, mergeAttributes } from '@tiptap/core'
|
import { Command, Node, mergeAttributes } from '@tiptap/core'
|
||||||
import { exitCode } from 'prosemirror-commands'
|
|
||||||
|
|
||||||
export interface HardBreakOptions {
|
export interface HardBreakOptions {
|
||||||
HTMLAttributes: Record<string, any>,
|
HTMLAttributes: Record<string, any>,
|
||||||
@@ -41,16 +40,10 @@ export const HardBreak = Node.create<HardBreakOptions>({
|
|||||||
|
|
||||||
addCommands() {
|
addCommands() {
|
||||||
return {
|
return {
|
||||||
setHardBreak: () => ({ commands, state, dispatch }) => {
|
setHardBreak: () => ({ commands }) => {
|
||||||
return commands.first([
|
return commands.first([
|
||||||
() => exitCode(state, dispatch),
|
() => commands.exitCode(),
|
||||||
() => {
|
() => commands.insertContent({ type: this.name }),
|
||||||
if (dispatch) {
|
|
||||||
state.tr.replaceSelectionWith(this.type.create()).scrollIntoView()
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user