New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anteros-email-editor

Email editor

1.0.1
latest
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created

anteros-email-editor

Introduction

Email render and preview container.

usage

$ npm install --save anteros-email-editor

or

$ yarn add anteros-email-editor
import React from "react";
import { BlockManager } from "anteros-email-core";
import { EmailEditor, EmailEditorProvider } from "anteros-email-editor";
import "anteros-email-editor/lib/style.css";

const initialValues = {
  subject: "Welcome to anteros-email",
  subTitle: "Nice to meet you!",
  content: BlockManager.getBlockByType(BasicType.PAGE).create({}),
};

export function App() {
  return (
    <EmailEditorProvider data={initialValues} height={"calc(100vh - 72px)"}>
      {({ values }) => {
        return <EmailEditor />;
      }}
    </EmailEditorProvider>
  );
}

customize

If you customize the UI yourself,maybe you need to know

  • hooks

    • useActiveTab // current tab is edit or preview
    • useBlock // includes addBlock、moveBlock、removeBlock、undo, redo, etc.
    • useHoverIdx // hover block related, dragging status related, dragging direction related
    • useEditorProps // get props from EmailEditorProvider
    • useEditorContext // get form state and initialized status
    • useFocusIdx // focus block related
  • utils (These are some very simple methods, it is best to look at the implementation)

    • getBlockNodeByIdx
    • getBlockNodes
    • getShadowRoot
    • scrollBlockEleIntoView
  • components

    • BlockAvatarWrapper // allow drag and drop to editor

FAQs

Package last updated on 23 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts