Files
tiptap/packages/core/src/extensions/scrollIntoView.ts
Philipp Kühn 389937c32f refactoring
2020-11-02 16:23:43 +01:00

23 lines
439 B
TypeScript

import { Command } from '../Editor'
import { createExtension } from '../Extension'
export const ScrollIntoView = createExtension({
addCommands() {
return {
scrollIntoView: (): Command => ({ tr, dispatch }) => {
if (dispatch) {
tr.scrollIntoView()
}
return true
},
}
},
})
declare module '../Editor' {
interface AllExtensions {
ScrollIntoView: typeof ScrollIntoView,
}
}