mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	Use clippie module to copy to clipboard (#23801)
Externalize clipboard copying to the [clippie](https://github.com/silverwind/clippie) module which I feel I can maintain outside this repo for shared benefit with my other projects. The module is feature-equivalent to the previous code and has one improvement where it sets `aria-hidden` on the fallback textarea, preventing screen readers from picking it up. Also it support `Array` of `content` as well to copy multiple items at once, in case it's ever needed.
This commit is contained in:
		| @@ -1,11 +1,11 @@ | ||||
| import {copyToClipboard} from './clipboard.js'; | ||||
| import {clippie} from 'clippie'; | ||||
| import {showTemporaryTooltip} from '../modules/tippy.js'; | ||||
| import {convertImage} from '../utils.js'; | ||||
|  | ||||
| const {i18n} = window.config; | ||||
|  | ||||
| async function doCopy(content, btn) { | ||||
|   const success = await copyToClipboard(content); | ||||
|   const success = await clippie(content); | ||||
|   showTemporaryTooltip(btn, success ? i18n.copy_success : i18n.copy_error); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user