Page MenuHomePhabricator

When dialog to insert an image is invoked on a selection, prefill the fields accordingly
Closed, ResolvedPublic

Description

When you invoke the dialog to insert a link after you selected a link in the wikitext, the fields in the dialog are filled accordingly. The same would be nice for the image dialog, too. This is not possible (or at least quite difficult) for some cases, since there are much more possible keywords and localizations, but in those cases where only known keywords are used, this should be possible.

An example use case: A user adds an image using the dialog, previews the page and decides to move the image to the left side. Then he should be able to select the code for the image, invoke the dialog again and just change the position.


Version: unspecified
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:11 AM
bzimport added a project: WikiEditor.
bzimport set Reference to bz38829.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 11138
JavaScript snippet

The attached file contains a function that takes a string as argument and returns either false if it wasn't able to parse it, or an object with the following members:

pre - whitespace before the image
post - whitespace after
fileName - normalized name of the file (without namespace)
caption - caption (if present)
fileSize - size without px (if present)
fileFloat - English keyword for the float parameter (if present)
fileFormat - English keyword for the format parameter (if present)

Whoever is going to fix this bug "only" has to integrate this function into the code, i.e. call it when the dialog is opened with the selected text and set the <input>s and <select>s to the returned values.

Attached:

Please fulfill this bug!!! I ever wondering why this not happen. It is annoying because the popup don't let you back to the Textbox and normally you can't c&p two texts same time. That is a minimum standard in every normal text editor.

(The same for T56961)

I'll take a crack at this. This should be relatively straightforward.

Change 176927 had a related patch set uploaded (by Happy5214):
Pre-fill fields in image dialog when image code is selected in editor

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

Patch-For-Review

Jdforrester-WMF lowered the priority of this task from Medium to Low.Dec 2 2014, 9:11 PM
Jdforrester-WMF moved this task from Backlog to Doing on the WikiEditor board.

Please review the patch.

Change 176927 had a related patch set uploaded (by Happy5214; owner: Happy5214):
[mediawiki/extensions/WikiEditor@master] Pre-fill fields in image dialog when image code is selected in editor

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

Change 176927 merged by jenkins-bot:
[mediawiki/extensions/WikiEditor@master] Pre-fill fields in image dialog when image code is selected in editor

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