Context
This is meant as an umbrella ticket to manage WMDE-TechWish 's refactoring work in Cite and VE, to use InternalList items rather than "synthetic list-defined main refs" for Sub-referencing (product board) features. The items added here are the result of discussions on how we can better handle the data that's relevant for creating, reusing, deleting and converting MWReferenceNodes in the #Cites VE integration.
We identified the need to store references more independently of the MWReferenceNodes. The reference nodes are very close to <ref> tags in wikitext and will only appear once in the document when a ref or a main+details occurs, or once in the references list. This has become a problem when communicating between Parsoid and VE, and when deleting references that have a sub- and main-ref dependency. Making more use of the InternalItemNode and InternalList for that would help a lot in these use cases.
See T411856: [Epic] Avoid unintended content loss due the usage of synthetic ldr's
Goals
- Eliminate the "synthetic list-defined main ref" in VE T406869: [Epic] VisualEditor must stop relying on synthetic LDRs to access main content
- Eliminate the "synthetic list-defined main ref" in the wire format between Parsoid and VE.
- Fully support main ref deletion when sub-references remain.
Acceptance criteria
- Make sure content of deleted (main) nodes can still be found using the InternalNodeItems
- Use the content from the InternalNodeItems to render the content of main nodes (deleted or not) when looking them up from subref nodes
- Use the content from the InternalNodeItems when serializing main+details nodes to Parsoid DOM if the (original) main node was deleted at some point
- Make sure that it's still possible to edit the main content from the context items
- Preview of the sub-reference still includes main ref content.
- References list still shows main ref, deleted or not.
Refactoring
- Implement a sustainable way how InternalItemNodes can be accessed even if there's no distinct "main" MWReferenceNode