-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
Description
2. Split identifiers into asset and code identifiers
Assets are loaded by:
- asset identifier
Code is loaded by:
- code identifier, OR
codeprop, ELSE- blank
This has been done by:
- Update
editor-uito allow two identifiers:asset-identifierandcode-identifier - Update
editor-apito add endpoint for assets only (easy, as above) - Update
editor-apito add endpoint for code only (easy)
Draft spike
This has been drafted out in the associated branch which splits out the asset loading from the project loading.
Using Redux devtools we can see the assets from the specified project are available to the user.
For HTML projects, as we can't provide the project type via props, this can be achieved loading a blank HTML project which will in turn set the project type.
You can preview this using these project identifiers:
<editor-wc
code_identifier="top-5-emoji-list-step-5"
class="c-editor__wc"
asset_identifier="anime-expressions"
output_only
data-editor-target="editor"
>
Pros
- A comprehensive, robust, reliable option as it allows specific loading of different assets and code, without having to overwrite code. This should prevent mistakes or unstable situations.
- API work required is simple, just splitting the response into two endpoints, one for the assets and the other for the code
- Backwards compatible, the new assets and code props will supplement the existing
identifierprop
Considerations
- There will be an increase in API calls, as a project with separate identifiers will now be making two calls.
- This is mitigated by preserving existing
identifierprop and routes which will load both assets and code when they're the same, with the new props only being used when the code and assets are different.
Originally posted by @conorriches in #868 (comment)
Notes
- this is work for the block-to-text alpha so only needs to be merged into the https://github.com/RaspberryPiFoundation/editor-ui/tree/output-only-wc feature branch
- any additional api endpoints should be fine going into production but sanity check first
- enables assets and code to be split and managed in the backend 🥳
- current assumption is we'll hardcode the code template in app and pass populated code back as
code
Reactions are currently unavailable