mirror of
https://github.com/arikchakma/maily.to.git
synced 2026-04-26 14:45:57 +03:00
[GH-ISSUE #171] How to use Button into mail content #283
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/maily.to#283
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AnthSuz on GitHub (Mar 26, 2025).
Original GitHub issue: https://github.com/arikchakma/maily.to/issues/171
Hello,
I've been trying to implement Maily in my project for 2 days now because it has an important asset for my use, the addition of a button in the body of the mail.
Only when I want to log the content of my mail in HTML format via generateHTML if I have a button in my body I get this error:
Uncaught RangeError: Unknown node type: button
I've seen the same problem with image or columns for example, but I haven't tested everything.
Looking at your code, I can see that when you copy html in your example, you're making a .post request where you send a button type as well and receive an a type.
How do you carry out the transformation?
Thanks,
My code :
import "@maily-to/core/style.css";
import { FromContentSms } from "@/components/parameters/automation/FormContentSms";
import { TagsEmailSms } from "@/components/parameters/automation/TagsEmailSms";
import { PageLayout } from "@/components/ui/pageLayout/PageLayout";
import { createFileRoute, useParams } from "@tanstack/react-router";
import { ActionType, typeType } from "..";
import { useState } from "react";
import { Editor } from "@maily-to/core";
import type { JSONContent, Editor as TiptapEditor } from "@tiptap/core";
import { Icons } from "@/components/ui/icons";
import { faEnvelope } from "@fortawesome/pro-light-svg-icons";
import { Input } from "@/components/ui/input";
import Typography from "@/components/ui/Typography";
import { generateHTML, generateJSON } from "@tiptap/core";
import StarterKit from "@tiptap/starter-kit";
import { useGetPlaceConfig } from "@/services/place/useGetPlaceConfig";
export const Route = createFileRoute("/club/$clubId/settings/automation/$type/$action")({
component: RouteComponent,
});
function getValueFromTypeAndAction(type: typeType, action: ActionType) {
return valueFromTypeAndAction[type][action];
}
function RouteComponent() {
const params = useParams({ from: "/club/$clubId/settings/automation/$type/$action" });
const [editor, setEditor] = useState();
const { data: placeConfig } = useGetPlaceConfig();
return (
<PageLayout
title={getValueFromTypeAndAction(params.type as typeType, params.action as ActionType).titlePage}
link="/club/$clubId/settings/automation"
linkText="Email & SMS de service"
fullWidth
>
{params.type === "sms" && (
<FromContentSms
title={getValueFromTypeAndAction(params.type as typeType, params.action as ActionType).titleFormContent}
placeholder={getValueFromTypeAndAction(params.type as typeType, params.action as ActionType).placeholder}
data={getValueFromTypeAndAction(params.type as typeType, params.action as ActionType).data}
/>
)}
Sujet
<Editor
config={{
hasMenuBar: false,
wrapClassName: "!rounded-lg",
bodyClassName: "!border-none !mt-0",
autofocus: true,
immediatelyRender: false,
}}
onCreate={setEditor}
onUpdate={setEditor}
contentJson={generateJSON(placeConfig?.email_appointment_cancelation?.email?.message || "", [StarterKit])}
/>
);
}
@arikchakma commented on GitHub (Mar 29, 2025):
Please use renderer package to do so.