From 6dc1e784657c9a4eff8c33175192baa329560433 Mon Sep 17 00:00:00 2001 From: lucasbesen Date: Thu, 27 May 2021 11:25:00 -0300 Subject: [PATCH 1/4] Ability to change displayMode --- README.md | 117 ++++++++++++++++----------------- src/components/EmailEditor.vue | 31 +++++---- 2 files changed, 73 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 87a03f0..6b7a460 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Vue Email Editor -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. +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. -Video Overview | -:---: | -[![Vue Email Editor](https://unroll-assets.s3.amazonaws.com/unlayervideotour.png)](https://www.youtube.com/watch?v=MIWhX-NF3j8) | -*Watch video overview: https://youtu.be/MIWhX-NF3j8* | +| Video Overview | +| :-----------------------------------------------------------------------------------------------------------------------------: | +| [![Vue Email Editor](https://unroll-assets.s3.amazonaws.com/unlayervideotour.png)](https://www.youtube.com/watch?v=MIWhX-NF3j8) | +| _Watch video overview: https://youtu.be/MIWhX-NF3j8_ | ## Live Demo @@ -48,12 +48,12 @@ Next, you'll need to import the Email Editor component to your app. ``` ### Methods -| method | params | description | -| --------------- | ------------------------ | -------------------------------------------------------------- | -| **loadDesign** | `Object data` | Takes the design JSON and loads it in the editor | -| **saveDesign** | `Function callback` | Returns the design JSON in a callback function | -| **exportHtml** | `Function callback` | Returns the design HTML and JSON in a callback function | + +| method | params | description | +| -------------- | ------------------- | ------------------------------------------------------- | +| **loadDesign** | `Object data` | Takes the design JSON and loads it in the editor | +| **saveDesign** | `Function callback` | Returns the design JSON in a callback function | +| **exportHtml** | `Function callback` | Returns the design HTML and JSON in a callback function | See the [example source](https://github.com/unlayer/vue-email-editor/tree/master/src) for a reference implementation. ### Properties -* `minHeight` `String` minimum height to initialize the editor with (default 500px) -* `options` `Object` options passed to the Unlayer editor instance (default {}) -* `tools` `Object` configuration for the built-in and custom tools (default {}) -* `appearance` `Object` configuration for appearance and theme (default {}) -* `projectId` `Integer` Unlayer project ID (optional) -* `locale` `String` translations string (default en-US) +- `minHeight` `String` minimum height to initialize the editor with (default 500px) +- `options` `Object` options passed to the Unlayer editor instance (default {}) +- `tools` `Object` configuration for the built-in and custom tools (default {}) +- `appearance` `Object` configuration for appearance and theme (default {}) +- `projectId` `Integer` Unlayer project ID (optional) +- `locale` `String` translations string (default en-US) See the [Unlayer Docs](https://docs.unlayer.com/) for all available options. Here's an example using the above properties... -**App.vue** +**App.vue** + ```html ``` @@ -188,7 +182,6 @@ Custom tools can help you add your own content blocks to the editor. Every appli [![Custom Tools](https://unroll-assets.s3.amazonaws.com/custom_tools.png)](https://docs.unlayer.com/docs/custom-tools) - ## Localization 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) diff --git a/src/components/EmailEditor.vue b/src/components/EmailEditor.vue index dae1a8a..4949b74 100644 --- a/src/components/EmailEditor.vue +++ b/src/components/EmailEditor.vue @@ -1,5 +1,9 @@ \ No newline at end of file + From 8218590a1dd641a36226f434aa9998f53c5d3d0c Mon Sep 17 00:00:00 2001 From: lucasbesen Date: Thu, 27 May 2021 11:31:47 -0300 Subject: [PATCH 2/4] Add displayMode property example --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6b7a460..7ec3d0a 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ See the [example source](https://github.com/unlayer/vue-email-editor/tree/master - `appearance` `Object` configuration for appearance and theme (default {}) - `projectId` `Integer` Unlayer project ID (optional) - `locale` `String` translations string (default en-US) +- `displayMode` `String` configuration for display mode (`web` or `email`) (default `email`) See the [Unlayer Docs](https://docs.unlayer.com/) for all available options. From 118d69e453d2184995a8eae1129a3cf6c23476da Mon Sep 17 00:00:00 2001 From: lucasbesen Date: Fri, 28 May 2021 13:01:08 -0300 Subject: [PATCH 3/4] Fix display-mode property usage example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ec3d0a..fca09a2 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,6 @@ Here's an example using the above properties... From 41bc4c3d49fd01e64b841004af0774da9dcefe26 Mon Sep 17 00:00:00 2001 From: lucasbesen Date: Mon, 31 May 2021 14:44:52 -0300 Subject: [PATCH 4/4] Improve displayMode props logic --- src/components/EmailEditor.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/EmailEditor.vue b/src/components/EmailEditor.vue index 4949b74..b2f1b1e 100644 --- a/src/components/EmailEditor.vue +++ b/src/components/EmailEditor.vue @@ -15,7 +15,11 @@ let lastEditorId = 0; export default { name: 'EmailEditor', props: { - displayMode: String, + displayMode: { + type: String, + required: false, + default: 'email', + }, options: Object, projectId: Number, tools: Object, @@ -38,7 +42,7 @@ export default { methods: { loadEditor() { const options = this.options || {}; - const displayMode = this.displayMode || 'email'; + const displayMode = this.displayMode; if (this.projectId) { options.projectId = this.projectId;