These are chat archives for GetmeUK/ContentTools

26th
Aug 2016
Matthew J. Sahagian
@mattsah
Aug 26 2016 16:03
@anthonyjb I noticed on a save handler that not all classes appear to be removed on editable elements. The example of a save handler has it fetching the regions rather specifically and saving each region as it's own thing. Can I assume that call does some cleanup on a per region basis? In my case I have a "container" which has a number of regions, and I independently grab the inner HTML on the container (which includes multiple regions), therefore avoiding that method entirely. It is cleaned up on the post-save (I think just called "saved") event.
Anthony Blackshaw
@anthonyjb
Aug 26 2016 22:01
@mattsah So the save method of the EditorApp replaces the innerHTML of each region DOM element with the HTML output of the editable region (e.g region.html()) - you can see this here: https://github.com/GetmeUK/ContentTools/blob/master/src/scripts/editor.coffee#L530. So basically it's not safe to get the innerHTML from an editable region's DOM element whilst it's still editable, I'd recommend you use the region.html() method to obtain the HTML, though you could simply select it in the saved event.