1
1
# Yakoue Email Editor
2
2
3
+ ![ Yakoue Email builder] ( https://my-ykmail-bucket.s3.eu-west-3.amazonaws.com/icons/yakoue-vuejs1.png )
4
+
3
5
## Install
4
6
5
7
### CDN
@@ -17,7 +19,9 @@ $ yarn @yakoue/vue-email-builder
17
19
18
20
```
19
21
20
- ## component
22
+ ## Usage
23
+
24
+ Next, you'll need to import the Email Builder component to your app.
21
25
22
26
``` vue
23
27
<template>
@@ -30,51 +34,92 @@ $ yarn @yakoue/vue-email-builder
30
34
<button @click="exportHtml">Export HTML</button>
31
35
</div>
32
36
33
- <YakoueEditor ref="emailbuilder" :config="config" @init ="editorLoaded" />
37
+ <EmailBuilder ref="emailbuilder" :config="config" @load ="editorLoaded" />
34
38
</div>
35
39
</div>
36
40
</template>
37
41
38
42
<script>
39
- import { YakoueEditor } from '../components'
40
- import templateData from '../data/template1.js'
43
+ import EmailBuilder from '@yakoue/vue-email-builder'
41
44
export default {
42
45
name: 'Example',
43
46
components: {
44
- YakoueEditor ,
47
+ EmailBuilder ,
45
48
},
46
49
data() {
47
50
return {
48
51
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>`,
50
64
}
51
65
},
52
- mounted() {
53
- this.$nextTick(() => {})
54
- },
55
66
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) => {
60
71
console.log('exportHtml', data)
61
72
})
73
+ this.instance.setTemplate(emailTemplate)
62
74
},
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))
67
78
})
68
- this.$refs.emailbuilder. instance.save()
79
+ this.instance.save()
69
80
},
70
81
exportHtml() {
71
- this.$refs.emailbuilder. instance.export()
82
+ this.instance.export()
72
83
},
73
84
},
74
85
}
75
86
</script>
76
87
```
77
88
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
+
78
123
### Compiles and hot-reloads for development
79
124
80
125
```
@@ -96,3 +141,5 @@ yarn lint
96
141
### Customize configuration
97
142
98
143
See [ Configuration Reference] ( https://cli.vuejs.org/config/ ) .
144
+
145
+ For any report please write to
[email protected]
0 commit comments