0.0.9 • Published 10 months ago

easy-mail-editor v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Easy Mail Editor

This is a simple email editor built with React and Vite. It allows users to compose and send emails with various features such as drag-and-drop functionality, email templates, and a rich text editor. The project is designed to be easy to use and customize, with a clean and intuitive interface.

📦 Install

npm install easy-mail-editor
yarn add easy-mail-editor
pnpm add easy-mail-editor

🔨 Usage

const [lang, setLang] = useState<EasymailLangType>("zh_CN");
const [skin, setSkin] = useState<EasymailSkinType>("light");

const ref = useRef<EasymailRefProps>(null);
const rejectRef = useRef<Promise<string>>(null);

const getEditorMjmlJson = () => {
  return ref.current?.getData();
};

return (
  <Easymail
    lang={lang}
    width="100vw"
    height="100vh"
    skin={skin}
    colorPrimary={""}
    ref={ref}
    value={mjmlJson}
    tinymceLink={tinymceLink}
    onUpload={(file: File) => {
      return new Promise((resolve, reject) => {
        rejectRef.current = reject;
        setTimeout(async () => {
          try {
            const url = await fileToBase64(file);
            resolve({ url });
          } catch (error) {
            reject("upload error");
          }
        }, 5000);
      });
    }}
    onUploadFocusChange={() => {
      rejectRef.current("error");
      rejectRef.current = null;
    }}
  />
);

🔗 Links

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.5

10 months ago

0.0.6

10 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.4

10 months ago

0.0.1

11 months ago