How to use the mjml-image.allowedAttributes function in mjml-image

To help you get started, we’ve selected a few mjml-image 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-image.js View on Github external
import MjImage from 'mjml-image'
import { registerDependencies } from 'mjml-validator'

registerDependencies({
  'mj-column': ['mc-image'],
  'mj-hero': ['mc-image'],
  'mc-image': [],
});

export default class McImage extends MjImage {
  static tagOmission = true

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

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

  // MODIFIED form https://github.com/mjmlio/mjml/blob/master/packages/mjml-image/src/index.js
  renderImage() {
    const height = this.getAttribute('height')

    const img = `

mjml-image

mjml-image

MIT
Latest version published 11 months ago

Package Health Score

85 / 100
Full package analysis

Similar packages