@thanhpv102/easy-email-editor 4.19.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.
Files changed (81) hide show
  1. package/lib/assets/font/iconfont.d.ts +0 -0
  2. package/lib/components/EmailEditor/components/DesktopEmailPreview/index.d.ts +2 -0
  3. package/lib/components/EmailEditor/components/EditEmailPreview/components/MjmlDomRender.d.ts +2 -0
  4. package/lib/components/EmailEditor/components/EditEmailPreview/components/ShadowStyle.d.ts +2 -0
  5. package/lib/components/EmailEditor/components/EditEmailPreview/index.d.ts +2 -0
  6. package/lib/components/EmailEditor/components/MobileEmailPreview/index.d.ts +2 -0
  7. package/lib/components/EmailEditor/components/ToolsPanel/index.d.ts +2 -0
  8. package/lib/components/EmailEditor/index.d.ts +4 -0
  9. package/lib/components/IconFont/index.d.ts +9 -0
  10. package/lib/components/Provider/BlocksProvider/index.d.ts +21 -0
  11. package/lib/components/Provider/EmailEditorProvider/index.d.ts +11 -0
  12. package/lib/components/Provider/FocusBlockLayoutProvider/index.d.ts +7 -0
  13. package/lib/components/Provider/HoverIdxProvider/index.d.ts +29 -0
  14. package/lib/components/Provider/LanguageProvider/index.d.ts +5 -0
  15. package/lib/components/Provider/PreviewEmailProvider/index.d.ts +11 -0
  16. package/lib/components/Provider/PropsProvider/index.d.ts +75 -0
  17. package/lib/components/Provider/RecordProvider/index.d.ts +14 -0
  18. package/lib/components/Provider/ScrollProvider/index.d.ts +14 -0
  19. package/lib/components/RenderCount/index.d.ts +2 -0
  20. package/lib/components/UI/Button/index.d.ts +10 -0
  21. package/lib/components/UI/IframeComponent/index.d.ts +8 -0
  22. package/lib/components/UI/Stack/components/Item/index.d.ts +12 -0
  23. package/lib/components/UI/Stack/index.d.ts +23 -0
  24. package/lib/components/UI/Stack/utils/components.d.ts +16 -0
  25. package/lib/components/UI/Stack/utils/css.d.ts +4 -0
  26. package/lib/components/UI/SyncScrollIframeComponent/index.d.ts +10 -0
  27. package/lib/components/UI/SyncScrollShadowDom/index.d.ts +4 -0
  28. package/lib/components/UI/Tabs/index.d.ts +22 -0
  29. package/lib/components/UI/TextStyle/index.d.ts +7 -0
  30. package/lib/components/wrapper/BlockAvatarWrapper/index.d.ts +11 -0
  31. package/lib/components/wrapper/index.d.ts +2 -0
  32. package/lib/constants.d.ts +17 -0
  33. package/lib/easy-email-editor.css +1 -0
  34. package/lib/hooks/useActiveTab.d.ts +4 -0
  35. package/lib/hooks/useBlock.d.ts +26 -0
  36. package/lib/hooks/useDataTransfer.d.ts +4 -0
  37. package/lib/hooks/useDomScrollHeight.d.ts +7 -0
  38. package/lib/hooks/useDragable.d.ts +4 -0
  39. package/lib/hooks/useDropBlock.d.ts +3 -0
  40. package/lib/hooks/useEditorContext.d.ts +8 -0
  41. package/lib/hooks/useEditorProps.d.ts +4 -0
  42. package/lib/hooks/useFocusBlockLayout.d.ts +3 -0
  43. package/lib/hooks/useFocusIdx.d.ts +4 -0
  44. package/lib/hooks/useHotKeys.d.ts +1 -0
  45. package/lib/hooks/useHoverIdx.d.ts +8 -0
  46. package/lib/hooks/useLazyState.d.ts +1 -0
  47. package/lib/hooks/usePreviewEmail.d.ts +6 -0
  48. package/lib/hooks/useRefState.d.ts +1 -0
  49. package/lib/index.d.ts +31 -0
  50. package/lib/index.js +9289 -0
  51. package/lib/index.js.map +1 -0
  52. package/lib/locales.json +1 -0
  53. package/lib/typings/index.d.ts +14 -0
  54. package/lib/typings/mjml-browser.d.ts +37 -0
  55. package/lib/utils/EventManager.d.ts +19 -0
  56. package/lib/utils/HtmlStringToPreviewReactNodes.d.ts +3 -0
  57. package/lib/utils/HtmlStringToReactNodes.d.ts +6 -0
  58. package/lib/utils/MergeTagBadge.d.ts +4 -0
  59. package/lib/utils/awaitForElement.d.ts +4 -0
  60. package/lib/utils/classnames.d.ts +1 -0
  61. package/lib/utils/contenteditable.d.ts +4 -0
  62. package/lib/utils/generateTranslate.d.ts +1 -0
  63. package/lib/utils/getBlockNodeByChildEle.d.ts +1 -0
  64. package/lib/utils/getBlockNodeByIdx.d.ts +1 -0
  65. package/lib/utils/getBlockNodes.d.ts +1 -0
  66. package/lib/utils/getContentEditableClassName.d.ts +1 -0
  67. package/lib/utils/getDirectionPosition.d.ts +15 -0
  68. package/lib/utils/getEditorRoot.d.ts +1 -0
  69. package/lib/utils/getImg.d.ts +5 -0
  70. package/lib/utils/getInsertPosition.d.ts +17 -0
  71. package/lib/utils/getPluginElement.d.ts +1 -0
  72. package/lib/utils/getShadowRoot.d.ts +1 -0
  73. package/lib/utils/index.d.ts +12 -0
  74. package/lib/utils/isButtonBlock.d.ts +1 -0
  75. package/lib/utils/isNavbarBlock.d.ts +1 -0
  76. package/lib/utils/isTableBlock.d.ts +1 -0
  77. package/lib/utils/isTextBlock.d.ts +1 -0
  78. package/lib/utils/logger.d.ts +2 -0
  79. package/lib/utils/scrollBlockEleIntoView.d.ts +3 -0
  80. package/package.json +78 -0
  81. package/readme.md +43 -0
