This replaces the various copies of this logic with a single helper that we template for each editor type, similar to what we already do for the `switchToEditor` helper.
This replaces the various copies of this logic with a single helper that we template for each editor type, similar to what we already do for the `switchToEditor` helper.