easy-email-extensions 3.0.0-beta-01.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "easy-email-extensions",
3
+ "license": "MIT",
4
+ "description": "Email editor",
5
+ "version": "3.0.0-beta-01.0",
6
+ "author": "m-Ryan",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git@github.com:m-Ryan/easy-email.git"
10
+ },
11
+ "keywords": [
12
+ "email editor core"
13
+ ],
14
+ "files": [
15
+ "lib"
16
+ ],
17
+ "main": "./lib/index.js",
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "typings": "tsc --declaration --emitDeclarationOnly --project tsconfig.json",
21
+ "build": "rimraf lib && vite build --config vite.config.ts"
22
+ },
23
+ "husky": {
24
+ "hooks": {
25
+ "pre-commit": "yarn test && yarn lint-staged"
26
+ }
27
+ },
28
+ "lint-staged": {
29
+ "src/*.{js,jsx,ts,tsx}, example/*.{js,jsx,ts,tsx}": [
30
+ "yarn lint"
31
+ ]
32
+ },
33
+ "devDependencies": {
34
+ "@types/lodash": "^4.14.177",
35
+ "@types/node": "^16.11.7",
36
+ "@types/react": "17.0.2",
37
+ "@types/react-dom": "^17.0.11",
38
+ "@vitejs/plugin-react-refresh": "^1.3.6",
39
+ "cross-env": "^7.0.3",
40
+ "lerna": "^4.0.0",
41
+ "less": "^4.1.2",
42
+ "rollup-plugin-visualizer": "^5.5.2",
43
+ "sass": "^1.43.4",
44
+ "tsc-alias": "^1.4.1",
45
+ "typescript": "^4.4.4",
46
+ "vite": "^2.6.14",
47
+ "vite-plugin-html": "^2.1.1",
48
+ "vite-plugin-style-import": "^1.3.0"
49
+ },
50
+ "dependencies": {
51
+ "antd": "^4.16.13",
52
+ "codemirror": "^5.63.3",
53
+ "final-form": "^4.20.4",
54
+ "final-form-arrays": "^3.0.2",
55
+ "final-form-set-field-touched": "^1.0.1",
56
+ "is-hotkey": "^0.2.0",
57
+ "lodash": "^4.17.21",
58
+ "lodash-es": "^4.17.21",
59
+ "mjml-browser": "^4.10.4",
60
+ "react": "^17.0.2",
61
+ "react-codemirror2": "^7.2.1",
62
+ "react-color": "^2.19.3",
63
+ "react-dom": "^17.0.2",
64
+ "react-final-form": "^6.5.7",
65
+ "react-final-form-arrays": "^3.1.3",
66
+ "react-sortablejs": "^6.0.0",
67
+ "react-use": "^17.3.1",
68
+ "sortablejs": "^1.14.0"
69
+ },
70
+ "peerDependencies": {
71
+ "react": "^17.0.2",
72
+ "react-dom": "^17.0.2",
73
+ "react-final-form": "^6.5.7"
74
+ }
75
+ }
package/readme.md ADDED
@@ -0,0 +1,130 @@
1
+ # Easy-email-extensions
2
+
3
+ ## Introduction
4
+
5
+ Provide default UI components, when they don’t meet your needs, you can refer to it and write your own
6
+
7
+ ## usage
8
+
9
+ ```sh
10
+ $ npm install --save easy-email-extensions
11
+ ```
12
+
13
+ or
14
+
15
+ ```sh
16
+ $ yarn add easy-email-extensions
17
+ ```
18
+
19
+ ```js
20
+ import React from "react";
21
+ import { BlocksMap, EmailEditor, EmailEditorProvider } from "easy-email-editor";
22
+ import "easy-email-editor/lib/style.css";
23
+ import "antd/dist/antd.css";
24
+
25
+ const initialValues = {
26
+ subject: "Welcome to Easy-email",
27
+ subTitle: "Nice to meet you!",
28
+ content: BlocksMap.getBlock("Page").create({}),
29
+ };
30
+
31
+ export function App() {
32
+ return (
33
+ <EmailEditorProvider data={initialValues} height={"calc(100vh - 72px)"}>
34
+ {({ values }) => {
35
+ return (
36
+ <SimpleFrame>
37
+ <EmailEditor />
38
+ </SimpleFrame>
39
+ );
40
+ }}
41
+ </EmailEditorProvider>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## Extensions
47
+
48
+ - `AttributePanel`
49
+
50
+ - Basic block configuration panel
51
+
52
+ - <img src="https://assets.maocanhua.cn/3e74a61d-ab22-4cf3-afc9-d511b82e08cd-image.png" alt="AttributePanel">
53
+
54
+ - You can add or overwrite
55
+
56
+ ```tsx
57
+ import { BlockAttributeConfigurationManager } from "easy-email-extensions";
58
+
59
+ BlockAttributeConfigurationManager.add({
60
+ [BasicType.TEXT]: () => <div>will be overwrite `Text`</div>,
61
+ });
62
+ ```
63
+
64
+ - `InteractivePrompt`
65
+
66
+ - block hover and focus style
67
+
68
+ - <img src="https://assets.maocanhua.cn/298d72d6-a509-4cd2-85c7-dfb915971620-image.png" alt="InteractivePrompt">
69
+
70
+ - No configuration items
71
+
72
+ - `BlockLayer`
73
+
74
+ - <img src="https://assets.maocanhua.cn/de1f5211-350e-43c9-9c99-d97a2f196e04-image.png" alt="ShortcutToolbar">
75
+ - No configuration items
76
+
77
+ - `ShortcutToolbar`
78
+
79
+ - <img src="https://assets.maocanhua.cn/f0e2ccc6-0627-472b-ad78-bc92bdb46ad1-image.png">
80
+ - You can add or overwrite popover's preset blocks
81
+
82
+ ```tsx
83
+ import { BasicType } from "easy-email-core";
84
+ import {
85
+ BlockMarketManager,
86
+ BlockMaskWrapper,
87
+ } from "easy-email-extensions";
88
+
89
+ BlockMarketManager.addCategories([
90
+ {
91
+ title: "Custom",
92
+ name: "custom",
93
+ blocks: [
94
+ {
95
+ type: BasicType.TEXT,
96
+ title: "Text",
97
+ description: "This block allows you to display text in your email.",
98
+ component: () => {
99
+ return (
100
+ <BlockMaskWrapper
101
+ type={BasicType.TEXT}
102
+ payload={{
103
+ attributes: {
104
+ "font-size": "20px",
105
+ align: "center",
106
+ padding: "0px 0px 0px 0px",
107
+ color: "#4A90E2",
108
+ },
109
+ data: {
110
+ value: {
111
+ content: "20px",
112
+ },
113
+ },
114
+ }}
115
+ >
116
+ <div style={{ fontSize: 20, width: "100%", paddingLeft: 20 }}>
117
+ 20px
118
+ </div>
119
+ </BlockMaskWrapper>
120
+ );
121
+ },
122
+ },
123
+ ],
124
+ },
125
+ ]);
126
+ ```
127
+
128
+ - `SimpleFrame`
129
+
130
+ - All in one extension, provide basic and complete layout example. Refer to the above extension for configuration items.