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
This commit is contained in:
parent
0f9193c370
commit
b384139657
@ -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'],
|
||||
)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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());
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 623 B |
1
lib/BUCK
1
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')
|
||||
|
21
lib/LICENSE-drifty
Normal file
21
lib/LICENSE-drifty
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user