Last modified: 2014-08-19 17:55:07 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>.)
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?
(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?
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.)
(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.