@@ -0,0 +1 @@
1
+ {"en":{"No matching components":"No matching components","Configuration":"Configuration","Source code":"Source code","Layer":"Layer","attributes":"attributes","Font family":"Font family","Email Setting":"Email Setting","Subject":"Subject","SubTitle":"SubTitle","Width":"Width","Breakpoint":"Breakpoint","Allows you to control on which breakpoint the layout should go desktop/mobile.":"Allows you to control on which breakpoint the layout should go desktop/mobile.","Theme Setting":"Theme Setting","Font size":"Font size","Font weight":"Font weight","Text color":"Text color","Background":"Background","Content background":"Content background","User style":"User style","Import font":"Import font","Points to a hosted css file":"Points to a hosted css file"},"zh-Hans":{"No matching components":"没有匹配的组件","Configuration":"配置","Source code":"源代码","Layer":"层","attributes":"属性","Font family":"字体系列","Email Setting":"电子邮件设置","Subject":"主题","SubTitle":"字幕","Width":"宽度","Breakpoint":"断点","Allows you to control on which breakpoint the layout should go desktop/mobile.":"允许您控制布局应为台式机/移动设备的断点。","Theme Setting":"主题设置","Font size":"字体大小","Font weight":"字体重量","Text color":"文字颜色","Background":"背景","Content background":"内容背景","User style":"用户样式","Import font":"导入字体","Points to a hosted css file":"指向托管的CSS文件"},"ja":{"No matching components":"一致するコンポーネントはありません","Configuration":"構成","Source code":"ソースコード","Layer":"層","attributes":"属性","Font family":"フォントファミリー","Email Setting":"メール設定","Subject":"主題","SubTitle":"字幕","Width":"幅","Breakpoint":"ブレークポイント","Allows you to control on which breakpoint the layout should go desktop/mobile.":"レイアウトがデスクトップ/モバイルに移動するブレークポイントを制御できます。","Theme Setting":"テーマ設定","Font size":"フォントサイズ","Font weight":"フォント重量","Text color":"テキストの色","Background":"バックグラウンド","Content background":"コンテンツの背景","User style":"ユーザースタイル","Import font":"フォントをインポートします","Points to a hosted css file":"ホストされているCSSファイルを指します"},"ko":{"No matching components":"일치하는 구성 요소가 없습니다","Configuration":"구성","Source code":"소스 코드","Layer":"층","attributes":"속성","Font family":"글꼴 가족","Email Setting":"이메일 설정","Subject":"주제","SubTitle":"부제","Width":"너비","Breakpoint":"중단 점","Allows you to control on which breakpoint the layout should go desktop/mobile.":"레이아웃이 데스크탑/모바일로 이동 해야하는 중단 점을 제어 할 수 있습니다.","Theme Setting":"테마 설정","Font size":"글꼴 크기","Font weight":"글꼴 무게","Text color":"텍스트 색상","Background":"배경","Content background":"콘텐츠 배경","User style":"사용자 스타일","Import font":"글꼴을 가져옵니다","Points to a hosted css file":"호스팅 된 CSS 파일을 가리 킵니다"},"it":{"No matching components":"Nessun componente corrispondente","Configuration":"Configurazione","Source code":"Codice sorgente","Layer":"Strato","attributes":"attributi","Font family":"Famiglia di font","Email Setting":"Impostazione e -mail","Subject":"Materia","SubTitle":"Sottotitolo","Width":"Larghezza","Breakpoint":"Punto di rottura","Allows you to control on which breakpoint the layout should go desktop/mobile.":"Ti consente di controllare su quale punto di interruzione il layout dovrebbe andare desktop/mobile.","Theme Setting":"Impostazione del tema","Font size":"Dimensione del font","Font weight":"Peso del carattere","Text color":"Colore del testo","Background":"Sfondo","Content background":"Background di contenuto","User style":"Stile utente","Import font":"Carattere di importazione","Points to a hosted css file":"Punta a un file CSS ospitato"}}
@@ -0,0 +1,14 @@
1
+ import { IPage } from '@thanhpv102/easy-email-core';
2
+ import { JSX } from 'react';
3
+ export interface IEmailTemplate {
4
+ content: IPage;
5
+ subject: string;
6
+ subTitle: string;
7
+ }
8
+ declare global {
9
+ function t(key: string): string;
10
+ function t(key: string, placeholder: React.ReactNode): JSX.Element;
11
+ interface Window {
12
+ t: (key: string, placeholder?: React.ReactNode) => JSX.Element;
13
+ }
14
+ }
@@ -0,0 +1,37 @@
1
+ declare module 'mjml-browser' {
2
+ const transform: (vml: string, options?: {
3
+ beautify?: boolean;
4
+ minify?: boolean;
5
+ keepComments?: boolean;
6
+ validationLevel: 'strict' | 'soft' | 'skip';
7
+ }) => {
8
+ json: MjmlBlockItem;
9
+ html: string;
10
+ errors: string[];
11
+ };
12
+ export default transform;
13
+ }
14
+ interface MjmlBlockItem {
15
+ file: string;
16
+ absoluteFilePath: string;
17
+ line: number;
18
+ includedIn: any[];
19
+ tagName: string;
20
+ children: IChildrenItem[];
21
+ attributes: IAttributes;
22
+ content?: string;
23
+ }
24
+ interface IChildrenItem {
25
+ file?: string;
26
+ absoluteFilePath?: string;
27
+ line: number;
28
+ includedIn: any[];
29
+ tagName: string;
30
+ children?: IChildrenItem[];
31
+ attributes: IAttributes;
32
+ content?: string;
33
+ inline?: 'inline';
34
+ }
35
+ interface IAttributes {
36
+ [key: string]: any;
37
+ }
@@ -0,0 +1,19 @@
1
+ import { ActiveTabKeys } from '../components/Provider/BlocksProvider';
2
+ export declare class EventManager {
3
+ private static events;
4
+ static on(type: EventType.ACTIVE_TAB_CHANGE, callback: (payload: {
5
+ currentTab: ActiveTabKeys;
6
+ nextTab: ActiveTabKeys;
7
+ }) => boolean): void;
8
+ static off(type: EventType, handler: (...args: any[]) => any): void;
9
+ static exec(type: EventType.ACTIVE_TAB_CHANGE, payload: {
10
+ currentTab: ActiveTabKeys;
11
+ nextTab: ActiveTabKeys;
12
+ }): boolean;
13
+ }
14
+ export declare enum EventType {
15
+ FOCUS_IDX_CHANGE = "focusIdxChange",
16
+ ADD_BLOCK = "addBlock",
17
+ REMOVE_BLOCK = "removeBlock",
18
+ ACTIVE_TAB_CHANGE = "activeTabChange"
19
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare function getChildSelector(selector: string, index: number): string;
3
+ export declare function HtmlStringToPreviewReactNodes(content: string): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { JSX } from 'react';
2
+ export declare function getChildSelector(selector: string, index: number): string;
3
+ export interface HtmlStringToReactNodesOptions {
4
+ enabledMergeTagsBadge: boolean;
5
+ }
6
+ export declare function HtmlStringToReactNodes(content: string, option: HtmlStringToReactNodesOptions): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare class MergeTagBadge {
2
+ static transform(content: string, id?: string): string;
3
+ static revert(content: string, generateMergeTag: (s: string) => string): string;
4
+ }
@@ -0,0 +1,4 @@
1
+ export declare function awaitForElement<T extends HTMLElement>(idx: string): {
2
+ cancel: () => void;
3
+ promise: Promise<T>;
4
+ };
@@ -0,0 +1 @@
1
+ export declare function classnames(...rest: any[]): string;
@@ -0,0 +1,4 @@
1
+ export declare function getContentEditableType(type: string): string;
2
+ export declare function getContentEditableTypeFromClassName(classList: DOMTokenList | string): string;
3
+ export declare function getContentEditableIdx(idx: string): string;
4
+ export declare function getContentEditableIdxFromClassName(classList: DOMTokenList | string): string;
@@ -0,0 +1 @@
1
+ export declare function generateTranslate(localeData: Record<string, string>): any;
@@ -0,0 +1 @@
1
+ export declare const getBlockNodeByChildEle: (target?: Element | null) => HTMLElement | null;
@@ -0,0 +1 @@
1
+ export declare const getBlockNodeByIdx: (idx: string) => HTMLElement | null;
@@ -0,0 +1 @@
1
+ export declare const getBlockNodes: () => Element[];
@@ -0,0 +1 @@
1
+ export declare function getContentEditableClassName(blockType: string, idx: string): string[];
@@ -0,0 +1,15 @@
1
+ export type DirectionPosition = {
2
+ horizontal: {
3
+ direction: string;
4
+ isEdge: boolean;
5
+ };
6
+ vertical: {
7
+ direction: string;
8
+ isEdge: boolean;
9
+ };
10
+ };
11
+ export declare function getDirectionPosition(ev: {
12
+ target: EventTarget | null;
13
+ clientY: number;
14
+ clientX: number;
15
+ }, deviation?: number): DirectionPosition;
@@ -0,0 +1 @@
1
+ export declare const getEditorRoot: () => HTMLElement | null;
@@ -0,0 +1,5 @@
1
+ declare const defaultImagesMap: {
2
+ IMAGE_59: string;
3
+ };
4
+ export declare function getImg(name: keyof typeof defaultImagesMap): string;
5
+ export {};
@@ -0,0 +1,17 @@
1
+ import { IPage } from '@thanhpv102/easy-email-core';
2
+ import { DirectionPosition } from './getDirectionPosition';
3
+ interface Params {
4
+ context: {
5
+ content: IPage;
6
+ };
7
+ idx: string;
8
+ directionPosition: DirectionPosition;
9
+ dragType: string;
10
+ }
11
+ export declare function getInsertPosition(params: Params): {
12
+ parentIdx: string;
13
+ insertIndex: number;
14
+ endDirection: string;
15
+ hoverIdx: string;
16
+ } | null;
17
+ export {};
@@ -0,0 +1 @@
1
+ export declare const getPluginElement: () => HTMLElement | null | undefined;
@@ -0,0 +1 @@
1
+ export declare const getShadowRoot: () => ShadowRoot;
@@ -0,0 +1,12 @@
1
+ export { getBlockNodeByChildEle } from './getBlockNodeByChildEle';
2
+ export { getBlockNodeByIdx } from './getBlockNodeByIdx';
3
+ export { getDirectionPosition } from './getDirectionPosition';
4
+ export { getBlockNodes } from './getBlockNodes';
5
+ export { getEditorRoot } from './getEditorRoot';
6
+ export { getShadowRoot } from './getShadowRoot';
7
+ export { getPluginElement } from './getPluginElement';
8
+ export { scrollBlockEleIntoView } from './scrollBlockEleIntoView';
9
+ export { isTextBlock } from './isTextBlock';
10
+ export { MergeTagBadge } from './MergeTagBadge';
11
+ export { getContentEditableClassName } from './getContentEditableClassName';
12
+ export { EventManager } from './EventManager';
@@ -0,0 +1 @@
1
+ export declare function isButtonBlock(blockType: any): boolean;
@@ -0,0 +1 @@
1
+ export declare function isNavbarBlock(blockType: any): boolean;
@@ -0,0 +1 @@
1
+ export declare function isTableBlock(blockType: any): boolean;
@@ -0,0 +1 @@
1
+ export declare function isTextBlock(blockType: any): boolean;
@@ -0,0 +1,2 @@
1
+ export declare const overrideErrorLog: () => void;
2
+ export declare const restoreErrorLog: () => void;
@@ -0,0 +1,3 @@
1
+ export declare function scrollBlockEleIntoView({ idx }: {
2
+ idx: string;
3
+ }): void;
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@thanhpv102/easy-email-editor",
3
+ "license": "MIT",
4
+ "description": "Email editor",
5
+ "version": "4.19.0",
6
+ "author": "m-Ryan",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git@github.com:zalify/easy-email.git"
10
+ },
11
+ "keywords": [
12
+ "email editor core"
13
+ ],
14
+ "files": [
15
+ "lib"
16
+ ],
17
+ "main": "lib/index.js",
18
+ "types": "lib/index.d.ts",
19
+ "husky": {
20
+ "hooks": {
21
+ "pre-commit": "yarn test && yarn lint-staged"
22
+ }
23
+ },
24
+ "lint-staged": {
25
+ "src/*.{js,jsx,ts,tsx}, example/*.{js,jsx,ts,tsx}": [
26
+ "yarn lint"
27
+ ]
28
+ },
29
+ "dependencies": {
30
+ "final-form": "^5.0.0",
31
+ "final-form-arrays": "^4.0.0",
32
+ "final-form-set-field-touched": "^1.0.1",
33
+ "is-hotkey": "^0.2.0",
34
+ "lodash": "^4.17.21",
35
+ "react-final-form-arrays": "^4.0.0",
36
+ "react-use": "^17.3.1"
37
+ },
38
+ "devDependencies": {
39
+ "@types/final-form-set-field-touched": "^1.0.0",
40
+ "@types/is-hotkey": "^0.1.7",
41
+ "@types/lodash": "^4.14.178",
42
+ "@types/node": "^16.11.7",
43
+ "@types/react": "^19.0.0",
44
+ "@types/react-dom": "^19.0.0",
45
+ "@typescript-eslint/eslint-plugin": "^5.22.0",
46
+ "@typescript-eslint/parser": "^4.28.3",
47
+ "eslint": "^9.26.0",
48
+ "eslint-config-prettier": "^8.3.0",
49
+ "eslint-loader": "^4.0.2",
50
+ "eslint-plugin-import": "^2.23.4",
51
+ "eslint-plugin-prettier": "^3.4.0",
52
+ "eslint-plugin-react": "^7.24.0",
53
+ "eslint-plugin-react-hooks": "^4.2.0",
54
+ "mjml-browser": "^4.10.4",
55
+ "react": "^19.0.0",
56
+ "react-dom": "^19.0.0",
57
+ "react-final-form": "^7.0.0",
58
+ "rimraf": "^3.0.2",
59
+ "sass": "^1.43.4",
60
+ "tsc-alias": "^1.4.1",
61
+ "typescript": "^4.6.3",
62
+ "vite": "^7.1.11"
63
+ },
64
+ "peerDependencies": {
65
+ "@thanhpv102/easy-email-core": "^4.19.0",
66
+ "mjml-browser": "^4.10.4",
67
+ "react": "^19.0.0",
68
+ "react-dom": "^19.0.0",
69
+ "react-final-form": "^7.0.0"
70
+ },
71
+ "gitHead": "2a08e8af15766344de708d891c1c8ea31bb77646",
72
+ "scripts": {
73
+ "dev": "vite",
74
+ "typings": "tsc --declaration --emitDeclarationOnly --project tsconfig.lib.json && tsc-alias -p tsconfig.alias.json",
75
+ "build": "rimraf lib && npm run typings && vite build --config vite.config.ts",
76
+ "format": "eslint --fix --ext .tsx,.ts,.tsx src/"
77
+ }
78
+ }
package/readme.md ADDED
@@ -0,0 +1,43 @@
1
+ # Easy-email-editor
2
+
3
+ ## Introduction
4
+
5
+ Email render and preview container.
6
+
7
+ ## usage
8
+
9
+ ```sh
10
+ $ npm install --save easy-email-editor
11
+ ```
12
+
13
+ or
14
+
15
+ ```sh
16
+ $ yarn add easy-email-editor
17
+ ```
18
+
19
+ ```js
20
+ import React from 'react';
21
+ import { BlockManager } from 'easy-email-core';
22
+ import { EmailEditor, EmailEditorProvider } from 'easy-email-editor';
23
+ import 'easy-email-editor/lib/style.css';
24
+
25
+ const initialValues = {
26
+ subject: 'Welcome to Easy-email',
27
+ subTitle: 'Nice to meet you!',
28
+ content: BlockManager.getBlockByType(BasicType.PAGE).create({}),
29
+ };
30
+
31
+ export function App() {
32
+ return (
33
+ <EmailEditorProvider
34
+ data={initialValues}
35
+ height={'calc(100vh - 72px)'}
36
+ >
37
+ {({ values }) => {
38
+ return <EmailEditor />;
39
+ }}
40
+ </EmailEditorProvider>
41
+ );
42
+ }
43
+ ```