RichText/Archived/Rooster/Rooster.gcomp/Support/node_modules/roosterjs/dist/rooster-amd.js
/**
 * Convert plain to HTML
 * @param text The plain text to convert
 * @returns HTML string to present the input text
 */
Convert plain to HTML
@param text The plain text to convert
@returns HTML string to present the input text
Convert plain to HTML @param text The plain text to convert @returns HTML string to present the input text
function textToHtml(text) {
    text = (text || '')
        .replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/'/g, '&#39;')
        .replace(/"/g, '&quot;')
        .replace(/^ /gm, '&nbsp;')
        .replace(/\r/g, '');
    var lines = text.split('\n');
    if (lines.length == 2) {
        text = "<span>" + lines[0] + "<br></span><span>" + lines[1] + "</span>";
    }
    else if (lines.length > 2) {
        text = '';
        var lineEnd_1 = roosterjs_editor_dom_1.Browser.isIEOrEdge ? ZERO_WIDTH_SPACE : '<br>';
        lines.forEach(function (line, i) {
            if (i == 0) {
                text += "<span>" + line + "<br></span>";
            }
            else if (i == lines.length - 1) {
                text += "<span>" + line + "</span>";
            }
            else {
                text += "<div>" + line + lineEnd_1 + "</div>";
            }
        });
    }
    text = text.replace(/ {2}/g, ' &nbsp;');
    return text;
}
function textToHtml ( text ) { text = ( text || '' ) . replace ( / & / g , '&amp;' ) . replace ( / < / g , '&lt;' ) . replace ( / > / g , '&gt;' ) . replace ( / ' / g , '&#39;' ) . replace ( / " / g , '&quot;' ) . replace ( / ^  / gm , '&nbsp;' ) . replace ( / \r / g , '' ) ; var lines = text . split ( '\n' ) ; if ( lines . length == 2 ) { text = "<span>" + lines [ 0 ] + "<br></span><span>" + lines [ 1 ] + "</span>" ; } else if ( lines . length > 2 ) { text = '' ; var lineEnd_1 = roosterjs_editor_dom_1 . Browser . isIEOrEdge ? ZERO_WIDTH_SPACE : '<br>' ; lines . forEach ( function ( line , i ) { if ( i == 0 ) { text += "<span>" + line + "<br></span>" ; } else if ( i == lines . length - 1 ) { text += "<span>" + line + "</span>" ; } else { text += "<div>" + line + lineEnd_1 + "</div>" ; } } ) ; } text = text . replace ( /  {2} / g , ' &nbsp;' ) ; return text ; }
Convert plain to HTML
 @param text The plain text to convert
 @returns HTML string to present the input text
Convert plain to HTML @param text The plain text to convert @returns HTML string to present the input text