Editr.js icon indicating copy to clipboard operation
Editr.js copied to clipboard

onchange for html, css and js

Open SteveX opened this issue 10 years ago • 1 comments

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!

SteveX avatar Jan 08 '15 22:01 SteveX

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();

SteveX avatar Jan 10 '15 17:01 SteveX