-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with BubbleMenu and FloatingMenu (in React) "tippy_js_WEBPACK_IMPORTED_MODULE_@__ is not a function" #6116
Comments
I'm having a similar issue with Floating Menu: SymptomsI'm trying to integrate Tiptap with the Floating Menu plugin into my React app, and every time I click into the editor, if I'm trying to use the Floating Menu, I get the following error:
Versions
I've tried
My code<TiptapEditor
content="Preview content"
className="text-sm rounded-xl bg-secondary-light border-secondary-light py-3 px-4 w-full"
/> TiptapEditor.tsx: import React from 'react';
import StarterKit from '@tiptap/starter-kit';
import { EditorContent, useEditor } from '@tiptap/react';
import VariableToolbar from './VariableToolbar';
type Props = {
className?: string,
content: string,
}
const TiptapEditor = ({
className,
content,
}: Props) => {
const editor = useEditor({
extensions: [StarterKit],
content,
});
if (!editor) {
return null;
}
return (
<div className={className}>
<VariableToolbar editor={editor} />
<EditorContent editor={editor} />
</div>
);
};
export default TiptapEditor; VariableToolbar.tsx: import React, { useState } from 'react';
import { PlusIcon } from '@heroicons/react/outline';
import { FloatingMenu, Editor } from '@tiptap/react';
import Button from 'components/Button';
type Props = {
editor: Editor
}
const VariableToolbar = ({ editor }: Props) => {
const [showDropdown, setShowDropdown] = useState(false);
if (!editor) {
return null;
}
const variableOptions = [
{ label: 'Student first name', id: '{{student_first_name}}' },
{ label: 'Student last name', id: '{{student_last_name}}' },
{ label: 'Absence count', id: '{{absence_count}}' },
];
return (
<FloatingMenu editor={editor}>
<div className="flex flex-row justify-end mt-2 relative">
<Button
icon={PlusIcon}
aria-label="Insert variable"
onClick={() => setShowDropdown(!showDropdown)}
className="p-2"
/>
{showDropdown && (
<div className="absolute rounded-lg p-1 border top-0 right-0 mt-10 bg-white shadow flex flex-col">
{variableOptions.map(({ id, label }) => (
<button
type="button"
key={id}
onClick={() => {
editor.chain().focus().insertContent(id).run();
setShowDropdown(false);
}}
className="text-xs p-[.2rem] w-full text-left hover:bg-secondary-light"
>
{label}
</button>
))}
</div>
)}
</div>
</FloatingMenu>
);
};
export default VariableToolbar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discussed in #6099
Originally posted by MemorySounds February 12, 2025
Hi TipTap team,
I am encountering an issue with the BubbleMenu Extension component. When I try to use it in my project, I get the following error:
I've tried all kinds of configurations, direct imports, etc. I can't seem to make the BubbleMenu (same for FloatingMenu actually) to pick-up the tippy.
Here's the relevant code
As you can see, it's a pretty basic setup, so not sure where I am going wrong. If anyone has some advice I'd be very grateful.
Thanks in advance
The text was updated successfully, but these errors were encountered: