mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-13 17:59:01 +08:00
focus view before command
This commit is contained in:
parent
69a3b22e54
commit
f64bf9e2ff
@ -91,9 +91,6 @@ export default class ExtensionManager {
|
||||
.filter(extension => extension.commands)
|
||||
.reduce((allCommands, { name, type, commands: provider }) => {
|
||||
|
||||
// TODO
|
||||
// view.focus()
|
||||
|
||||
const commands = {}
|
||||
const value = provider({
|
||||
schema,
|
||||
@ -108,6 +105,7 @@ export default class ExtensionManager {
|
||||
if (!editable) {
|
||||
return false
|
||||
}
|
||||
view.focus()
|
||||
return callback(attrs)(view.state, view.dispatch, view)
|
||||
})
|
||||
} else if (typeof value === 'function') {
|
||||
@ -115,6 +113,7 @@ export default class ExtensionManager {
|
||||
if (!editable) {
|
||||
return false
|
||||
}
|
||||
view.focus()
|
||||
return value(attrs)(view.state, view.dispatch, view)
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
@ -125,6 +124,7 @@ export default class ExtensionManager {
|
||||
if (!editable) {
|
||||
return false
|
||||
}
|
||||
view.focus()
|
||||
return callback(attrs)(view.state, view.dispatch, view)
|
||||
})
|
||||
} else {
|
||||
@ -132,6 +132,7 @@ export default class ExtensionManager {
|
||||
if (!editable) {
|
||||
return false
|
||||
}
|
||||
view.focus()
|
||||
return commandValue(attrs)(view.state, view.dispatch, view)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user