These are chat archives for GetmeUK/ContentTools

Aug 2016
Matthew J. Sahagian
Aug 29 2016 05:25
@anthonyjb I think my expectation was that during the save event, the regions would have been considered not to be still editable. When I click the checkmark, it triggers save, but then goes back to non-editable mode (I have to click the pencil again), so my expectation was is that on save the HTML would be in its final form. This is (as I said, true on "saved"), but I think it was just something of a failed expectation. Looking at the site again though, perhaps I just misread "saved" for "save" as it looks like the event handlers are using "saved."
Anthony Blackshaw
Aug 29 2016 07:07

Hi @mattsah it's possible to get the HTML for any region at any point safely using the region.html() method but the inner HTML for each region should be consider off limits (I guess) until the save method is complete (e.g at the point the saved is triggered - although only if the save is not passive).

In earlier versions we only had a save event that triggered where saved now triggers but this was very limiting and so event triggers were added at the start of the save process save and the end saved.

I can see how this might not feel intuitive because the saveevent is triggered before any action is taken, and perhaps pre-save, post-save or before-save, after-save event names would have been more intuitive (these variations were considered but felt clunky over all to me).

Having said all of this I never expected devs to read the innerHTML of regions to get the HTML to send back to their servers (partly because different browsers, at least at the time of starting to write CT, will potential return back different HTML). And therefore I don't think I've actually documented anywhere when it is and isn't safe to interact with the region HTML - so that's something I need to look at.