VisualEditor requirement (T245299):
- As someone editing a sub-reference in VE, you should not be able to accidentally "orphan" sub-references by deleting their parent reference
User Story:
As an article editor editing in VE
I want to be able to delete a chunk of text in an article that includes a parent reference without breaking subreferences elsewhere in the text
So that I don’t “orphan” subreferences accidentally
Proposed implementation (tbc):
Move parent reference content into a list-defined reference when the usage is deleted. There’s a precedent: when deleting a reused reference which included the reference body, VE rescues the content out of the main reference and moves it into the first reference that reuses it, so it might be possible to apply a similar approach to subreferences.
Sub-tickets needed:
- What happens when I cut and paste a ref and temporarily break the connection?
- This already works!
- As of now the rendering of the children changes and they appear as if they are normal (parent) refs. A first step should be to make this rendering consistent and still render them as children, plus some placeholder for the parent.
- What about wikis where the MOS (manual of style) dictates to use a template like {{reflist}}?
- Does it make sense to hard-code knowledge about this template in VE? What if the template behaves different on other wikis, or changes in the future?
- An incremental step towards a sane solution could be this: The user can delete the parent. VE knows it needs to move it to somewhere else, but can't (yet) move it to the reflist template. Instead it moves the parent right next to the first child, resulting in double footnote markers like [1][1.1].
- An alternative is to auto-merge the parent into all children. This gets rid of all extends.
- In articles that already contain a plain <references /> at the end we can just move the ref down.