From 57acf975bfe0bbfa729191241c91be3328f7a0b9 Mon Sep 17 00:00:00 2001 From: Kyle Le Date: Thu, 3 Aug 2023 21:47:08 +0700 Subject: [PATCH] Update copy to clipboard function --- app/assets/javascripts/kaui/kaui.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/assets/javascripts/kaui/kaui.js b/app/assets/javascripts/kaui/kaui.js index 5fdd632e..307cb6aa 100644 --- a/app/assets/javascripts/kaui/kaui.js +++ b/app/assets/javascripts/kaui/kaui.js @@ -386,7 +386,6 @@ function setObjectIdPopover(){ content: function() { var template = '
' + '{{id}}  ' + - ' ' + '
'; var popover_html = Mustache.render( template , { id: $(this).data("id") }); @@ -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)) {