diff --git a/docs/src/demos/Experiments/Commands/commands.js b/docs/src/demos/Experiments/Commands/commands.js index 3bf67dff..3ebe7609 100644 --- a/docs/src/demos/Experiments/Commands/commands.js +++ b/docs/src/demos/Experiments/Commands/commands.js @@ -8,8 +8,8 @@ export default Extension.create({ suggestion: { char: '/', startOfLine: true, - command: ({ editor, range, attributes }) => { - attributes.command({ editor, range }) + command: ({ editor, range, props }) => { + props.command({ editor, range }) }, }, }, diff --git a/packages/extension-mention/src/mention.ts b/packages/extension-mention/src/mention.ts index b5db04f4..f0dba98f 100644 --- a/packages/extension-mention/src/mention.ts +++ b/packages/extension-mention/src/mention.ts @@ -15,11 +15,11 @@ export const Mention = Node.create({ HTMLAttributes: {}, suggestion: { char: '@', - command: ({ editor, range, attributes }) => { + command: ({ editor, range, props }) => { editor .chain() .focus() - .replaceRange(range, 'mention', attributes) + .replaceRange(range, 'mention', props) .insertText(' ') .run() }, diff --git a/packages/suggestion/src/suggestion.ts b/packages/suggestion/src/suggestion.ts index 3f1aabbc..f8eed1df 100644 --- a/packages/suggestion/src/suggestion.ts +++ b/packages/suggestion/src/suggestion.ts @@ -1,4 +1,4 @@ -import { Editor, Range, AnyObject } from '@tiptap/core' +import { Editor, Range } from '@tiptap/core' import { Plugin, PluginKey } from 'prosemirror-state' import { Decoration, DecorationSet, EditorView } from 'prosemirror-view' import { findSuggestionMatch } from './findSuggestionMatch' @@ -13,7 +13,7 @@ export interface SuggestionOptions { command?: (props: { editor: Editor, range: Range, - attributes: AnyObject + props: any, }) => void, items?: (query: string) => any[], render?: () => { @@ -30,7 +30,7 @@ export interface SuggestionProps { query: string, text: string, items: any[], - command: (attributes: AnyObject) => void, + command: (props: any) => void, decorationNode: Element | null, clientRect: () => (DOMRect | null), } @@ -88,11 +88,11 @@ export function Suggestion({ items: (handleChange || handleStart) ? await items(state.query) : [], - command: attributes => { + command: commandProps => { command({ editor, range: state.range, - attributes, + props: commandProps, }) }, decorationNode,