22// SPDX-License-Identifier: Apache-2.0
33// SPDX-License-Identifier: MIT
44
5- use tauri:: { command, AppHandle , Manager , ResourceId , Runtime , State } ;
5+ use tauri:: { command, AppHandle , Manager , ResourceId , Runtime , State , Webview } ;
66
77use crate :: { ClipKind , Clipboard , ClipboardContents , Result } ;
88
@@ -17,11 +17,12 @@ pub(crate) async fn write_text<R: Runtime>(
1717
1818#[ command]
1919pub ( crate ) async fn write_image < R : Runtime > (
20- _app : AppHandle < R > ,
20+ webview : Webview < R > ,
2121 clipboard : State < ' _ , Clipboard < R > > ,
2222 data : ClipKind ,
2323) -> Result < ( ) > {
24- clipboard. write_image ( data)
24+ let resources_table = webview. resources_table ( ) ;
25+ clipboard. write_image_inner ( data, & resources_table)
2526}
2627
2728#[ command]
@@ -34,11 +35,11 @@ pub(crate) async fn read_text<R: Runtime>(
3435
3536#[ command]
3637pub ( crate ) async fn read_image < R : Runtime > (
37- app : AppHandle < R > ,
38+ webview : Webview < R > ,
3839 clipboard : State < ' _ , Clipboard < R > > ,
3940) -> Result < ResourceId > {
4041 let image = clipboard. read_image ( ) ?. to_owned ( ) ;
41- let mut resources_table = app . resources_table ( ) ;
42+ let mut resources_table = webview . resources_table ( ) ;
4243 let rid = resources_table. add ( image) ;
4344 Ok ( rid)
4445}
0 commit comments