File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 55 >
66 <span
77 class =" cursor-copy text-lg font-semibold"
8- @click =" copyToClipboard(`'${ticket.name}' copied to clipboard`)"
8+ @click ="
9+ copyToClipboard(ticket.name, `'${ticket.name}' copied to clipboard`)
10+ "
911 >#{{ ticket.name }}
1012 </span >
1113 <Dropdown
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ const articleActions = computed(() => [
401401 onClick : () => {
402402 const url = new URL (window .location .href );
403403 url .pathname = ` /helpdesk/kb-public/articles/${props .articleId } ` ;
404- copyToClipboard ();
404+ copyToClipboard (url . toString (), " Article link copied to clipboard " );
405405 },
406406 },
407407 {
Original file line number Diff line number Diff line change @@ -85,21 +85,23 @@ export function formatTime(seconds) {
8585
8686export const isCustomerPortal = ref ( false ) ;
8787
88- export async function copyToClipboard ( msg : string = "" ) {
89- let text = msg || "Copied to clipboard" ;
88+ export async function copyToClipboard (
89+ msg : string = "" ,
90+ toastMessage : string = "Copied to clipboard"
91+ ) {
9092 if ( navigator . clipboard && window . isSecureContext ) {
91- await navigator . clipboard . writeText ( text ) ;
93+ await navigator . clipboard . writeText ( msg ) ;
9294 } else {
9395 let input = document . createElement ( "input" ) ;
9496 let body = document . querySelector ( "body" ) ;
9597 body . appendChild ( input ) ;
96- input . value = text ;
98+ input . value = msg ;
9799 input . select ( ) ;
98100 document . execCommand ( "copy" ) ;
99101 input . remove ( ) ;
100102 }
101103
102- toast . success ( text ) ;
104+ toast . success ( toastMessage ) ;
103105}
104106
105107export const textEditorMenuButtons = [
You can’t perform that action at this time.
0 commit comments