Detecting 'Design Mode' in a template/block/etc
Permalink
I know how to tell when a page is in edit mode, that's easy but how do you know when a page is in 'Design Mode' e.g. someone is just editing an attribute or something?
There's some JS I need to disable in this mode as well as in edit mode.
There's some JS I need to disable in this mode as well as in edit mode.
It would be preferable but not my design, not my script (is a well-known BS datepicker though).
Would also be good practice for C5 to signal Design Mode, though, too.
Would also be good practice for C5 to signal Design Mode, though, too.
Experiment with something like:
You'll want to check that c5panel exists, and then inspect the panelTransform string (or at least I assume it's a string). You'd be wise to check this out on different browsers since I've seen some inconsistencies in the way they report some styles, also check out different screen widths, edit mode, not logged in, etc.
There are probably other and better ways, but try your luck with this.
var c5panel = document.getElementById("ccm-panel-page"); var panelTransform = c5panel.style.transform;
You'll want to check that c5panel exists, and then inspect the panelTransform string (or at least I assume it's a string). You'd be wise to check this out on different browsers since I've seen some inconsistencies in the way they report some styles, also check out different screen widths, edit mode, not logged in, etc.
There are probably other and better ways, but try your luck with this.
Cheers for that will see if I can detect it before loading the dodgy JS script(s)
Feels a bit kludgy; it would be preferable for your JS not to interfere.