RaspberryPiFoundation / editor-ui

Code Editor web component
https://editor-static.raspberrypi.org
Apache License 2.0
37 stars 8 forks source link

Add `load-remix-enabled` attribute to web component #992

Closed floehopper closed 2 months ago

floehopper commented 2 months ago

This work came out of this issue.

These changes mean that it is now possible to configure the web component not to load a logged-in user's remixed version of the project by setting load_remix_disabled to true.

We want to use this in editor-standalone with the web component editor so that we reproduce the behaviour currently in editor-ui with the integrated editor.

When the new attribute is set to true, the loadRemix property passed to useProject in WebComponentLoader is forced to be false so that the remixed version of the project will not be loaded.

The name of the new attribute isn't ideal - I would rather have used load_remix_enabled - however, boolean attributes of the web component default to false and I want the default behaviour to remain unchanged to avoid breaking the projects-ui app.

I've opened this draft PR on editor-standalone to illustrate the changes I plan to make. I'm hoping to add some end-to-end/integration tests in that repo to verify the new behaviour.

Screencast showing the fix in action in my local version of editor-standalone with the new load_remix_disabled attribute of the editor web component set to true in the Project & MobileProject components.

https://github.com/RaspberryPiFoundation/editor-ui/assets/3169/3f94dc06-f828-49f0-95f4-40848ec234bc

github-actions[bot] commented 2 months ago
github-actions[bot] commented 2 months ago
github-actions[bot] commented 2 months ago
github-actions[bot] commented 2 months ago
github-actions[bot] commented 2 months ago