File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 328328 * Copy to clipboard.
329329 * @since 2.18
330330 */
331- clipboard : function ( el ) {
332- var copyText = el . getAttribute ( "data-text" ) ;
331+ clipboard : function ( el ) {
332+ const copyText = el . getAttribute ( "data-text" ) ;
333333 if ( ! copyText ?. length ) {
334- return false ;
334+ csk . ui . alert ( csk . i18n . default . clipboard_copy_error , "error" ) ;
335+ return ;
336+ }
337+
338+ if ( ! navigator . clipboard ?. writeText ) {
339+ csk . ui . alert ( csk . i18n . default . clipboard_copy_error , "error" ) ;
340+ return ;
335341 }
336- navigator . clipboard . writeText ( copyText ) ;
337- csk . ui . alert ( csk . i18n . media . copied , "success" ) ;
342+
343+ navigator . clipboard
344+ . writeText ( copyText )
345+ . then ( ( ) => csk . ui . alert ( csk . i18n . default . clipboard_copy_success , "success" ) )
346+ . catch ( ( ) => csk . ui . alert ( csk . i18n . default . clipboard_copy_error , "error" ) ) ;
338347 } ,
339348
340349 /**
You can’t perform that action at this time.
0 commit comments