* feat: add YouTube video embed support for TipTap editor - Paste YouTube URLs to auto-embed videos with metadata - Edit video title and URL through dropdown menu - Convert embed back to plain URL link - Fetch video titles automatically via YouTube oEmbed API * fix: - reverted NewCardForm CSS properties back to max-h-48. - Added boolean prop to TipTap Edtior for YouTube embed. - Disabled YouTube embed feature for NewCardForm Editor * chore: lint * chore: translations * chore: update translations --------- Co-authored-by: Henry <henry_ball@hotmail.co.uk>
64 lines
1.3 KiB
TypeScript
64 lines
1.3 KiB
TypeScript
import { t } from "@lingui/core/macro";
|
|
import {
|
|
HiEllipsisHorizontal,
|
|
HiLink,
|
|
HiPencil,
|
|
HiTrash,
|
|
} from "react-icons/hi2";
|
|
|
|
import { useModal } from "~/providers/modal";
|
|
import Dropdown from "../Dropdown";
|
|
|
|
interface YouTubeDropdownProps {
|
|
url: string;
|
|
title: string;
|
|
onConvertToLink: () => void;
|
|
onDelete: () => void;
|
|
onUpdate: (url: string, title: string) => void;
|
|
}
|
|
|
|
const YouTubeDropdown = ({
|
|
url,
|
|
title,
|
|
onConvertToLink,
|
|
onDelete,
|
|
onUpdate,
|
|
}: YouTubeDropdownProps) => {
|
|
const { openModal, setModalState } = useModal();
|
|
|
|
const handleEdit = () => {
|
|
setModalState("EDIT_YOUTUBE", {
|
|
url,
|
|
title,
|
|
onSave: onUpdate,
|
|
});
|
|
openModal("EDIT_YOUTUBE");
|
|
};
|
|
|
|
return (
|
|
<Dropdown
|
|
items={[
|
|
{
|
|
label: t`Edit`,
|
|
action: handleEdit,
|
|
icon: <HiPencil className="h-4 w-4 text-dark-900" />,
|
|
},
|
|
{
|
|
label: t`Convert to link`,
|
|
action: onConvertToLink,
|
|
icon: <HiLink className="h-4 w-4 text-dark-900" />,
|
|
},
|
|
{
|
|
label: t`Delete`,
|
|
action: onDelete,
|
|
icon: <HiTrash className="h-4 w-4 text-dark-900" />,
|
|
},
|
|
]}
|
|
>
|
|
<HiEllipsisHorizontal className="h-5 w-5 text-dark-900" />
|
|
</Dropdown>
|
|
);
|
|
};
|
|
|
|
export default YouTubeDropdown;
|