src/js/extensions/uml.js
function umlExtension(editor, options = {}) {
  const {
    rendererURL = DEFAULT_RENDERER_URL
  } = options;

  /**
   * render html from uml
   * @param {string} umlCode - plant uml code text
   * @returns {string} - rendered html
   */
  function plantUMLReplacer(umlCode) {
    let renderedHTML;

    try {
      if (!plantumlEncoder) {
        throw new Error('plantuml-encoder dependency required');
      }
      renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`;
    } catch (err) {
      renderedHTML = `Error occurred on encoding uml: ${err.message}`;
    }

    return renderedHTML;
  }

  const {codeBlockLanguages} = editor.options;
  UML_LANGUAGES.forEach(umlLanguage => {
    if (codeBlockLanguages.indexOf(umlLanguage) < 0) {
      codeBlockLanguages.push(umlLanguage);
    }
    codeBlockManager.setReplacer(umlLanguage, plantUMLReplacer);
  });
}
function umlExtension(editor, options = {}) {
  const {
    rendererURL = DEFAULT_RENDERER_URL
  } = options;

  /**
   * render html from uml
   * @param {string} umlCode - plant uml code text
   * @returns {string} - rendered html
   */
  function plantUMLReplacer(umlCode) {
    let renderedHTML;

    try {
      if (!plantumlEncoder) {
        throw new Error('plantuml-encoder dependency required');
      }
      renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`;
    } catch (err) {
      renderedHTML = `Error occurred on encoding uml: ${err.message}`;
    }

    return renderedHTML;
  }

  const {codeBlockLanguages} = editor.options;
  UML_LANGUAGES.forEach(umlLanguage => {
    if (codeBlockLanguages.indexOf(umlLanguage) < 0) {
      codeBlockLanguages.push(umlLanguage);
    }
    codeBlockManager.setReplacer(umlLanguage, plantUMLReplacer);
  });
}
function umlExtension ( editor , options = { } ) { const { rendererURL = DEFAULT_RENDERER_URL } = options ; /**
   * render html from uml
   * @param {string} umlCode - plant uml code text
   * @returns {string} - rendered html
   */ function plantUMLReplacer ( umlCode ) { let renderedHTML ; try { if ( ! plantumlEncoder ) { throw new Error ( 'plantuml-encoder dependency required' ) ; } renderedHTML = ` ${ rendererURL } ${ plantumlEncoder . encode ( umlCode ) } ` ; } catch ( err ) { renderedHTML = ` ${ err . message } ` ; } return renderedHTML ; } const { codeBlockLanguages } = editor . options ; UML_LANGUAGES . forEach ( umlLanguage => { if ( codeBlockLanguages . indexOf ( umlLanguage ) < 0 ) { codeBlockLanguages . push ( umlLanguage ) ; } codeBlockManager . setReplacer ( umlLanguage , plantUMLReplacer ) ; } ) ; }
plant uml plugin
@param {Editor} editor - editor
@param {object} [options={}] - plugin options
@param {string} options.rendererURL - plant uml renderer url
@ignore
plant uml plugin