mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-28 20:20:09 +08:00
21 lines
397 B
TypeScript
21 lines
397 B
TypeScript
import { RawCommands } from '../types'
|
|
|
|
declare module '@tiptap/core' {
|
|
interface Commands<ReturnType> {
|
|
scrollIntoView: {
|
|
/**
|
|
* Scroll the selection into view.
|
|
*/
|
|
scrollIntoView: () => ReturnType,
|
|
}
|
|
}
|
|
}
|
|
|
|
export const scrollIntoView: RawCommands['scrollIntoView'] = () => ({ tr, dispatch }) => {
|
|
if (dispatch) {
|
|
tr.scrollIntoView()
|
|
}
|
|
|
|
return true
|
|
}
|