@@ -18,22 +18,13 @@ use windows::Win32::Foundation::HWND;
1818use std:: { fmt, path:: PathBuf } ;
1919
2020/// The attributes used to create an webview.
21+ #[ derive( Debug ) ]
2122pub struct WebviewAttributes {
2223 pub url : WindowUrl ,
2324 pub initialization_scripts : Vec < String > ,
2425 pub data_directory : Option < PathBuf > ,
2526 pub file_drop_handler_enabled : bool ,
26- }
27-
28- impl fmt:: Debug for WebviewAttributes {
29- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
30- f. debug_struct ( "WebviewAttributes" )
31- . field ( "url" , & self . url )
32- . field ( "initialization_scripts" , & self . initialization_scripts )
33- . field ( "data_directory" , & self . data_directory )
34- . field ( "file_drop_handler_enabled" , & self . file_drop_handler_enabled )
35- . finish ( )
36- }
27+ pub clipboard : bool ,
3728}
3829
3930impl WebviewAttributes {
@@ -44,6 +35,7 @@ impl WebviewAttributes {
4435 initialization_scripts : Vec :: new ( ) ,
4536 data_directory : None ,
4637 file_drop_handler_enabled : true ,
38+ clipboard : false ,
4739 }
4840 }
4941
@@ -64,6 +56,15 @@ impl WebviewAttributes {
6456 self . file_drop_handler_enabled = false ;
6557 self
6658 }
59+
60+ /// Enables clipboard access for the page rendered on **Linux** and **Windows**.
61+ ///
62+ /// **macOS** doesn't provide such method and is always enabled by default,
63+ /// but you still need to add menu item accelerators to use shortcuts.
64+ pub fn enable_clipboard_access ( mut self ) -> Self {
65+ self . clipboard = true ;
66+ self
67+ }
6768}
6869
6970/// Do **NOT** implement this trait except for use in a custom [`Runtime`](crate::Runtime).
0 commit comments