add scrollIntoView command

This commit is contained in:
Philipp Kühn
2020-09-24 22:21:44 +02:00
parent 57bafb00b9
commit 9df4cd4e35
2 changed files with 16 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ export { liftListItem } from './liftListItem'
export { removeMark } from './removeMark' export { removeMark } from './removeMark'
export { removeMarks } from './removeMarks' export { removeMarks } from './removeMarks'
export { replaceWithNode } from './replaceWithNode' export { replaceWithNode } from './replaceWithNode'
export { scrollIntoView } from './scrollIntoView'
export { selectAll } from './selectAll' export { selectAll } from './selectAll'
export { selectParentNode } from './selectParentNode' export { selectParentNode } from './selectParentNode'
export { setContent } from './setContent' export { setContent } from './setContent'

View File

@@ -0,0 +1,15 @@
import { Command } from '../Editor'
type ScrollIntoViewCommand = () => Command
declare module '../Editor' {
interface Commands {
scrollIntoView: ScrollIntoViewCommand,
}
}
export const scrollIntoView: ScrollIntoViewCommand = () => ({ tr }) => {
tr.scrollIntoView()
return true
}