11# Vue Email Editor
22
3- The excellent drag-n-drop email editor by [ Unlayer] ( https://unlayer.com/embed ) as a [ Vue] ( https://vuejs.org/ ) * wrapper component * . This is the most powerful and developer friendly visual email builder for your app.
3+ The excellent drag-n-drop email editor by [ Unlayer] ( https://unlayer.com/embed ) as a [ Vue] ( https://vuejs.org/ ) _ wrapper component _ . This is the most powerful and developer friendly visual email builder for your app.
44
5- Video Overview |
6- : ---: |
7- [ ![ Vue Email Editor] ( https://unroll-assets.s3.amazonaws.com/unlayervideotour.png )] ( https://www.youtube.com/watch?v=MIWhX-NF3j8 ) |
8- * Watch video overview: https://youtu.be/MIWhX-NF3j8 * |
5+ | Video Overview |
6+ | :-------------------------------------------------------------------------------------------------------------------------- ---: |
7+ | [ ![ Vue Email Editor] ( https://unroll-assets.s3.amazonaws.com/unlayervideotour.png )] ( https://www.youtube.com/watch?v=MIWhX-NF3j8 ) |
8+ | _ Watch video overview: https://youtu.be/MIWhX-NF3j8_ |
99
1010## Live Demo
1111
@@ -48,60 +48,59 @@ Next, you'll need to import the Email Editor component to your app.
4848</template >
4949
5050<script >
51- import { EmailEditor } from ' vue-email-editor'
52-
51+ import { EmailEditor } from ' vue-email-editor' ;
52+
5353 export default {
5454 name: ' app' ,
5555 components: {
56- EmailEditor
56+ EmailEditor,
5757 },
5858 methods: {
5959 editorLoaded () {
6060 // Pass the template JSON here
6161 // this.$refs.emailEditor.editor.loadDesign({});
6262 },
6363 saveDesign () {
64- this .$refs .emailEditor .editor .saveDesign (
65- (design ) => {
66- console .log (' saveDesign' , design);
67- }
68- )
64+ this .$refs .emailEditor .editor .saveDesign ((design ) => {
65+ console .log (' saveDesign' , design);
66+ });
6967 },
7068 exportHtml () {
71- this .$refs .emailEditor .editor .exportHtml (
72- (data ) => {
73- console .log (' exportHtml' , data);
74- }
75- )
76- }
77- }
78- }
69+ this .$refs .emailEditor .editor .exportHtml ((data ) => {
70+ console .log (' exportHtml' , data);
71+ });
72+ },
73+ },
74+ };
7975 </script >
8076```
8177
8278### Methods
83- | method | params | description |
84- | --------------- | ------------------------ | -------------------------------------------------------------- |
85- | ** loadDesign** | ` Object data ` | Takes the design JSON and loads it in the editor |
86- | ** saveDesign** | ` Function callback ` | Returns the design JSON in a callback function |
87- | ** exportHtml** | ` Function callback ` | Returns the design HTML and JSON in a callback function |
79+
80+ | method | params | description |
81+ | -------------- | ------------------- | ------------------------------------------------------- |
82+ | ** loadDesign** | ` Object data ` | Takes the design JSON and loads it in the editor |
83+ | ** saveDesign** | ` Function callback ` | Returns the design JSON in a callback function |
84+ | ** exportHtml** | ` Function callback ` | Returns the design HTML and JSON in a callback function |
8885
8986See the [ example source] ( https://github.com/unlayer/vue-email-editor/tree/master/src ) for a reference implementation.
9087
9188### Properties
9289
93- * ` minHeight ` ` String ` minimum height to initialize the editor with (default 500px)
94- * ` options ` ` Object ` options passed to the Unlayer editor instance (default {})
95- * ` tools ` ` Object ` configuration for the built-in and custom tools (default {})
96- * ` appearance ` ` Object ` configuration for appearance and theme (default {})
97- * ` projectId ` ` Integer ` Unlayer project ID (optional)
98- * ` locale ` ` String ` translations string (default en-US)
90+ - ` editorId ` ` String ` HTML div id of the container where the editor will be embedded (optional)
91+ - ` minHeight ` ` String ` minimum height to initialize the editor with (default 500px)
92+ - ` options ` ` Object ` options passed to the Unlayer editor instance (default {})
93+ - ` tools ` ` Object ` configuration for the built-in and custom tools (default {})
94+ - ` appearance ` ` Object ` configuration for appearance and theme (default {})
95+ - ` projectId ` ` Integer ` Unlayer project ID (optional)
96+ - ` locale ` ` String ` translations string (default en-US)
9997
10098See the [ Unlayer Docs] ( https://docs.unlayer.com/ ) for all available options.
10199
102100Here's an example using the above properties...
103101
104- ** App.vue**
102+ ** App.vue**
103+
105104``` html
106105<template >
107106 <div id =" app" >
@@ -123,62 +122,57 @@ Here's an example using the above properties...
123122 ref =" emailEditor"
124123 v-on:load =" editorLoaded"
125124 />
126-
127125 </div >
128126 </div >
129127</template >
130128
131129<script >
132- import { EmailEditor } from ' vue-email-editor'
133-
130+ import { EmailEditor } from ' vue-email-editor' ;
131+
134132 export default {
135133 name: ' app' ,
136134 components: {
137- EmailEditor
135+ EmailEditor,
138136 },
139- data () {
140- return {
141- minHeight: " 1000px" ,
142- locale: " en " ,
137+ data () {
138+ return {
139+ minHeight: ' 1000px' ,
140+ locale: ' en ' ,
143141 projectId: 0 , // replace with your project id
144142 tools: {
145143 // disable image tool
146144 image: {
147- enabled: false
148- }
145+ enabled: false ,
146+ },
149147 },
150148 options: {},
151149 appearance: {
152150 theme: ' dark' ,
153151 panels: {
154152 tools: {
155- dock: ' right'
156- }
157- }
158- }
159- }
153+ dock: ' right' ,
154+ },
155+ },
156+ },
157+ };
160158 },
161159 methods: {
162160 editorLoaded () {
163161 // Pass your template JSON here
164162 // this.$refs.emailEditor.editor.loadDesign({});
165163 },
166164 saveDesign () {
167- this .$refs .emailEditor .editor .saveDesign (
168- (design ) => {
169- console .log (' saveDesign' , design);
170- }
171- )
165+ this .$refs .emailEditor .editor .saveDesign ((design ) => {
166+ console .log (' saveDesign' , design);
167+ });
172168 },
173169 exportHtml () {
174- this .$refs .emailEditor .editor .exportHtml (
175- (data ) => {
176- console .log (' exportHtml' , data);
177- }
178- )
179- }
180- }
181- }
170+ this .$refs .emailEditor .editor .exportHtml ((data ) => {
171+ console .log (' exportHtml' , data);
172+ });
173+ },
174+ },
175+ };
182176 </script >
183177```
184178
@@ -188,7 +182,6 @@ Custom tools can help you add your own content blocks to the editor. Every appli
188182
189183[ ![ Custom Tools] ( https://unroll-assets.s3.amazonaws.com/custom_tools.png )] ( https://docs.unlayer.com/docs/custom-tools )
190184
191-
192185## Localization
193186
194187You 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 )
0 commit comments