RFR: JDK-8275406: Add copy-to-clipboard feature to snippet UI
Pavel Rappo
prappo at openjdk.java.net
Tue Oct 19 16:26:53 UTC 2021
On Tue, 19 Oct 2021 13:51:03 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> Please review a change to add a copy-to-clipboard feature to snippets. I took special care to make the feature usable on mobile devices. Sample output can be viewed and tested here:
>
> http://cr.openjdk.java.net/~hannesw/8275406/api.00/java.base/java/lang/Throwable.html#printStackTrace()
The UI functionality looks good. Update the copyright years in `Java.gmk`, `LinkChecker.java` and maybe other files.
test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java line 214:
> 212: <span class="element-name">case%s</span>()</div>
> 213: <div class="block">
> 214: <div class="snippet-container"><a href="#" class="snippet-copy" onclick="cop\
I'm sorry for hard-coding the snippet HTML output; I should've encapsulated it instead. Now every change to the HTML structure ripples through the tests. I'll work on improving that, I promise.
Separately. Aren't these "Copy" and "Copied!" strings localized? What happens if this test is run on some other locale?
test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java line 354:
> 352: void addReference(String name, Path from, int line) {
> 353: if (checked) {
> 354: if (name != null && !name.isEmpty()) {
I wonder if we should make this check more specific so as to allow only the snippet copy-to-clipboard link.
test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java line 371:
> 369: void check() {
> 370: map.forEach((name, id) -> {
> 371: if (name != null && !name.isEmpty() && !id.declared) {
Ditto.
-------------
Changes requested by prappo (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/6011
More information about the build-dev
mailing list