Editr.js
Editr.js copied to clipboard
onchange for html, css and js
Nice repo, thank you for your work! I have Editr working well in my cms, it displays live editable code perfectly.
If possible, I'd like to use the same display to save code examples to the db.
But I haven't found how to run a js function on change for any of the windows (html, css, js) in order to reflect that change in a hidden input field. If you know of a way to access those changes I'd love to know how!
Thanks man!
I have figured this out. This code is working well for me when saving:
var idHtml = $(".editr__editor--html").attr("id");
var html = ace.edit(idHtml).getSession().getValue();
var idCss = $(".editr__editor--css").attr("id");
var css = ace.edit(idCss).getSession().getValue();
var idJs = $(".editr__editor--js").attr("id");
var js = ace.edit(idJs).getSession().getValue();