Page MenuHomePhabricator

Wrap TransclusionModel and modify the emitted events to include insertion point
Closed, DeclinedPublic0 Estimated Story Points

Description

This change makes TransclusionModel the single source of truth about parameter ordering.

  • Consider whether replace should be split into remove and add events. If we do this, what happens when replacePart(placeholder, newParam)?
  • When adding a new parameter or template, TransclusionModel is reponsible for determining where it should appear. Note that the sidebar may include potential but unused parameters, and the content pane does not. Somehow send an index or pseudo linked-list IDs which enable both panes to add UI elements in the correct place.
  • Adapt listeners to respect this insertion point.

The content pane should be straightforward, TransclusionModel already has logic to calculate the correct location for parameters. We're just changing how the index gets wired through to the UI.

The sidebar has two cases:

  • Known parameters are created using an order given by the template spec, so we can ignore an insertion point included in the event as redundant.
  • Unknown parameters will always go at the end, I believe. So maybe the sidebar can always ignore the insertion point.