openedx / frontend-plugin-framework

An experimental framework for micro-frontend plugins.
GNU Affero General Public License v3.0
5 stars 11 forks source link

Extend customizability of Default Content #46

Open jsnwesson opened 6 months ago

jsnwesson commented 6 months ago

Context: The content that is wrapped by a PluginSlot is referred to as the defaultContents. In the current implementation, the defaultContents is rendered by default (and can be hidden by assigning keepDefault to false in the JS config) with the properties:

{
  id: 'default_contents',
  priority: 50,
  renderWidget: children // this is the actual children object inside Plugin Slot, whose contents are read-only
} 

Problem: This implementation works best when there's only one component as the default content, but lacks customizability in the case where multiples of the same component might need to be rendered as default content (ie. several links in a side bar) and there's a desire to insert plugins in between the default content (Insert) or to Modify/Wrap/Hide individual parts of the default contents.

Solution: Use something like Braden MacDonald's implementation in his UI Plugin Slot framework where a DefaultPluginSlot exists for instances when we don't need to modify the default content and convert the PluginSlot to handle instances where default contents are customizable.

arbrandes commented 5 months ago

@jsnwesson, were you able to make progress here in the meantime?