Hide Forgot
Created attachment 834174 [details] Example of copy to clipboard button in GitHub Description of problem: On pages where details are displayed about individual images stored in PressGang there are currently DocBook image templates for image, bare images and inline image. I use these templates regularly when adding images to topics. Instead of having to click in the template box and press Ctrl+A to select the template xml and then Ctrl+X to copy, it would be useful if there was a copy to clipboard button. An example of such a button is on GitHub for copying repo URLs [1]. Image attached. [1] https://github.com/jbosstools/jbosstools-documentation
Copying to the clipboard is notoriously tricky (if not impossible) with plan Javascript. Most solutions rely on a Flash solution like http://zeroclipboard.org/. I've been reluctant to introduce a dependency on Flash. Maybe we just do it though. We could also define some snippets for image XML generation.
Fixed in 201401151315 and deployed to the dev server. We've addressed this in two ways. First is the addition of the snippets figure, mediaobject and inlinemediaobject. Typing any one of those words and pressing tab will expand the image templates, and you can then tab through the replacable fields (like the image id). Second, when a new image is loaded or a new image template is selected in the tab view, the template text is automatically selected so end users only need to press CTRL-C to copy it to the clipboard. See the attached screenshot for an example.
Created attachment 850328 [details] Quick copy image templates
Verified that the three snippets mentioned work and are the correct XML. Also the image view now highlights and focuses the selected template so that CTRL+C can be used (it's worth noting CTRL+X won't work, but given it's a readonly box I don't see that as an issue).
Additional Note: Just adding since it's not abundantly clear, but the "copy to clipboard" functionality used by GitHub is using flash.