11# Yakoue Email Editor
22
3+ ![ Yakoue Email builder] ( https://my-ykmail-bucket.s3.eu-west-3.amazonaws.com/icons/yakoue-vuejs1.png )
4+
35## Install
46
57### CDN
@@ -17,7 +19,9 @@ $ yarn @yakoue/vue-email-builder
1719
1820```
1921
20- ## component
22+ ## Usage
23+
24+ Next, you'll need to import the Email Builder component to your app.
2125
2226``` vue
2327<template>
@@ -30,51 +34,92 @@ $ yarn @yakoue/vue-email-builder
3034 <button @click="exportHtml">Export HTML</button>
3135 </div>
3236
33- <YakoueEditor ref="emailbuilder" :config="config" @init ="editorLoaded" />
37+ <EmailBuilder ref="emailbuilder" :config="config" @load ="editorLoaded" />
3438 </div>
3539 </div>
3640</template>
3741
3842<script>
39- import { YakoueEditor } from '../components'
40- import templateData from '../data/template1.js'
43+ import EmailBuilder from '@yakoue/vue-email-builder'
4144export default {
4245 name: 'Example',
4346 components: {
44- YakoueEditor ,
47+ EmailBuilder ,
4548 },
4649 data() {
4750 return {
4851 config: {},
49- /* template: templateData, */
52+ emailTemplate: `<mjml>
53+ <mj-body>
54+ <mj-section>
55+ <mj-column>
56+ <mj-text>
57+ <h1> Hey Title! </h1>
58+ </mj-text>
59+ <mj-button> Hi nestor! </mj-button>
60+ </mj-column>
61+ </mj-section>
62+ </mj-body>
63+ </mjml>`,
5064 }
5165 },
52- mounted() {
53- this.$nextTick(() => {})
54- },
5566 methods: {
56- editorLoaded() {
57- // this.$refs.emailbuilder.instance.setTemplate(templateData)
58-
59- this.$refs.emailbuilder. instance.addEvent('onExport', (data) => {
67+ editorLoaded(instance ) {
68+ //
69+ this.instance = instance
70+ this.instance.addEvent('onExport', (data) => {
6071 console.log('exportHtml', data)
6172 })
73+ this.instance.setTemplate(emailTemplate)
6274 },
63- saveDesign() {
64- // console.log(' template ' + JSON.stringify(templateData, null, 2))
65- this.$refs.emailbuilder.instance.addEvent('onSave', (design) => {
66- console.log('saveDesign', JSON.stringify(design, null, 2))
75+ saveTemplate() {
76+ this.addEvent('onSave', (template) => {
77+ console.log('saveTemplate', JSON.stringify(template, null, 2))
6778 })
68- this.$refs.emailbuilder. instance.save()
79+ this.instance.save()
6980 },
7081 exportHtml() {
71- this.$refs.emailbuilder. instance.export()
82+ this.instance.export()
7283 },
7384 },
7485}
7586</script>
7687```
7788
89+ ## Methods
90+
91+ | Method | Param | description |
92+ | ---------------- | ----------------- | ------------------------------------------------------- |
93+ | ** load** | Builder Instance | Callback function on builder load |
94+ | ** setTemplate** | template | Take the template and load it to the builder |
95+ | ** saveTemplate** | Function callback | Returns the design JSON and HTML in a callback function |
96+ | ** exportHtml** | Function callback | Returns the design HTML in a callback function |
97+
98+ ## Properties
99+
100+ ** template** _ object_ or _ string_ You can set MJML Json on MJML XML as string to this props
101+ ** config** _ object_ You can use this props to config and customize the builder
102+ ** onLoad** _ function callback_ You can use this to set call back function on builder load
103+
104+ ### Configuration Options
105+
106+ ---
107+
108+ | Attribute | Required | |
109+ | :---------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
110+ | ** brand** <br />_ object_ | No | This is the Brand Object from Yakoue. You can get it from the Brand settings page. |
111+ | ** locale** <br />_ string_ | No | This is the locale you want to load the editor in. We have many translations available. |
112+ | ** fusionTags** <br /> _ object_ | No | This is an array of objects. You can pass the merge tags and special links to display in the editor. |
113+ | ** token** <br />_ string_ | No | String token for authentication. It is required to enable user saved blocks. |
114+ | ** tools** <br />_ object_ | No | These are the options for tools and custom tools. |
115+ | ** blocks** <br />_ object_ | No | This is an array of objects. You can pass custom blocks here. |
116+ | ** drows** <br />_ object_ | No | This is an array of objects. You can pass custom rows (sections) here. |
117+ | ** body** <br />_ object_ | No | This objects to custom default template settings |
118+ | ** editor** <br />_ object_ | No | These are some editor options for different functions of the editor. |
119+ | ** fonts** <br />_ object_ | No | You can pass custom fonts here. |
120+ | ** toolsDefaultValues** <br />_ object_ | No | You can pass default tools properties here. |
121+ | ** callbacks** <br />_ array_ | No | Array of callbacks functions |
122+
78123### Compiles and hot-reloads for development
79124
80125```
@@ -96,3 +141,5 @@ yarn lint
96141### Customize configuration
97142
98143See [ Configuration Reference] ( https://cli.vuejs.org/config/ ) .
144+
145+ For any report please write to contact@yakoue.com
0 commit comments