[FITB] Add the new Fill in the Blank widget's schema and logic to perseus-core - #4181
[FITB] Add the new Fill in the Blank widget's schema and logic to perseus-core#4181ivyolamit wants to merge 2 commits into
Conversation
…n the Blank widget's schema and logic to perseus-core
npm SnapshotWant to try this PR's changes before it merges? Comment |
|
Size Change: +512 B (+0.1%) Total Size: 514 kB 📦 View Changed
ℹ️ View Unchanged
|
…dget's schema and logic to perseus-core
4f61dc2 to
6ff82e0
Compare
SonicScrewdriver
left a comment
There was a problem hiding this comment.
Sweet, great work! Tentatively approved but I recommend double checking the schema approach / split perseus changes with Jeremy or Ben, just in case they have any deeper insights.
| // Tests are fine to import, main files aren't | ||
| // eslint-disable-next-line import/no-restricted-paths | ||
| import {generateVideoWidget} from "../../utils/generators/video-widget-generator"; | ||
| // Tests are fine to import, main files aren't |
There was a problem hiding this comment.
Non-blocking Nit: I wonder if we should have a block comment above this section rather than duplicating this same line for every override. Perhaps something clearer like "Tests can override the restricted imports, while main files cannot."
| * from its own getPublicWidgetOptions. | ||
| */ | ||
| export function splitWidgetsMap(widgets: PerseusWidgetsMap): PerseusWidgetsMap { | ||
| const upgradedWidgets = applyDefaultsToWidgets(deepClone(widgets ?? {})); |
There was a problem hiding this comment.
This PR generally looks great to me, but I'm curious about @jeremywiebe / @benchristel 's thoughts regarding our approach/updates here. It seems fine, but it would be good to check in before we start locking in our schema.
| label: string; | ||
| /** Display height in px for an image tile. The editor offers 24, 36, | ||
| * 48, 60, 72, 84 and 96 */ | ||
| imageHeight?: number; |
There was a problem hiding this comment.
One opportunity here is to have this be a direct enum, but tbh I could also see that biting us later if we get feedback that requests new image sizes. number is probably fine.
Summary:
This PR is the base code for Fill in the Blank widget and this adds the schema and logic to perseus-core.
Issue: LEMS-4321
Test plan: