Page MenuHomePhabricator

Add preview for file text field
Open, Needs TriagePublic

Description

Add a mechanism to preview the file text field in VideoCutTool similar to how DiscussionTools does it

Event Timeline

Hey, @Soda @Gopavasanth is there any specific wikimedia API to parse the wikiText . I spent good amount of time searching it but found no luck. Can you guide me here a little

Use the Wikimedia Parsing text API (https://mediawiki.org/wiki/API:Parsing_wikitext) or the Parsoid Rest API

hey @Aadhi13 have checked and reviewed the MR. Please check

hey @Aadhi13 are you still working on this ticket? if not please remove yourself from the assignee, so that its open for other folks to work on

Thanks

hey @Reputation22, I'm still working on this ticket. I'll try to close it as soon as possible. if I can't, I'll remove myself from the assignee.

Hi! I'm Usama Walayat, a GSoC 2026 applicant for the Wikifile-Transfer project. I'd like to claim this task. Here's my deep analysis and proposed solution:
Problem:
When a user is about to upload an edited video back to Wikimedia Commons, VideoCutTool shows a raw wikitext field (the file description page text). This raw wikitext — full of {{Information}} templates, [[Category:...]] links, and licence templates — is unreadable to most users. They cannot visually verify what the final Commons file page will look like before uploading.
Root Cause:
The frontend (React) currently renders the wikitext upload field as a plain <textarea> with no preview capability. There is no call to MediaWiki's action=parse API to render the wikitext into HTML before upload.
My Proposed Solution:

Add a "Preview" toggle button next to the wikitext textarea in the React upload form
When toggled, make an API call to commons.wikimedia.org/w/api.php?action=parse&text={wikitext}&prop=text to get the rendered HTML
Display the rendered HTML in a styled preview panel below the textarea (similar to how Wikipedia's own edit preview works)
Add a loading spinner while the API call is in progress
Allow toggling back to the raw wikitext edit view
Write a Jest test verifying the preview toggle renders the API response correctly and handles errors gracefully

I have React, JavaScript, and MediaWiki API experience. May I claim this task?

Pppery added a subscriber: Aadhi13.