A block is an HTML component organized as an empty container where you can place other components: wiz-text
, wiz-image
, or wiz-button
. As best practice, add the wiz-placeholder
components to create a block. Then add other components within the columns in the wiz-placeholder
component.
<!-- ./node_modules/@blocks/block01/index.vue --><template> <wiz-block class="block content-2j m-p-lr-0" style="padding: 20px 45px;"> <wiz-placeholder class="m-full-width"> <wiz-column :width="100"> <wiz-title class="m-p-lr-20" :text="$t('title')"></wiz-title> <wiz-text class="m-p-lr-20" :text="$t('main_text1')" style="padding-top: 15px;"></wiz-text> </wiz-column> </wiz-placeholder> <wiz-divider class="m-p-lr-20" divider-color="#0084c4" :divider-height="2" style="width: 100%; padding: 40px 0 0;"> </wiz-divider> </wiz-block> </template>
For more information, see Blocks in eWizard and Block development. You can reuse blocks in your email project.
You can create blocks locally on your computer or add blocks from the eWizard.js repository. Also, you can group and filter blocks by brands or other custom filters.
Add local blocks
A local block is a directory with the index.vue
file containing the block template. Add local blocks to the common/blocks-library
directory of your email project. The block directory can also include other common assets and media files.
You can initialize an empty block template with eWizard CLI to develop your email block from scratch. Also, you can copy the existing block directory.
You can't use local blocks with the blocks added from the repository. The email App.vue
file must not have the blocks from ./node_modules/@blocks
in the template.
Before adding local blocks to the email scaffolding template:
1) Remove all existing blocks from the blocks.json
file:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "block1", "name": "Block1", "icon": "common/blocks-library/block1/icon.png" } ] }
2) Remove all blocks from the template in the App.vue
file.
<!-- ./App.vue --><template> <div> <wiz-root align="center" style="background: #ffffff; width: 700px;"> </wiz-root> </div> </template>
To add a local block:
1) Provide the path to the local blocks in the blocks
, blocksFilename
, and blocksManifest
fields of the ./.ewizard/settings.json
file.
For example:
// ./.ewizard/settings.json{ "path": { "blocks": "common/blocks-library", "blocksFilename": "blocks.json", "blocksManifest": "common/blocks-library/blocks.json" } }
— blocks
is a path to the directory where you store the blocks. The recommended path is common/blocks-library
.
— blocksFilename
is the name of the file that defines which blocks appear in eWizard Editor. The default value is blocks.json
.
— blocksManifest
is the full path to the file that defines what blocks appear in eWizard Editor. The default value is common/blocks-library/blocks.json
.
2) Add the block directory to ./common/blocks-library
. For example, ./common/blocks-library/block1
.
NOTE: You can also initialize a block with eWizard CLI. In this case, the initialized block directory contains all the required files.
3) Add index.vue
and icon.png
files to the block directory:
— index.vue
contains the block markup with email components.
— icon.png
is the block image that displays in eWizard Editor.
You can add media files to the block directory, for example, ./common/blocks-library/block1/media/my-image.png
.
4) Add the block to the ./common/blocks-library/blocks.json
file of your email project to use it in eWizard Editor.
For more information, see Make blocks visible in eWizard Editor.
5) Archive the email project with wiz archive
and upload the zipped project to eWizard to add the block to the email layout in Editor.
Add blocks from the eWizard.js repository
The email blocks in the eWizard.js repository are developed by Viseven, for example, header, footer, or signature. You can use these blocks in eWizard Editor after adding them to the email template.
As best practice, install blocks from the repository to the node_modules/@blocks
directory of your email project. The blocks contain basic markup, an icon, and a package.json
file with the information and dependencies.
NOTE: You can't use the blocks from the repository with local blocks.
To add blocks from the eWizard.js repository:
1) Provide the path to the blocks in the blocks
, blocksFilename
, and blocksManifest
fields of the ./.ewizard/settings.json
file:
// ./.ewizard/settings.json{ "path": { "blocks": "node_modules/@blocks", "blocksFilename": "blocks.json", "blocksManifest": "common/blocks-library/blocks.json", } }
— blocks
is the path to the directory where the blocks are stored. If you want to install a block from a repository, the recommended value is node_modules/@blocks
.
— blocksFilename
is the name of the file that defines which blocks appear in eWizard Editor. The default value is blocks.json
.
— blocksManifest
is the full path to the file that defines which blocks appear in eWizard Editor. The default value is common/blocks-library/blocks.json
.
2) Add the dependencies for the blocks in the package.json
file of your project. You can also install a specific version of a block. For example, the 1.1.0
version of the content-2a
block and the latest version of the content-2b
block.
// ./package.json{ "dependencies": { "@blocks/content-2a": "git+https://git.qapint.com/ewizardjs/email/blocks/content-2a.git#1.1.0", "@blocks/content-2b": "git+https://git.qapint.com/ewizardjs/email/blocks/content-2b.git" } }
3) Install the blocks to the node_modules/@blocks
directory:
wiz install
After the installation of the blocks, add them to the blocks.json
file of your project to use it in eWizard Editor. For more information, see Make blocks visible in eWizard Editor.
Add the module placeholder block
You can install the module placeholder block from the eWizard.js repository. Use the module placeholder block to add modules from Veeva Vault.
To install the module placeholder block:
1) Provide the path to the blocks in the blocks
, blocksFilename
, and blocksManifest
fields of the ./.ewizard/settings.json
file:
// ./.ewizard/settings.json{ "path": { "blocks": "node_modules/@blocks", "blocksFilename": "blocks.json", "blocksManifest": "common/blocks-library/blocks.json", } }
— blocks
is the path to the blocks storage directory. For the module placeholder block, the recommended value is node_modules/@blocks
.
— blocksFilename
is the name of the file that defines which blocks appear in eWizard Editor. The default value is blocks.json
.
— blocksManifest
is the full path to the file that defines which blocks appear in eWizard Editor. The default value is common/blocks-library/blocks.json
.
2) Add the dependencies for the module-placeholder
block and the wiz-block-v2
component to the ./package.json
file.
NOTE: wiz-block-v2
is the 2.0.0
version of the wiz-block
email component used specifically for the module-placeholder
block.
// ./package.json{ "dependencies": { "@blocks/module-placeholder": "git+https://git.qapint.com/ewizardjs/email/blocks/module-placeholder.git", "wiz-block-v2": "git+https://git.qapint.com/ewizardjs/email/components/wiz-block.git#v2.0.0" }, }
3) Install module-placeholder
and wiz-block-v2
in your email project.
wiz install
4) Register the wiz-block-v2
component globally in your email by adding it to the ./extensions/common.js
file.
// ./extensions/common.jsimport wizBlockV2 from 'wiz-block-v2';export default function (Vue) { Vue.component('wiz-block-v2', wizBlockV2); }
For more information, see Register the component globally in the project.
5) Add the module-placeholder
to the blocks.json
file to use it in eWizard Editor.
// ./common/blocks-library/blocks.json{ "id": "module-placeholder", "name": "Module Placeholder", "icon": "node_modules/@blocks/module-placeholder/icon.png" }
Make blocks visible in eWizard Editor
To use blocks in eWizard Editor, add them to the blocks.json
file of your project.
1) Set the path to the blocks.json
file in ./.ewizard/settings.json
using the blocksFilename
and blocksManifest
properties.
// ./.ewizard/settings.json{ "path": { "blocksFilename": "blocks.json", "blocksManifest": "common/blocks-library/blocks.json" } }
2) Add the blocks as objects within the components
array of blocks.json
. For example, block1
, block2
, and module-placeholder
blocks:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "block1", "name": "Block 1", "group": "group1", "filters": ["filter1", "filter2"], "brand": ["brand1", "brand2"], "countries": { "include": ["Canada", "Sweden"], "exclude": [""] }, "languages": ["eng", "fra"], "icon": "common/blocks-library/block/icon.png", "metadata": [], "clm": ["veeva"] }, { "id": "block2", "name": "Block 2", "group": "group2", "filters": ["filter1", "filter2"], "brand": ["brand1", "brand2"], "icon": "common/blocks-library/block/icon.png", "metadata": [], "clm": ["veeva"] }, { "id": "module-placeholder", "name": "Module Placeholder", "filters": ["filter1", "filter2"], "group": "group1", "brand": "brand1", "icon": "node_modules/@blocks/module-placeholder/icon.png", "metadata": [] } ] }
— id
is the block ID. The field is required for the block to be visible in eWizard Editor.
— name
is the name of the block displayed in eWizard Editor.
— group
is the group where the block belongs to. For more information, see Block groups.
NOTE: If you use filters in your project, use the groups
property instead.
— filters
is the filter that's applied to the block. For more information, see Block filters.
— icon
is the block image that appears in eWizard Editor.
— brand
is the brand the block belongs to. For more information, see Block brands.
— countries
is the object you can use to control what countries the block is displayed for. This object has two arrays: include
and exclude
. For more information, see Configure blocks for countries and languages.
— languages
is an array where you can add the languages you want to display the block for. The languages must be in the three-letter ISO 3 format. For more information, see Configure blocks for countries and languages.
— metadata
is an array that includes fields for displaying dynamic blocks for specific themes, CLMs, and email purposes. For more information, see Dynamic themes in emails.
— clm
is the target system for the block. For more information, see Configure blocks for CLM systems.
Block groups
You can add blocks to groups in blocks.json
, so they appear organized by groups in eWizard Editor.
TIP: When you use filters, add groups to the filters
array. You can't use both groups
and filters
arrays in blocks.json
. For more information, see Block filters.
If your email template supports dynamic themes, the order of the blocks in a group depends on their order in the blocks-themes.json
file. When your template doesn't have the blocks-themes.json
file, the block order is the same as in the blocks.json
file.
To add a block to a group:
1) Add groups to the groups
array. For example, group1
, group2
, and group3
.
// ./common/blocks-library/blocks.json{ "groups": [ { "id": "group1", "name": "Header" }, { "id": "group2", "name": "Body" }, { "id": "group3", "name": "Footer" } ] }
2) Specify which group the block belongs to in the group
field of the block. For example, block1
belongs to group1
:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "block1", "name": "Header with social icons", "group": "group1" } ] }
Block filters
You can filter and group blocks for eWizard Editor in the filters
array of the blocks.json
file.
For example, HEADER, BODY, and FOOTER groups in eWizard Editor:
To set up a block filter:
1) Open the common/blocks-library/blocks.json
file in your project root directory.
2) Enter the filter and group values in the filters
array. For example:
// ./common/blocks-library/blocks.json{ "filters": [ { "id": "filter1", "field": "filters", "name": "Header" }, { "id": "filter2", "field": "filters", "name": "Body" }, { "id": "filter3", "field": "filters", "name": "Footer" }, { "id": "group1", "field": "groups", "name": "Header" }, { "id": "group2", "field": "groups", "name": "Body" }, { "id": "group3", "field": "groups", "name": "Footer" } ] }
— id
is the filter or group ID.
— field
defines if the object is a filter or a group. Use filters
for filters and groups
for groups.
— name
is the name of the filter or group that appears in eWizard Editor.
3) Specify which filters apply to the block in the filters
property of each block. For example, filter1
and filter2
are applied to the header-1
block, and filter2
—to the body-1
block:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "header-1", "name": "Header", "filters": ["filter1", "filter2"], "group": "group1", "icon": "common/blocks-library/header-1/icon.png", }, { "id": "body-1", "name": "Body text", "filters": "filter2", "group": "group2", "icon": "common/blocks-library/body-1/icon.png", } ] }
Block brands
TIP: Block brands are deprecated, use Block filters instead.
You can filter blocks by brands in eWizard Editor.
NOTE: A template can contain either filters or brands.
To filter blocks by brands:
1) Add the brands
field to the blocks.json
file of your project. For example, CureAll
and BestRemedy
brands:
// ./common/blocks-library/blocks.json{ "brands": ["CureAll", "BestRemedy"], }
2) Add the brand
field to each block. For example, the block header-1
belongs to the CureAll
brand:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "header-1", "name": "Header", "brand": "CureAll", "group": "group1" } ] }
Generate icons for blocks
To generate icons for blocks in the email project manually, use the wiz screen block command and its options. For automatic generation of icons for blocks in emails, add the following configuration to the ./settings.json
file:
// ./settings.json{ "screenshoter": { "icons": { "blocks": { "enabled": true } } } }
When you upload the zipped project to eWizard and open it in eWizard Editor, the Blocks tab has icons for all the blocks even if there are no local icon files.
Upon changing the content in Editor, eWizard.js adds the common/icons/blocks/icon.jpg
icons for all the blocks. Download the source code and open the email project locally to view JPG files of the block icons.
You can change the default common/icons/blocks
path to the directory with the icons for blocks:
// ./.ewizard/settings.json{ "path": { "icons": { "blocks": "common/icons/blocks" } } }
Icon width
To change the block icon width for all the icons generated automatically in the common/icons/blocks
directory:
1) Add the following configuration to the ./settings.json
file:
// ./settings.json{ "screenshoter": { "icons": { "blocks": { "enabled": true, "width": "700px" } } } }
Set the block icon width in pixels, for example: 700px
.
2) Archive the project with the wiz archive
command.
3) Upload the zipped project to My library.
4) Open the email in Editor and change the content.
5) Download the source and open the project locally.
The width of all block icons in the ./common/icons/blocks
directory is now 700 pixels.
Icons for individual blocks
To skip automatic icon generation or to generate monochrome (black-and-white) icons for specific blocks, add the following configuration to the blocks.json
or blocks-themes.json
file:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "header-1a", "name": "Header with social icons", "screenshoter": { "skip": true } }, { "id": "header-1b", "name": "Header with text V1", "screenshoter": { "monochrome": true } } ] }
When you archive and upload the email project to eWizard, the skipped blocks either don't have icons on the Blocks tab in Editor or have the custom icons from the block directory. The blocks with the monochrome
setting have the black-and-white icons.
TIP: Use the skip
setting when you want to skip automatic icon generation for specific blocks. In this case, eWizard Editor uses the custom icon in the block directory.
Icons for view/edit mode
Certain blocks can have a different appearance in the eWizard PREVIEW/EDIT mode or in Viewer. To display the block icons as they appear in these modes, add the following configurations to the ./settings.json
file:
• To display block icons as they appear in the eWizard PREVIEW mode or in Viewer, add the view
mode:
// ./settings.json{ "screenshoter": { "icons": { "blocks": { "enabled": true, "mode": "view" } } } }
• To display block icons as they appear in the eWizard EDIT mode, add the edit
mode:
// ./settings.json{ "screenshoter": { "icons": { "blocks": { "enabled": true, "mode": "edit" } } } }
TIP: The view
mode is used by default.
• To apply the view
or edit
mode to specific block icons, add the respective mode configuration to the blocks.json
or blocks-themes.json
file:
// ./common/blocks-library/blocks.json{ "components": [ { "id": "header-1a", "name": "Header with social icons", "screenshoter": { "mode": "edit" } }, { "id": "header-1b", "name": "Header with text V1", "screenshoter": { "mode": "view" } } ] }