From b3841396579fb731d596ea30712c3ce6a18844ec Mon Sep 17 00:00:00 2001 From: Simon Hwang Date: Thu, 22 Oct 2015 17:52:28 -0400 Subject: [PATCH] Use image instead of Unicode Character for Copy Button Due to the incompatibility of fonts and encoding in some environments, some browsers could not render the Copy Button correctly. This change uses instead a clipboard image to replace the unstable Unicode Character for the Copy Button. The image is open sourced and is discovered at: http://uxrepo.com/icon/clipboard-by-ionicons Also, license for the use of the image is included. Change-Id: Ie7d55e8cde40df445d32e6b8fcab91cf8a0c05b7 --- gerrit-gwtexpui/BUCK | 2 ++ .../clippy/client/ClippyResources.java | 4 ++++ .../gwtexpui/clippy/client/CopyableLabel.java | 7 +++++- .../gwtexpui/clippy/client/clipboard-16.png | Bin 0 -> 623 bytes lib/BUCK | 1 + lib/LICENSE-drifty | 21 ++++++++++++++++++ 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clipboard-16.png create mode 100644 lib/LICENSE-drifty diff --git a/gerrit-gwtexpui/BUCK b/gerrit-gwtexpui/BUCK index 8e531c199c..f8b82d481d 100644 --- a/gerrit-gwtexpui/BUCK +++ b/gerrit-gwtexpui/BUCK @@ -7,6 +7,7 @@ gwt_module( resources = [ SRC + 'clippy/client/clippy.css', SRC + 'clippy/client/clippy.swf', + SRC + 'clippy/client/clipboard-16.png', SRC + 'clippy/client/CopyableLabelText.properties', ], provided_deps = ['//lib/gwt:user'], @@ -14,6 +15,7 @@ gwt_module( ':SafeHtml', ':UserAgent', '//lib:LICENSE-clippy', + '//lib:LICENSE-drifty', ], visibility = ['PUBLIC'], ) diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyResources.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyResources.java index dfa7679a97..dd3cc18cad 100644 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyResources.java +++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyResources.java @@ -18,6 +18,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.DataResource; import com.google.gwt.resources.client.DataResource.DoNotEmbed; +import com.google.gwt.resources.client.ImageResource; public interface ClippyResources extends ClientBundle { public static final ClippyResources I = GWT.create(ClippyResources.class); @@ -28,4 +29,7 @@ public interface ClippyResources extends ClientBundle { @Source("clippy.swf") @DoNotEmbed DataResource swf(); + + @Source("clipboard-16.png") + ImageResource clipboard(); } diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java index 4b6e7e4339..8d54b2f991 100644 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java +++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java @@ -119,7 +119,12 @@ public class CopyableLabel extends Composite implements HasText { } if (UserAgent.hasJavaScriptClipboard()) { - copier = new Button("📋"); // CLIPBOARD + copier = new Button(new SafeHtmlBuilder() + .openElement("img") + .setAttribute("src", ClippyResources.I.clipboard().getSafeUri().asString()) + .setWidth(14) + .setHeight(14) + .closeSelf()); copier.setStyleName(ClippyResources.I.css().copier()); Tooltip.addStyle(copier); Tooltip.setLabel(copier, CopyableLabelText.I.tooltip()); diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clipboard-16.png b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clipboard-16.png new file mode 100644 index 0000000000000000000000000000000000000000..9c6e10a347127e9328834111a3757d4d7c6f2524 GIT binary patch literal 623 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^xl_H+M9WCijSl0AZa z85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP=YDR+uenMVO6iP5d#CG zw5N+>h{pNU3md&+5(SQay#KvY|5cYnqTwQqjKsvu$>|;a6Hc*r#L6k=9=H^7E21+g zF+WqWtG7d;#lJy~T%`a_|2sR8cyiQ!R0g zC`m~yNwrEYN(E93Mh1qax&}tNhNdBg23AG}Rwf3z24+?U23!k*)KN6#=BH$)RpQoA z{rA;upoV0S4aH^YR>}Ffxv6<23<~b4d8tK-CHX~G3XUoHNvR5+IXR`pC14>1Lo+=i zJwqLZ;4pUu*NTGtq7sFGoYHh%&pZV^uwYnfQE_H|o|S@`o`HdaQ)y;Sih_Zrf`UZP St?xkV7(8A5T-G@yGywpl9_AJR literal 0 HcmV?d00001 diff --git a/lib/BUCK b/lib/BUCK index 0797af76ee..978a9c64bb 100644 --- a/lib/BUCK +++ b/lib/BUCK @@ -12,6 +12,7 @@ define_license(name = 'bouncycastle') define_license(name = 'clippy') define_license(name = 'codemirror') define_license(name = 'diffy') +define_license(name = 'drifty') define_license(name = 'freebie_application_icon_set') define_license(name = 'h2') define_license(name = 'jgit') diff --git a/lib/LICENSE-drifty b/lib/LICENSE-drifty new file mode 100644 index 0000000000..18ab118e71 --- /dev/null +++ b/lib/LICENSE-drifty @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Drifty (http://drifty.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.