RFR: JDK-8277420: Provide a way to copy the hyperlink to a doc element to the clipboard [v2]
Pavel Rappo
prappo at openjdk.java.net
Thu May 26 20:11:35 UTC 2022
On Mon, 23 May 2022 19:09:41 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
>> This is a CSS/JavaScript only change to implement copy-to-clipboard functionality for all headers (`h1` - `h6`) that have an `id` attribute associated with them. The following element-attribute patterns are supported (using `<h2>` as an example):
>>
>> - `<section id="..."><h2>` (generated by javadoc)
>> - `<h2 id="...">` (commonly used)
>> - `<h2><a id="...">` (legacy)
>>
>> The change includes a consolidation of the CSS styles used to render copy-to-clipboard buttons, of which we have now three kinds: for snippets, for the link on the search page, and for headers. There is now a base CSS class called "copy" that defines the styles shared by all copy-to-clipboard buttons, and additional CSS properties for the concrete "subclasses".
>>
>> API docs generated with this change can be viewed here (top level files and java.base module):
>> http://cr.openjdk.java.net/~hannesw/8277420/api.03/
>
> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix jquery selector for anchor within header
Code:
* Your JavaScript code looks very readable to me, and I don't know JavaScript; nice.
* Don't forget to update the copyright years.
UI:
* Consider using a different icon for the button that copies a link. From what I've seen, icons depicting chain links are typical ( e.g. https://graphicdesign.stackexchange.com/questions/132106/what-is-the-most-intuitive-and-obvious-copy-link-icon )
* When the header button appears, the text on the page shifts a bit. Look closely and you'll see it. Don't know if it could be fixed easily, though.
Looks good.
-------------
Marked as reviewed by prappo (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8817
More information about the javadoc-dev
mailing list