You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As im using below code for blocks so by default table is rendering 3 by 3 table instead can we render 2 by 2 table since i need to add mergtags in cells
import React, { useEffect, useState } from "react";
import { PageHeader } from "@arco-design/web-react";
import { EmailEditor, EmailEditorProvider, Stack } from "easy-email-editor";
import "easy-email-editor/lib/style.css";
import { AdvancedType, BasicType, BlockManager } from "easy-email-core";
import { StandardLayout } from "easy-email-extensions";
import "easy-email-editor/lib/style.css";
import "easy-email-extensions/lib/style.css";
import "@arco-themes/react-easy-email-theme/css/arco.css";
import * as Yup from "yup";
import { useParams } from "react-router-dom";
import { TemplateVariableModal } from "./TemplateVariableModal";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faCaretLeft,
faCaretRight,
faCaretDown,
faCaretUp,
} from "@fortawesome/free-solid-svg-icons";
import { TemplateVariablesForm } from "./TemplateVariablesForm";
import { StepOne } from "./stepForms/StepOne";
useEffect(() => {
if (mergeTags && mergeTags?.mergeTags?.mergeTags.length > 0) {
let tags = {};
for (const val of mergeTags?.mergeTags?.mergeTags) {
tags[val.name] = val?.name;
}
As im using below code for blocks so by default table is rendering 3 by 3 table instead can we render 2 by 2 table since i need to add mergtags in cells
import React, { useEffect, useState } from "react";
import { PageHeader } from "@arco-design/web-react";
import { EmailEditor, EmailEditorProvider, Stack } from "easy-email-editor";
import "easy-email-editor/lib/style.css";
import { AdvancedType, BasicType, BlockManager } from "easy-email-core";
import { StandardLayout } from "easy-email-extensions";
import "easy-email-editor/lib/style.css";
import "easy-email-extensions/lib/style.css";
import "@arco-themes/react-easy-email-theme/css/arco.css";
import * as Yup from "yup";
import { useParams } from "react-router-dom";
import { TemplateVariableModal } from "./TemplateVariableModal";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faCaretLeft,
faCaretRight,
faCaretDown,
faCaretUp,
} from "@fortawesome/free-solid-svg-icons";
import { TemplateVariablesForm } from "./TemplateVariablesForm";
import { StepOne } from "./stepForms/StepOne";
const fontList = [
"Arial",
"Tahoma",
"Verdana",
"Times New Roman",
"Courier New",
"Georgia",
"Lato",
"Montserrat",
].map((item) => ({ value: item, label: item }));
const categories = [
{
label: "Content",
active: true,
blocks: [
{ type: AdvancedType.TEXT },
{ type: AdvancedType.BUTTON },
{
type: AdvancedType.TABLE,
},
{ type: AdvancedType.SOCIAL },
{ type: AdvancedType.DIVIDER },
{ type: AdvancedType.SPACER },
],
},
{
label: "Layout",
active: true,
displayType: "column",
blocks: [
{
title: "2 columns",
payload: [
["50%", "50%"],
["33%", "67%"],
["67%", "33%"],
["25%", "75%"],
["75%", "25%"],
],
},
{
title: "3 columns",
payload: [
["33.33%", "33.33%", "33.33%"],
["25%", "25%", "50%"],
["50%", "25%", "25%"],
],
},
{
title: "4 columns",
payload: [
["25%", "25%", "25%", "25%"],
["25%", "25%", "25%", "25%"],
["25%", "25%", "25%", "25%"],
["25%", "25%", "25%", "25%"],
],
},
],
},
];
const pageBlock = BlockManager.getBlockByType(BasicType.PAGE) || null;
export default function EmailTemplateDesigner({
onSubmit,
mergeTags,
editorJson,
handleFillWordForm,
templateData,
isNewTemplateVariable,
setIsNewTemplateVariable,
setStep,
}) {
const { templateId } = useParams();
const [isOpen, setIsOpen] = useState(false);
const [isOpenDynamicForm, setIsOpenDynamicForm] = useState(true);
const [wordForm, setWordForm] = useState([]);
const [initialValues, setInitialValues] = useState();
const [tags, setTags] = useState();
const [templateVariableModal, setTemplateVariableModal] = useState(false);
useEffect(() => {
if (
templateData?.template_Parameters &&
templateData?.template_Parameters?.includes("{")
) {
setWordForm(JSON.parse(templateData?.template_Parameters));
}
}, [editorJson, mergeTags, templateData]);
const validationSchema = Yup.object().shape(
wordForm.reduce((schema, field) => {
schema[field.label] = Yup.string();
return schema;
}, {})
);
const initialFormValues = wordForm.reduce((values, field) => {
console.log("field----------->", field);
if (field?.inputType?.includes("{")) {
const data = JSON.parse(field?.inputType);
}, {});
useEffect(() => {
if (mergeTags && mergeTags?.mergeTags?.mergeTags.length > 0) {
let tags = {};
for (const val of mergeTags?.mergeTags?.mergeTags) {
tags[val.name] = val?.name;
}
}, [mergeTags]);
useEffect(() => {
const initValue = {
subject: "Welcome to Template Creation",
subTitle: "Nice to meet you!",
content: editorJson || pageBlock.create({}),
};
setInitialValues(initValue);
}, [editorJson, templateData]);
const handleClose = () => {
setTemplateVariableModal(false);
};
const handleShow = () => {
setTemplateVariableModal(true);
setIsOpenDynamicForm(false);
};
const handleShowPageAttributes = () => {
const elements = document.querySelectorAll(
".arco-layout-sider.arco-layout-sider-light"
);
};
if (!initialValues) return null;
return (
<EmailEditorProvider
key={JSON.stringify(initialValues)}
dashed={false}
data={initialValues}
height={"calc(100vh - 85px)"}
autoComplete
mergeTags={tags}
fontList={fontList}
onSubmit={onSubmit}
>
{({ values }, { submit }) => {
return (
<>
<PageHeader
title="Design Template"
extra={
<button
className="btn btn-primary"
type="button"
onClick={() => setStep((prev) => prev - 1)}
>
Previous
<button
className="btn btn-primary"
type="button"
value="Submit"
onClick={() => {
submit();
}}
>
Submit
}
/>
<button
type="button"
className=" template-variables-btn"
onClick={() => handleShow()}
>
Add More Template Variables
);
}
The text was updated successfully, but these errors were encountered: