How to use the mjml-section.defaultMJMLDefinition function in mjml-section

To help you get started, we’ve selected a few mjml-section examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjmlio / mjml / packages / mjml-wrapper / src / index.js View on Github external
import { helpers } from 'mjml-core'
import merge from 'lodash/merge'
import Section from 'mjml-section'

const tagName = 'mj-wrapper'
const parentTag = ['mj-container']
const defaultMJMLDefinition = merge({}, Section.defaultMJMLDefinition, {
  inheritedAttributes: [
    'width'
  ]
})
const postRender = ($) => {
  $('.mj-wrapper-outlook-open').each(function () {
    $(this).replaceWith(`${helpers.startConditionalTag}
      <table cellspacing="0" cellpadding="0" border="0" role="presentation"><tbody><tr><td style="width:${parseInt($(this).data('width'))}px;">
      ${helpers.endConditionalTag}`)
  })

  $('.mj-wrapper-outlook-line').each(function () {
    const width = parseInt($(this).data('width'))

    $(this).replaceWith(`${helpers.startConditionalTag}
      </td></tr><tr><td style="width:${width}px;"></td></tr></tbody></table>

mjml-section

mjml-section

MIT
Latest version published 4 months ago

Package Health Score

89 / 100
Full package analysis

Similar packages