Skip to content

Commit be35389

Browse files
authored
Merge pull request #660 from hyoo-ru/koplenov-patch-2
$mol_button_copy: hide fallback error
2 parents bbc3881 + 9a0f443 commit be35389

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

button/copy/copy.view.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ namespace $.$$ {
2424

2525
click( event?: Event ) {
2626
const cb = $mol_wire_sync( this.$.$mol_dom_context.navigator.clipboard )
27-
cb.writeText( this.text() ) // fallback
28-
cb.write( this.attachments() )
27+
28+
cb.writeText?.( this.text() )
29+
cb.write?.( this.attachments() )
30+
31+
if( cb.writeText === undefined && cb.write === undefined ) {
32+
throw new Error( "doesn't support copy to clipoard" )
33+
}
2934
}
3035

3136
}

0 commit comments

Comments
 (0)