I’ve just been looking into this myself as we’re building our own frontend and might not necessarily want the lightbox stuff.
FYI it gets added in CookedPostProcessor#add_lightbox!
. You’ll need to modify the code through a plugin to stop this method being called.
The whole process starts with PostJobsEnqueuer
which is called from the PostCreator
(so whenever a post is created).