El editor de codemirror no carga contenido hasta que hace clic
Fecha Publicación:
06 de Enero de 2020
Fecha Modificación:
06 de Enero de 2020
Solo hay que agregar autorefresh.js
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/mode/javascript/javascript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/mode/css/css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/mode/xml/xml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/addon/selection/active-line.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/addon/edit/matchbrackets.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/addon/display/autorefresh.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/codemirror.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.28.0/theme/abcdef.css"/>
Y en el script: autoRefresh:true,
<script type="text/javascript">
$(document).ready(function(){
var code = $(".codemirror-html")[0];
var editor = CodeMirror.fromTextArea(code, {
lineNumbers : true,
tabSize:3,
styleActiveLine: true,
theme:"udb-dark",
matchBrackets: true,
autoRefresh:true,
mode: "text/html"
});
});
</script>
Referencia
http://js.dokry.com/el-editor-de-codemirror-no-carga-contenido-hasta-que-hace-clic.html
Articulo : 712 - Veces Leidas