Page MenuHomePhabricator

Spike: Code experiment for live-preview of sub-refs in VE dialogs
Open, Needs TriagePublicSpike

Description

WMDE-Design is experimenting with designs for the citation dialog in VisualEditor that show a live-preview of the nested main + sub-ref. The devs are asked to check if the following is technically possible:

Add details with Live Preview.png (445×506 px, 32 KB)

Add details with Live Preview-1.png (445×506 px, 27 KB)

Goal
  • Integrate the preview into the sub-ref add and edit dialogs.
  • Find a good mechanism to update the preview upon change by user.
  • Templates eg. Cite* are rendered.
  1. Dynamic update of content in preview (live update)
    • Upon inserting content in the free input field, the preview should be updated to display the details.
Out of scope:
  • Correct numbering, this is just about the content
  • Swap between the default - edit all - vs edit this one note.
  • Links do not need to be clickable.
  • When ref is edited through the template dialog.
Feasibility:
  • How to get access to the main ref content while editing a sub-ref?
  • How to get access to all existing sub-refs while editing the main ref?
  • How to get backlink markers that are unique to each.
  • Do we have access to the content field in the edit dialog so we can show it as part of the preview?
  • Does any of this require a server-side re-parse? (E.g. when the content contains a template?)
  • While the user is editing the input field in the edit dialog, is there some kind of change even we can hook into to update the preview every time the user makes changes?
  • Consider debouncing, throtteling, immediate update on every keystroke, manual...

Timebox

  • 2 engineers
  • 1 week

IF ALL FAILS, we stick to the current implementation:

image.png (704×2 px, 186 KB)

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptApr 16 2025, 11:52 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Lina_Farid_WMDE renamed this task from Spike: Code experiment for live-preview of sub-refs in VE dialogs to Spike: Code experiment for live-preview of sub-refs in VE dialogs - content display.Apr 17 2025, 1:10 PM
Lina_Farid_WMDE updated the task description. (Show Details)

This might come for free, the preview widget seems to be set up to asynchronously re-render after changes to its connected edit surface.

Change #1176641 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[VisualEditor/VisualEditor@master] Fix ve.ui.PreviewElement.afterRender throwing errors

https://gerrit.wikimedia.org/r/1176641

Change #1176641 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] Fix ve.ui.PreviewElement.afterRender throwing errors

https://gerrit.wikimedia.org/r/1176641

Change #1176433 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (2824d0c43)

https://gerrit.wikimedia.org/r/1176433

Change #1176433 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (2824d0c43)

https://gerrit.wikimedia.org/r/1176433

Lina_Farid_WMDE renamed this task from Spike: Code experiment for live-preview of sub-refs in VE dialogs - content display to Spike: Code experiment for live-preview of sub-refs in VE dialogs.Dec 3 2025, 1:40 PM
Lina_Farid_WMDE updated the task description. (Show Details)
Lina_Farid_WMDE updated the task description. (Show Details)