mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-11 17:48:44 -05:00
fix(components): add type annotations in commands.ts
- Import Editor and Range types from @tiptap/core - Add CommandProps interface for command callback - Add type annotations for command callback parameters
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import {Extension} from '@tiptap/core'
|
||||
import type {Editor, Range} from '@tiptap/core'
|
||||
import Suggestion from '@tiptap/suggestion'
|
||||
|
||||
// Copied and adjusted from https://github.com/ueberdosis/tiptap/tree/252acb32d27a0f9af14813eeed83d8a50059a43a/demos/src/Experiments/Commands/Vue
|
||||
|
||||
interface CommandProps {
|
||||
command: (params: {editor: Editor, range: Range}) => void
|
||||
}
|
||||
|
||||
export default Extension.create({
|
||||
name: 'slash-menu-commands',
|
||||
|
||||
@@ -10,7 +15,7 @@ export default Extension.create({
|
||||
return {
|
||||
suggestion: {
|
||||
char: '/',
|
||||
command: ({editor, range, props}) => {
|
||||
command: ({editor, range, props}: {editor: Editor, range: Range, props: CommandProps}) => {
|
||||
props.command({editor, range})
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user