Description: With the help now displayed in browser, some lines of help contents should be put in the clipboard with a simple click. Steps to Reproduce: (Enhancement) Actual Results: Nothing Expected Results: On hovering the mouse around the spanned text, display a button to copy the text to the clipboard. Then user can paste the copied text in a document and work on it. For example, a Calc function such as COS, the example in the help page can be copied and pasted in a spreadsheet. same for BASIC code. Reproducible: Always User Profile Reset: No Additional Info: The example text is inside a <item type="input"></item> e.g. <item type="input">=COS(0)</item> returns 1. The transformation (online_transform.xsl) can generate a <span> or <div> tag with an ID and a piece of javascript can display a button on hovering to copy "=COS(0)" to clipboard. User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
The simplest solution would be to do it without a button. We could have a CSS tooltip say "Click on the text to copy it to your clipboard". We could also include a text at the beginning of such articles "the texts looking like this can be copied to the clipboard by clicking on them". JS to target a class (not an ID because we want to be able to have multiple copyable elements in a single article): > var copyable = document.getElementsByClassName("copyable"); > > for (var i = 0, len = copyable.length; i < len; i++) { > (function() { > var item = copyable[i]; > > item.onclick = function() { > document.execCommand("copy"); > } > > item.addEventListener("copy", function(event) { > event.preventDefault(); > if (event.clipboardData) { > event.clipboardData.setData("text/plain", item.textContent); > } > }); > }()); > } Not tested, but should work. Let me know what you think and we can develop it further.
Ilmari Lauhakangas committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/help/commit/?id=b6bc8c1cfecc55bebff8dc64fddb63e3edc109b5 tdf#115255 and auto-expand contents per subitem