@lab2view/vue-email-editor 0.2.1 → 0.2.3
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/README.md +43 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="src/assets/logo.png" alt="@lab2view/vue-email-editor" width="200" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">@lab2view/vue-email-editor</h1>
|
|
1
|
+
# Vue Email Editor
|
|
6
2
|
|
|
7
3
|
<p align="center">
|
|
8
4
|
<a href="https://www.npmjs.com/package/@lab2view/vue-email-editor"><img src="https://img.shields.io/npm/v/@lab2view/vue-email-editor.svg?style=flat-square" alt="npm version" /></a>
|
|
@@ -14,11 +10,15 @@
|
|
|
14
10
|
</p>
|
|
15
11
|
|
|
16
12
|
<p align="center">
|
|
17
|
-
A professional, extensible drag-and-drop email editor with <strong>AI-assisted editing</strong>, built with <strong>Vue 3</strong> and <strong>MJML</strong>.<br/>
|
|
13
|
+
A professional, extensible <strong>drag-and-drop</strong> email editor with <strong>AI-assisted editing</strong>, built with <strong>Vue 3</strong> and <strong>MJML</strong>.<br/>
|
|
18
14
|
Design responsive HTML emails visually or let AI generate complete templates from a text description. 43 pre-built blocks, a plugin system, full i18n support, and a complete imperative API.<br/>
|
|
19
15
|
<strong>Free and open-source alternative to Unlayer, Beefree, and Stripo.</strong>
|
|
20
16
|
</p>
|
|
21
17
|
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://lab2view.github.io/vue-email-editor/#templates"><strong>Try the editor live →</strong></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
22
|
## Screenshots
|
|
23
23
|
|
|
24
24
|
| Blocks & Layout | Ready-made Templates |
|
|
@@ -454,62 +454,47 @@ Insert dynamic content with merge tag variables:
|
|
|
454
454
|
|
|
455
455
|
## AI Template Generation
|
|
456
456
|
|
|
457
|
-
Generate complete email templates from natural language
|
|
457
|
+
Generate complete email templates from natural language. Plug in any LLM — OpenAI, Anthropic, Google Gemini, or your own.
|
|
458
458
|
|
|
459
459
|
```vue
|
|
460
|
-
<
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
})
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
yield decoder.decode(value)
|
|
491
|
-
}
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
// Inline text generation (generate, improve, shorten, expand, translate)
|
|
495
|
-
generateText: async (prompt, context) => {
|
|
496
|
-
const res = await fetch('/api/ai/generate', {
|
|
497
|
-
method: 'POST',
|
|
498
|
-
body: JSON.stringify({ prompt, context }),
|
|
499
|
-
})
|
|
500
|
-
return (await res.json()).text
|
|
501
|
-
},
|
|
502
|
-
improveText: async (text, instruction) => {
|
|
503
|
-
const res = await fetch('/api/ai/improve', {
|
|
504
|
-
method: 'POST',
|
|
505
|
-
body: JSON.stringify({ text, instruction }),
|
|
506
|
-
})
|
|
507
|
-
return (await res.json()).text
|
|
508
|
-
},
|
|
509
|
-
}"
|
|
510
|
-
/>
|
|
460
|
+
<script setup lang="ts">
|
|
461
|
+
import { ref } from 'vue'
|
|
462
|
+
import { EmailEditor } from '@lab2view/vue-email-editor'
|
|
463
|
+
import type { AiProvider } from '@lab2view/vue-email-editor'
|
|
464
|
+
|
|
465
|
+
const mjml = ref('')
|
|
466
|
+
|
|
467
|
+
const aiProvider: AiProvider = {
|
|
468
|
+
generateText: async (prompt, context) => {
|
|
469
|
+
const res = await fetch('/api/ai/text', {
|
|
470
|
+
method: 'POST',
|
|
471
|
+
headers: { 'Content-Type': 'application/json' },
|
|
472
|
+
body: JSON.stringify({ prompt, context }),
|
|
473
|
+
})
|
|
474
|
+
return (await res.json()).text
|
|
475
|
+
},
|
|
476
|
+
generateTemplate: async (messages, systemPrompt) => {
|
|
477
|
+
const res = await fetch('/api/ai/chat', {
|
|
478
|
+
method: 'POST',
|
|
479
|
+
headers: { 'Content-Type': 'application/json' },
|
|
480
|
+
body: JSON.stringify({ messages, systemPrompt }),
|
|
481
|
+
})
|
|
482
|
+
return (await res.json()).content
|
|
483
|
+
},
|
|
484
|
+
}
|
|
485
|
+
</script>
|
|
486
|
+
|
|
487
|
+
<template>
|
|
488
|
+
<EmailEditor v-model="mjml" :ai-provider="aiProvider" />
|
|
489
|
+
</template>
|
|
511
490
|
```
|
|
512
491
|
|
|
492
|
+
Your backend just forwards to any LLM and returns the raw response. The editor handles JSON parsing, repair, and retry automatically.
|
|
493
|
+
|
|
494
|
+
**Want to test without an API key?** Use the [mock provider](https://lab2view.github.io/vue-email-editor/guide/ai#mock-provider-for-testing) — a static `AiProvider` that returns dummy responses for development and testing.
|
|
495
|
+
|
|
496
|
+
**[Full AI integration guide →](https://lab2view.github.io/vue-email-editor/guide/ai)** — complete backend examples for OpenAI, Anthropic, and Google Gemini, streaming setup, error handling, and more.
|
|
497
|
+
|
|
513
498
|
## ESP Export
|
|
514
499
|
|
|
515
500
|
Export HTML pre-formatted for your email service provider:
|