Images or galleries have a caption attribute where Wikitext can be used that will be rendered on the page. You can define new references in there or re-use references that where defined outside of the caption. VisualEditor should support both directions.
One part of this seems to be working already:
- I am an editor using visual editor.
- I open the image/gallery dialog to add a new or edit an exiting image/gallery.
- I add a reference to the caption.
- I close the dialog and want to re-use that reference in the article.
- The reference **shows up** in the re-use dialog and I can add it to the article
The other way does not though:
- I am an editor using visual editor.
- I directly add references to the article or there are already references that were directly added there.
- I open the image/gallery dialog to add a new or edit an existing image/gallery.
- I'm trying to re-use a reference that's defined in the article in the caption.
- The reference **does not show** up in the re-use dialog if it's defined on the article.
There seems to be a good way to fix the second part though, by pointing the re-use dialog to the root document of the article when used from of the image dialog.
See also:
* {T62919}
* ~~{T87134}~~ (unrelated)
== Acceptance criteria ==
As a visual editor,
I want to reuse existing citations in the image caption dialog
so that it's more like editing text anywhere else in the document.
**Scenario**: An existing citation can be reused in a new citation.
Given a document with two citations
when I add a new image
and edit its caption
then the citation "re-use" menu item is enabled;
when I click re-use
then I see a menu including the existing citations;
when I click on the second citation
then my caption shows a ref "[2]"
and the popped-up ref preview includes a warning about reused citations.