tiptap/packages/core/src/commands/blur.ts
2021-02-16 11:27:58 +01:00

21 lines
353 B
TypeScript

import { Command, Commands } from '../types'
declare module '@tiptap/core' {
interface AllCommands {
blur: {
/**
* Removes focus from the editor.
*/
blur: () => Command,
}
}
}
export const blur: Commands['blur'] = () => ({ view }) => {
const element = view.dom as HTMLElement
element.blur()
return true
}