How to use the mjml-button.defaultAttributes function in mjml-button

To help you get started, we’ve selected a few mjml-button 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-button.js View on Github external
'mj-column': ['mc-button'],
  'mj-hero': ['mc-button'],
  'mc-button': [],
});

export default class McButton extends MjButton {
  static endingTag = true

  static allowedAttributes = {
    ...MjButton.allowedAttributes,
    'mc:edit': 'string',
    'mc:hideable': 'string',
  }

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

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

    return false
  }

  // MODIFIED from https://github.com/mjmlio/mjml/blob/master/packages/mjml-button/src/index.js
  render() {
    const tag = this.getAttribute('href') ? 'a' : 'p'

    return `

mjml-button

mjml-button

MIT
Latest version published 9 months ago

Package Health Score

82 / 100
Full package analysis

Similar packages