Skip to content

Commit

Permalink
Fix addComands type
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp committed Oct 23, 2024
1 parent f07dd2b commit ace95a4
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Node } from '@tiptap/core';
import { mergeAttributes, RawCommands } from '@tiptap/react';
import { mergeAttributes } from '@tiptap/react';

declare module '@tiptap/core' {
interface Commands<ReturnType> {
Expand Down Expand Up @@ -49,15 +49,16 @@ export const VariableTag = Node.create({
];
},

// @ts-expect-error - addCommands is missing from the NodeConfig type
addCommands: () => ({
insertVariableTag:
(variable: string) =>
({ commands }: { commands: Partial<RawCommands> }) => {
return commands.insertContent?.({
({ commands }) => {
commands.insertContent?.({
type: 'variableTag',
attrs: { variable },
});

return true;
},
}),
});

0 comments on commit ace95a4

Please sign in to comment.