Manually re-applying missing changes lost during the merge in cc07c33.

Problematic merge:
https://github.com/bcipolli/ka-lite/commit/cc07c333cffc1a96d59c9df57c7521d6b32cf384

Discussion is here:
https://groups.google.com/a/learningequality.org/forum/#!topic/dev/9Zb77Kv978c

This PR is based on a manual patch file created by merging into 21e623b from 4e21d3b, resolving merge conflicts (discarding some changes, such as the json files, and the changes already re-added in 581c9b4), creating a patch file against 21e623b, and then applying it against the resolve_merge_patch branch, which was based on release-0.10.

This includes code from @pnpranavrao and @bcipolli, and possibly @rtibbles -- could you take a look and make sure the pieces you added that show up here still work as expected?