mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 06:03:22 +08:00
refactoring
This commit is contained in:
parent
ca8d1a4245
commit
8fda044502
@ -35,8 +35,7 @@ export default class CommandManager {
|
||||
.entries(commands)
|
||||
.map(([name, command]) => {
|
||||
const method = (...args: any) => {
|
||||
// TODO: fix any
|
||||
const callback = command(...args as any)(props)
|
||||
const callback = command(...args)(props)
|
||||
|
||||
if (!tr.getMeta('preventDispatch')) {
|
||||
view.dispatch(tr)
|
||||
@ -109,7 +108,7 @@ export default class CommandManager {
|
||||
tr.setStoredMarks(state.storedMarks)
|
||||
}
|
||||
|
||||
const props = {
|
||||
const props: CommandProps = {
|
||||
tr,
|
||||
editor,
|
||||
view,
|
||||
@ -119,14 +118,10 @@ export default class CommandManager {
|
||||
: undefined,
|
||||
chain: () => this.createChain(tr),
|
||||
can: () => this.createCan(tr),
|
||||
// TODO: fix
|
||||
// @ts-ignore
|
||||
get commands() {
|
||||
return Object.fromEntries(Object
|
||||
.entries(commands)
|
||||
.map(([name, command]) => {
|
||||
// TODO: fix
|
||||
// @ts-ignore
|
||||
return [name, (...args: any[]) => command(...args)(props)]
|
||||
})) as SingleCommands
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user