File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -396,11 +396,9 @@ class CodeitElement extends HTMLElement {
396396
397397 const selection = window . getSelection ( ) ;
398398 if ( ! selection . rangeCount ) return false ;
399-
399+ if ( selection . getRangeAt ( 0 ) . collapsed ) return false ;
400+
400401 const text = window . getSelection ( ) . toString ( ) ;
401-
402- if ( text === '' ) return false ;
403-
404402 e . clipboardData . setData ( 'text/plain' , text ) ;
405403
406404 cd . deleteCurrentSelection ( ) ;
@@ -426,7 +424,10 @@ class CodeitElement extends HTMLElement {
426424 const selection = window . getSelection ( ) ;
427425 if ( ! selection . rangeCount ) return false ;
428426
429- cd . deleteCurrentSelection ( ) ;
427+ // if selection isn't collapsed, delete it
428+ if ( ! selection . getRangeAt ( 0 ) . collapsed ) {
429+ cd . deleteCurrentSelection ( ) ;
430+ }
430431
431432 cd . insert ( paste ) ;
432433
You can’t perform that action at this time.
0 commit comments