Skip to content

Commit

Permalink
Merge pull request #373 from tungleduyxyz/bug_348_replace_old_copy_cl…
Browse files Browse the repository at this point in the history
…ipboard

Update copy to clipboard function
  • Loading branch information
pierre authored Aug 22, 2023
2 parents 985e5c9 + 57acf97 commit 9fae397
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions app/assets/javascripts/kaui/kaui.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ function setObjectIdPopover(){
content: function() {
var template = '<div class="{{id}}-content" >' +
'{{id}}&emsp;<i id="{{id}}-copy" class="fa fa-clipboard copy-icon" aria-hidden="true"></i> ' +
'<input id="{{id}}-placeholder" class="form-control hidden"> ' +
'</div>';

var popover_html = Mustache.render( template , { id: $(this).data("id") });
Expand Down Expand Up @@ -415,14 +414,7 @@ function setObjectIdPopover(){
copyIdImg.data("popover",$(this).attr("id"));
copyIdImg.click(function(e){
var id = ($(this).attr("id")).replace('-copy','');
var placeholder = $("#" + objectId + "-placeholder");
var popover = $("#" + copyIdImg.data("popover"));
placeholder.val(id);
placeholder.removeClass("hidden");
placeholder.select();

document.execCommand("Copy");
placeholder.addClass("hidden");
navigator.clipboard.writeText(id);
ajaxInfoAlert("Id [" + id + "] was copied into the clipboard!", 4000);

if (!isBlank(popover)) {
Expand Down

0 comments on commit 9fae397

Please sign in to comment.