Context
When users edit references from the references list there's a little hack applied to change the selected fragment so that the dialogs involved in editing can still work with the logic that uses the selectedNode as basis for what needs to be edited. In other cases this divergence between, what's actually selected and what should be edited can lead to issues we see in T367910: The entire reference list is deleted when attempting to replace citation with a reused reference.
Solution
MWReferenceDialog and MWCitationDialog mostly rely in the currently selected node to figure out what's currently edited and what needs to be updated, replaced or changed. To untangle the hack applied for the references list and avoid issues with replacing citations it would be helpful if the dialogs could be called with a target reference that's independent of what's currently selected.
Implementation
- Add an option that can be passed to these dialogs that links to a reference for editing
- Make it possible to work with these dialogs on references that got passed into the dialog's getSetupProcess