appsembler / xblock-prismjs

An XBlock for adding code highlighting via the PrismJS library.
MIT License
0 stars 1 forks source link

Fixes and extensions #26

Closed grozdanowski closed 3 years ago

grozdanowski commented 3 years ago

Change description

Description here

Type of change

  • [x] Bug fix (fixes an issue)
  • [x] New feature (adds functionality)

Fixes

We had an issue where core OpenEdX JS would throw an error in LMS upon rendering a unit that includes the XBlock. The issue was that it was attempting to initialise a function that didn't exist. Because of this the overall JS would stop working properly, therefore making unit navigation malfunction.

Another issue was that if you navigate to another unit, then go back to the unit with this XBlock, the styling of the XBlock would disappear. The problem was that the rendered content wasn't tokenised. This is resolved by introducing a new function that triggers the Prism API to retokenise, then initialising that function on XBlock render.

New Feature

Previously the XBlock could only do one theme per unit, regardless of how many you choose and how they work. This is now fixed by prefixing theme CSS rules, whilst adding a theme-related class to the wrapper.

Screenshot 2021-09-09 at 14 01 35