CodeMirror does not display first in a modal

1

I am creating a standard template for reading XML and to make life easier for system users, I am displaying a sample default template in a modal with the codemirror, however, it does not display at first, the code is only displayed when I click the codemirror area.

jscodemirrormethod

//codemirrorvareditor_two=CodeMirror.fromTextArea(document.getElementById("code2"), {
        lineNumbers: true,
        matchBrackets: true,
        styleActiveLine: true,
        mode: "xml",
        htmlMode: true,
    });
    //fim 

Modal method

   //exibe modal de xml padrao
    $(".btnPadraoXml").on("click", function () {
       //exibe modal
       $("#myModalVisualizaModeloXMl").modal();             
        //tentativas sem sucesso
        editor_two.focus();
        //editor_two.on('shown');    

    })
    
asked by anonymous 26.01.2016 / 14:02

1 answer

0

Follow the code below:

    //exibe modal de xml padrao
    $(".btnPadraoXml").on("click", function () {   
        $("#myModalVisualizaModeloXMl").modal();             
        //resolvido
        setTimeout(function() {            
            editor_two.refresh()
        }, 2000);
    })
    
27.01.2016 / 19:31