mailcraft-studio-iwell 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +60 -2
- package/dist/index.cjs +1582 -0
- package/dist/index.mjs +1552 -0
- package/dist/style.css +1 -0
- package/package.json +22 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Excel Net Solutions Private Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mailcraft-studio-iwell
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Drag and drop email template builder, as a React component. Users build an email from rows and blocks (heading, text, image, button, divider, spacer, HTML) and the builder outputs email-safe HTML: table layout, inline styles, no `<style>` tag.
|
|
4
|
+
|
|
5
|
+
The saved HTML carries `data-iw-*` markers, so opening it again restores every row and block for editing. HTML without markers opens as a single HTML block, so nothing is lost.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install mailcraft-studio-iwell
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Needs `react` and `react-dom` 18 in the app. Import the stylesheet once, anywhere in the app.
|
|
14
|
+
|
|
15
|
+
Browser only: the component and `sanitizeHtml` need a DOM. Importing the package on a server is safe, but calling `sanitizeHtml` there throws rather than returning unsanitized HTML.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
import EmailBuilder from 'mailcraft-studio-iwell'
|
|
21
|
+
import 'mailcraft-studio-iwell/style.css'
|
|
22
|
+
|
|
23
|
+
<EmailBuilder
|
|
24
|
+
initialValue={html} // builder HTML, classic HTML, or ''
|
|
25
|
+
onChange={(html) => ...} // sanitized HTML on every change (not on load)
|
|
26
|
+
height={715}
|
|
27
|
+
mergeTags={[{ label: 'Client name', value: '${name}' }]}
|
|
28
|
+
imageAccept=".jpg,.jpeg,.png"
|
|
29
|
+
onImageFileSelect={(file) => Promise<url | null>}
|
|
30
|
+
onImageUrlChange={(url) => Promise<url>}
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| Prop | Default | Notes |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `initialValue` | `''` | Read once. Remount with a `key` to load other content. |
|
|
37
|
+
| `onChange(html)` | – | Called on every change, never on load. |
|
|
38
|
+
| `height` | `715` | Pixel height (600px at ≤1024px wide). |
|
|
39
|
+
| `mergeTags` | `${name}`, `${token}` | Tags offered in the text toolbar's "Merge tags" menu. |
|
|
40
|
+
| `logoTag` | – | When set (for example `${logo}`), the image settings offer **Use company logo**, which uses the tag as the image source. The canvas shows a "Company logo" placeholder, and the sending backend is expected to replace the tag with the real logo URL. |
|
|
41
|
+
| `onImageFileSelect` / `onImageUrlChange` | – | Same contract as `mailcraft-editor-iwell`: resolve with the image URL to use. |
|
|
42
|
+
| `imageAccept` | `image/*` | |
|
|
43
|
+
|
|
44
|
+
**Ref:** `getContent()` returns the HTML; `getDesign()` returns the design JSON.
|
|
45
|
+
|
|
46
|
+
## Other exports
|
|
47
|
+
|
|
48
|
+
| Export | Purpose |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `isBuilderHtml(html)` | `true` when the HTML was made by the builder. Use it to choose which editor to open. |
|
|
51
|
+
| `parseHtml(html)` | HTML to design JSON. |
|
|
52
|
+
| `exportHtml(design)` | Design JSON to email HTML. |
|
|
53
|
+
| `sanitizeHtml(html)` | The sanitizer the builder uses. |
|
|
54
|
+
|
|
55
|
+
## Known limitation
|
|
56
|
+
|
|
57
|
+
Outlook desktop on Windows does not support the `inline-block` columns, so multi-column rows stack there. Single-column emails look the same everywhere.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|