tiptap/packages/core/src/extensions/scrollIntoView.ts

21 lines
393 B
TypeScript
Raw Normal View History

2020-10-23 16:44:30 +08:00
import { Command } from '../Editor'
import { createExtension } from '../Extension'
export const ScrollIntoView = createExtension({
addCommands() {
return {
scrollIntoView: (): Command => ({ tr }) => {
tr.scrollIntoView()
return true
},
}
},
})
declare module '../Editor' {
interface AllExtensions {
ScrollIntoView: typeof ScrollIntoView,
}
}