mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			390 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			390 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * Writes a text string to the system clipboard.
 | 
						|
 *
 | 
						|
 * @async
 | 
						|
 * @param {string} text text to be written to the clipboard
 | 
						|
 * @throws {Error} unable to copy text to clipboard
 | 
						|
 */
 | 
						|
export const copyTextToClipboard = async text => {
 | 
						|
  try {
 | 
						|
    await navigator.clipboard.writeText(text);
 | 
						|
  } catch (error) {
 | 
						|
    throw new Error(`Unable to copy text to clipboard: ${error.message}`);
 | 
						|
  }
 | 
						|
};
 |