How to use the mermaid/package.json.version function in mermaid

To help you get started, we’ve selected a few mermaid 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 mermaidjs / mermaid-live-editor / src / components / Edit.js View on Github external
import React from 'react'
import { Row, Col, Input, Icon, Tag, Affix, Card, Divider } from 'antd'
import { Route } from 'react-router-dom'
import { Base64 } from 'js-base64'
import mermaid from 'mermaid'

import Error from './Error'
import Preview from './Preview'
import pkg from 'mermaid/package.json'
import { base64ToState } from '../utils'

const mermaidVersion = pkg.version

class Edit extends React.Component {
  constructor (props) {
    super(props)
    this.onCodeChange = this.onCodeChange.bind(this)
    this.onMermaidConfigChange = this.onMermaidConfigChange.bind(this)

    const {
      match: {
        params: { base64 }
      },
      location: { search }
    } = this.props
    this.json = base64ToState(base64, search)
    mermaid.initialize(this.json.mermaid)
  }