fix more linting errors
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { EditorState, Transaction } from "prosemirror-state"
|
||||
import { ChainedCommands, Editor, CommandSpec } from "./Editor"
|
||||
import { EditorState, Transaction } from 'prosemirror-state'
|
||||
import { ChainedCommands, Editor, CommandSpec } from './Editor'
|
||||
import getAllMethodNames from './utils/getAllMethodNames'
|
||||
|
||||
export default class CommandManager {
|
||||
|
||||
editor: Editor
|
||||
|
||||
commands: { [key: string]: any } = {}
|
||||
|
||||
constructor(editor: Editor) {
|
||||
@@ -35,13 +36,13 @@ export default class CommandManager {
|
||||
const { commands, editor } = this
|
||||
const { state, view } = editor
|
||||
const command = commands[name]
|
||||
|
||||
|
||||
if (!command) {
|
||||
// TODO: prevent vue devtools to throw error
|
||||
// throw new Error(`tiptap: command '${name}' not found.`)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
return (...args: any) => {
|
||||
const { tr } = state
|
||||
const props = this.buildProps(tr)
|
||||
@@ -87,7 +88,7 @@ export default class CommandManager {
|
||||
|
||||
return proxy
|
||||
}
|
||||
}
|
||||
},
|
||||
}) as ChainedCommands
|
||||
}
|
||||
|
||||
@@ -108,16 +109,16 @@ export default class CommandManager {
|
||||
.map(([name, command]) => {
|
||||
return [name, (...args: any[]) => command(...args)(props)]
|
||||
}))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return props
|
||||
}
|
||||
|
||||
public chainableState(tr: Transaction, state: EditorState): EditorState {
|
||||
let selection = tr.selection
|
||||
let doc = tr.doc
|
||||
let storedMarks = tr.storedMarks
|
||||
let { selection } = tr
|
||||
let { doc } = tr
|
||||
let { storedMarks } = tr
|
||||
|
||||
return {
|
||||
...state,
|
||||
@@ -143,7 +144,7 @@ export default class CommandManager {
|
||||
|
||||
return tr
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user