Last modified: 2014-08-19 17:55:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66935, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64935 - VisualEditor: Support magic pasting of HTML that contains a transclusion of or link to a wiki image
VisualEditor: Support magic pasting of HTML that contains a transclusion of o...
Status: ASSIGNED
Product: VisualEditor
Classification: Unclassified
ContentEditable (Other open bugs)
unspecified
All All
: High enhancement
: ---
Assigned To: Editing team bugs – take if you're interested!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-06 00:51 UTC by James Forrester
Modified: 2014-08-19 17:55 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description James Forrester 2014-05-06 00:51:40 UTC
Right now if you have some rich content with an image and paste it into VisualEditor, we discard the image.

However, it'd be nice to add some special handling in VisualEditor's paste for the HTML of images so that those from Commons used on a MediaWiki instance get sought out and inserted instead.

Perhaps via a special custom attribute VE would sniff for, that would make VE try to find the image from Commons (if the wiki was configured for InstantCommons), or other fileRepos?

MediaViewer's "embed" HTML looks like:

| <p><a href="http://commons.wikimedia.org/wiki/File:Beach_sand.jpg#mediaviewer/File:Beach_sand.jpg"><img src="http://upload.wikimedia.org/wikipedia/commons/c/c5/Beach_sand.jpg" alt="Beach sand.jpg" height="1200" width="1600"></a>[…]</p>

If we asked them to add an attribute, e.g. (simplified):

| <p><a href="…"><img src="…" alt="…" ve-data="ve-pastableImage" ></a>[…]</p>

… could we do this?

(Also, yes, they should be using <figure> instead of <p><img></p>.)
Comment 1 Tisza Gergő 2014-05-06 01:07:41 UTC
Granted, MediaViewer's HTML format is total crap, but there isn't a clean, semantic way to mark up image captions that works in HTML4. Maybe browsers these days understand HTML5 tags no matter the doctype, and using figure is fine - we should look into that.

At any rate, whether it is in a figure tag figure or something else, users would probably expect the caption to end up inside the image wikicode, not as a HTML wrapper. So I suppose the caption would need special attributes as well?
Comment 2 James Forrester 2014-05-06 01:18:35 UTC
(In reply to Tisza Gergő from comment #1)
> At any rate, whether it is in a figure tag figure or something else, users
> would probably expect the caption to end up inside the image wikicode, not
> as a HTML wrapper. So I suppose the caption would need special attributes as
> well?

Sure, or we could fetch the caption from Commons in the context language automatically, so users don't have to be using the right language?
Comment 3 Tisza Gergő 2014-05-07 08:07:46 UTC
We tried to avoid using the description where a caption is available; the description is often less relevant and too verbose. Also, the caption might be in the right language - copy-pasting images does not necessarily happen across wikis. (I guess we could add a lang attribute, which is a sensible thing to do anyway, and then language mismatch could be detected on paste.)
Comment 4 James Forrester 2014-05-07 16:52:38 UTC
(In reply to Tisza Gergő from comment #3)
> We tried to avoid using the description where a caption is available; the
> description is often less relevant and too verbose. Also, the caption might
> be in the right language - copy-pasting images does not necessarily happen
> across wikis. (I guess we could add a lang attribute, which is a sensible
> thing to do anyway, and then language mismatch could be detected on paste.)

Yeah, if the <figcaption> had a lang attribute it'd be a lot easier for us, and we'd use that in preference if it were in the content language of the paste target.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links