diff --git a/src/stories/chat/_types.tsx b/src/stories/chat/_types.tsx index 294b315b..e3d23c1f 100644 --- a/src/stories/chat/_types.tsx +++ b/src/stories/chat/_types.tsx @@ -7,7 +7,7 @@ export type SuggestedUser = { id: number; name: string; email:string }; export interface ChatEditorArgs extends Partial { placeholderOptions?: Partial; - hasInlineMenu?: boolean; + hasFloatingMenu?: boolean; hasButtonsMenu?: boolean; bubbleOptions?: any; author: Author; diff --git a/src/stories/chat/index.stories.tsx b/src/stories/chat/index.stories.tsx index 78dd7787..4f87166f 100644 --- a/src/stories/chat/index.stories.tsx +++ b/src/stories/chat/index.stories.tsx @@ -205,7 +205,7 @@ Placeholder.args = { export const Menus = Template.bind({}); Menus.args = { ...defaultArgs, - hasInlineMenu: true, + hasFloatingMenu: true, hasButtonsMenu: true, i18n: { menu: { diff --git a/src/stories/chat/parts/bar.tsx b/src/stories/chat/parts/bar.tsx index 04317479..88f71277 100644 --- a/src/stories/chat/parts/bar.tsx +++ b/src/stories/chat/parts/bar.tsx @@ -55,7 +55,7 @@ const CommentBar = ({ case "mention": const { from } = editor.state.selection; const char = from > 1 ? " @" : "@"; - return editor.commands.insertContent(char); + return editor.chain().focus().insertContent(char).run(); default: return; } diff --git a/src/stories/chat/parts/commentBox.tsx b/src/stories/chat/parts/commentBox.tsx index 608606a0..29db7f5b 100644 --- a/src/stories/chat/parts/commentBox.tsx +++ b/src/stories/chat/parts/commentBox.tsx @@ -37,7 +37,7 @@ export const CommentBox = ({ placeholderOptions, ...props }: PropsWithChildren) => { - const { children, hasInlineMenu, hasButtonsMenu, bubbleOptions, i18n } = + const { children, hasFloatingMenu, hasButtonsMenu, bubbleOptions, i18n } = props; const { editor, setEditor, mentionableUsers, triggerSave } = useChatContext(); @@ -67,15 +67,16 @@ export const CommentBox = ({ if (!ed) return null; + ed.on("create", ({ editor }) => setEditor(editor as TipTapEditor)); ed.on("update", ({ editor }) => setEditor(editor as TipTapEditor)); return ( <> - {hasInlineMenu && ( - - )} + {hasFloatingMenu && ( + + )}