The Gadgets extension recently added support for gadgets to conditionally load based on page action ('view', 'edit', etc).[1] However, gadgets configured to load on action=edit don't currently load when VE or 2017WE is used, because VE doesn't reload the full page and builds the editing interface entirely via AJAX, so the server-side onBeforePageDisplay hook through which Gadgets adds the modules is never invoked.
Solution:
- VE could query the API for enabled gadgets that use actions=edit, and load them using mw.loader.
[1]: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Gadgets/+/747112, T204201