|
1 |
| -# vue-email-editor |
| 1 | +# Vue Email Editor |
2 | 2 |
|
3 |
| -## Project setup |
4 |
| -``` |
5 |
| -yarn install |
6 |
| -``` |
| 3 | +The excellent drag-n-drop email editor by [Unlayer](https://unlayer.com) as a [Vue](https://vuejs.org/) *wrapper component*. This is the most powerful and developer friendly visual email builder for your app. |
7 | 4 |
|
8 |
| -### Compiles and hot-reloads for development |
9 |
| -``` |
10 |
| -yarn run serve |
11 |
| -``` |
| 5 | +Video Overview | |
| 6 | +:---: | |
| 7 | +[](https://www.youtube.com/watch?v=MIWhX-NF3j8) | |
| 8 | +*Watch video overview: https://youtu.be/MIWhX-NF3j8* | |
| 9 | + |
| 10 | +## Live Demo |
| 11 | + |
| 12 | +Check out the live demo here: https://vue-email-editor-demo.netlify.app/ ([Source Code](https://github.com/unlayer/vue-email-editor/tree/master/src)) |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +The easiest way to use Vue Email Editor is to install it from Npm or Yarn and include it in your own Vue build process. |
12 | 17 |
|
13 |
| -### Compiles and minifies for production |
14 | 18 | ```
|
15 |
| -yarn run build |
| 19 | +npm install vue-email-editor --save |
16 | 20 | ```
|
17 | 21 |
|
18 |
| -### Run your tests |
| 22 | +or |
| 23 | + |
19 | 24 | ```
|
20 |
| -yarn run test |
| 25 | +yarn add vue-email-editor |
21 | 26 | ```
|
22 | 27 |
|
23 |
| -### Lints and fixes files |
24 |
| -``` |
25 |
| -yarn run lint |
| 28 | +## Usage |
| 29 | + |
| 30 | +Next, you'll need to import the Email Editor component to your app. |
| 31 | + |
| 32 | +**App.vue** |
| 33 | + |
| 34 | +```html |
| 35 | +<template> |
| 36 | + <div id="app"> |
| 37 | + <div class="container"> |
| 38 | + <div id="bar"> |
| 39 | + <h1>Vue Email Editor (Demo)</h1> |
| 40 | + |
| 41 | + <button v-on:click="saveDesign">Save Design</button> |
| 42 | + <button v-on:click="exportHtml">Export HTML</button> |
| 43 | + </div> |
| 44 | + |
| 45 | + <EmailEditor ref="editor" v-on:load="editorLoaded" /> |
| 46 | + </div> |
| 47 | + </div> |
| 48 | +</template> |
| 49 | + |
| 50 | +<script> |
| 51 | + import EmailEditor from 'vue-email-editor' |
| 52 | + |
| 53 | + export default { |
| 54 | + name: 'app', |
| 55 | + components: { |
| 56 | + EmailEditor |
| 57 | + }, |
| 58 | + methods: { |
| 59 | + editorLoaded() { |
| 60 | + this.$refs.editor.loadDesign(sample); |
| 61 | + }, |
| 62 | + saveDesign() { |
| 63 | + this.$refs.editor.saveDesign( |
| 64 | + (design) => { |
| 65 | + console.log('saveDesign', design); |
| 66 | + } |
| 67 | + ) |
| 68 | + }, |
| 69 | + exportHtml() { |
| 70 | + this.$refs.editor.exportHtml( |
| 71 | + (data) => { |
| 72 | + console.log('exportHtml', data); |
| 73 | + } |
| 74 | + ) |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | +</script> |
26 | 79 | ```
|
| 80 | + |
| 81 | +### Methods |
| 82 | +| method | params | description | |
| 83 | +| --------------- | ------------------------ | -------------------------------------------------------------- | |
| 84 | +| **loadDesign** | `Object data` | Takes the design JSON and loads it in the editor | |
| 85 | +| **saveDesign** | `Function callback` | Returns the design JSON in a callback function | |
| 86 | +| **exportHtml** | `Function callback` | Returns the design HTML and JSON in a callback function | |
| 87 | + |
| 88 | +### Properties |
| 89 | + |
| 90 | +* `minHeight` `String` minimum height to initialize the editor with (default 500px) |
| 91 | +* `options` `Object` options passed to the Unlayer editor instance (default {}) |
| 92 | +* `tools` `Object` configuration for the built-in and custom tools (default {}) |
| 93 | +* `appearance` `Object` configuration for appearance and theme (default {}) |
| 94 | +* `projectId` `Integer` Unlayer project ID (optional) |
| 95 | +* `locale` `String` translations string (default en-US) |
| 96 | + |
| 97 | +See the [Unlayer Docs](https://docs.unlayer.com/) for all available options. |
| 98 | + |
| 99 | +See the [example source](https://github.com/unlayer/vue-email-editor/tree/master/src) for a reference implementation. |
| 100 | + |
| 101 | +## Custom Tools |
| 102 | + |
| 103 | +Custom tools can help you add your own content blocks to the editor. Every application is different and needs different tools to reach it's full potential. [Learn More](https://docs.unlayer.com/docs/custom-tools) |
| 104 | + |
| 105 | +[](https://docs.unlayer.com/docs/custom-tools) |
| 106 | + |
| 107 | + |
| 108 | +## Localization |
| 109 | + |
| 110 | +You can submit new language translations by creating a PR on this GitHub repo: https://github.com/unlayer/translations. Translations managed by [PhraseApp](https://phraseapp.com) |
| 111 | + |
| 112 | +### License |
| 113 | + |
| 114 | +Copyright (c) 2020 Unlayer. [MIT](LICENSE) Licensed. |
0 commit comments