feat: add selectTextblockStart and selectTextblockEnd commands

This commit is contained in:
Philipp Kühn
2022-01-25 10:35:39 +01:00
parent a20e887458
commit 0aa39f93cb
7 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// @ts-ignore
// TODO: add types to @types/prosemirror-commands
import { selectTextblockEnd as originalSelectTextblockEnd } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {
selectTextblockEnd: {
/**
* Moves the cursor to the end of current text block.
*/
selectTextblockEnd: () => ReturnType,
}
}
}
export const selectTextblockEnd: RawCommands['selectTextblockEnd'] = () => ({ state, dispatch }) => {
return originalSelectTextblockEnd(state, dispatch)
}

View File

@@ -0,0 +1,19 @@
// @ts-ignore
// TODO: add types to @types/prosemirror-commands
import { selectTextblockStart as originalSelectTextblockStart } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {
selectTextblockStart: {
/**
* Moves the cursor to the start of current text block.
*/
selectTextblockStart: () => ReturnType,
}
}
}
export const selectTextblockStart: RawCommands['selectTextblockStart'] = () => ({ state, dispatch }) => {
return originalSelectTextblockStart(state, dispatch)
}