https://bugs.documentfoundation.org/show_bug.cgi?id=115255

Buovjaga <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Buovjaga <[email protected]> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to