How to use the mjml-section.allowedAttributes 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 homerjam / mjml-mailchimp / src / mc-section.js View on Github external
import { flow, identity, join, filter } from 'lodash/fp'

import MjSection from 'mjml-section'
import { registerDependencies } from 'mjml-validator'

registerDependencies({
  'mj-body': ['mc-section'],
  'mj-wrapper': ['mc-section'],
  'mc-section': ['mj-column', 'mj-group', 'mj-raw'],
});

const makeBackgroundString = flow(filter(identity), join(' '))
export default class McSection extends MjSection {
  static allowedAttributes = {
    ...MjSection.allowedAttributes,
    'mc:hideable': 'string',
    'mc:repeatable': 'string',
    'mc:variant': 'string',
    'mc:edit': 'string',
  }

  static defaultAttributes = {
    ...MjSection.defaultAttributes,
    'mc:hideable': false,
  }


  isHideable() {
    if (this.getAttribute('mc:hideable') !== false) {
      return true
    }

mjml-section

mjml-section

MIT
Latest version published 4 months ago

Package Health Score

89 / 100
Full package analysis

Similar packages