Only enable copy icon when there is actually a selection

This commit is contained in:
Jordi Boggiano
2012-01-15 18:05:07 +01:00
parent d9aca6be76
commit 5d168aa4d8
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -33,9 +33,13 @@
*/ */
prepareClippyButton = function(e) { prepareClippyButton = function(e) {
var selection = editor.getSession().doc.getTextRange(editor.getSelectionRange()); var selection = editor.getSession().doc.getTextRange(editor.getSelectionRange());
if (!selection) {
$('.statusbar .copy').hide();
return;
}
$('#clippy embed').attr('FlashVars', 'text=' + selection); $('#clippy embed').attr('FlashVars', 'text=' + selection);
$('#clippy param[name="FlashVars"]').attr('value', 'text=' + selection); $('#clippy param[name="FlashVars"]').attr('value', 'text=' + selection);
$('.statusbar .copy').html($('.statusbar .copy').html()); $('.statusbar .copy').html($('.statusbar .copy').html()).show();
}; };
/** /**
+1
View File
@@ -48,6 +48,7 @@ a {
.statusbar .copy { .statusbar .copy {
margin-left: 50px; margin-left: 50px;
display: none;
} }
#clippy { #clippy {
position: relative; position: relative;