refactoring

This commit is contained in:
Philipp Kühn 2021-02-16 18:00:40 +01:00
parent ca8d1a4245
commit 8fda044502

View File

@ -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
},