src/client/js/components/PageEditor/MarkdownDrawioUtil.js
/**
   * return markdown where the drawioData specified by line number params is replaced to the drawioData specified by drawioData param
   * @param {string} drawioData
   * @param {string} markdown
   * @param beginLineNumber
   * @param endLineNumber
   */
return markdown where the drawioData specified by line number params is replaced to the drawioData specified by drawioData param
@param {string} drawioData
@param {string} markdown
@param beginLineNumber
@param endLineNumber
return markdown where the drawioData specified by line number params is replaced to the drawioData specified by drawioData param @param { string } drawioData @param { string } markdown @param beginLineNumber @param endLineNumber
replaceDrawioInMarkdown(drawioData, markdown, beginLineNumber, endLineNumber) {
    const splitMarkdown = markdown.split(/\r\n|\r|\n/);
    const markdownBeforeDrawio = splitMarkdown.slice(0, beginLineNumber);
    const markdownAfterDrawio = splitMarkdown.slice(endLineNumber);
    let newMarkdown = '';
    if (markdownBeforeDrawio.length > 0) {
      newMarkdown += `${markdownBeforeDrawio.join('\n')}\n`;
      newMarkdown += '::: drawio\n';
    }
    newMarkdown += drawioData;
    if (markdownAfterDrawio.length > 0) {
      newMarkdown += '\n:::';
      newMarkdown += `\n${markdownAfterDrawio.join('\n')}`;
    }
    return newMarkdown;
  }
replaceDrawioInMarkdown ( drawioData , markdown , beginLineNumber , endLineNumber ) { const splitMarkdown = markdown . split ( / \r\n|\r|\n / ) ; const markdownBeforeDrawio = splitMarkdown . slice ( 0 , beginLineNumber ) ; const markdownAfterDrawio = splitMarkdown . slice ( endLineNumber ) ; let newMarkdown = '' ; if ( markdownBeforeDrawio . length > 0 ) { newMarkdown += ` ${ markdownBeforeDrawio . join ( '\n' ) } \n ` ; newMarkdown += '::: drawio\n' ; } newMarkdown += drawioData ; if ( markdownAfterDrawio . length > 0 ) { newMarkdown += '\n:::' ; newMarkdown += ` \n ${ markdownAfterDrawio . join ( '\n' ) } ` ; } return newMarkdown ; }
return markdown where the drawioData specified by line number params is replaced to the drawioData specified by drawioData param
 @param {string} drawioData
 @param {string} markdown
 @param beginLineNumber
 @param endLineNumber
return markdown where the drawioData specified by line number params is replaced to the drawioData specified by drawioData param @param { string } drawioData @param { string } markdown @param beginLineNumber @param endLineNumber