@seafile/sea-email-editor
v0.0.16
Published
A Slate-based rich email editor with HTML, markdown, tables, images, links, and block plugins.
Readme
Sea email editor
Sea email editor is a React-based rich text editor for composing email content. It is built on top of Slate and includes HTML and Markdown conversion, along with support for common email editing blocks.
Features
- HTML to editor content conversion
- Markdown to editor content conversion
- Rich text formatting: bold, italic, underline, inline code
- Block elements: headings, blockquote, lists, code blocks, divider, tables
- Link and image rendering
- Localization support
Installation
npm install @seafile/sea-email-editorUsage
import React from "react";
import SeaEmailEditor from "@seafile/sea-email-editor";
export default function App() {
return (
<SeaEmailEditor
value={"<div>Hello, world!</div>"}
isHtmlValue={true}
onChange={(html) => {
console.log(html);
}}
/>
);
}Props
value: initial editor content, HTML or Markdown depending onisHtmlValueisHtmlValue: set totruewhenvalueis HTMLoptions.lang: locale, currentlyenandzh-cnonChange: called with serialized HTML when the document changesassetURLPrefix: prefix for editor assetseditorApi: editor integration hooksonLinkClick: custom link click handler
Notes
- The editor now re-initializes when the incoming
valueorisHtmlValuechanges. - The example app under
example/demonstrates how to preview the generated HTML output.
