0.0.20 • Published 1 year ago

biz-email-editor v0.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

biz-email-editor

Introduction

Email render and preview container.

usage

$ npm install --save biz-email-editor

or

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

const initialValues = {
  subject: "Welcome to biz-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
0.0.20

1 year ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago