@@ -37,6 +37,7 @@ use graphene_std::table::Table;
3737use graphene_std:: vector:: PointId ;
3838use graphene_std:: vector:: click_target:: { ClickTarget , ClickTargetType } ;
3939use graphene_std:: vector:: style:: ViewMode ;
40+ use std:: path:: PathBuf ;
4041use std:: time:: Duration ;
4142
4243#[ derive( ExtractField ) ]
@@ -115,6 +116,9 @@ pub struct DocumentMessageHandler {
115116 /// Stack of document network snapshots for future history states.
116117 #[ serde( skip) ]
117118 document_redo_history : VecDeque < NodeNetworkInterface > ,
119+ /// The path of the to the document file.
120+ #[ serde( skip) ]
121+ path : Option < PathBuf > ,
118122 /// Hash of the document snapshot that was most recently saved to disk by the user.
119123 #[ serde( skip) ]
120124 saved_hash : Option < u64 > ,
@@ -162,6 +166,7 @@ impl Default for DocumentMessageHandler {
162166 selection_network_path : Vec :: new ( ) ,
163167 document_undo_history : VecDeque :: new ( ) ,
164168 document_redo_history : VecDeque :: new ( ) ,
169+ path : None ,
165170 saved_hash : None ,
166171 auto_saved_hash : None ,
167172 layer_range_selection_reference : None ,
@@ -996,11 +1001,16 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
9961001 true => self . name . clone ( ) ,
9971002 false => self . name . clone ( ) + FILE_SAVE_SUFFIX ,
9981003 } ;
999- responses. add ( FrontendMessage :: TriggerDownloadTextFile {
1000- document : self . serialize_document ( ) ,
1004+ responses. add ( FrontendMessage :: TriggerSaveDocument {
1005+ document_id ,
10011006 name,
1007+ path : self . path . clone ( ) ,
1008+ document : self . serialize_document ( ) ,
10021009 } )
10031010 }
1011+ DocumentMessage :: SavedDocument { path } => {
1012+ self . path = path;
1013+ }
10041014 DocumentMessage :: SelectParentLayer => {
10051015 let selected_nodes = self . network_interface . selected_nodes ( ) ;
10061016 let selected_layers = selected_nodes. selected_layers ( self . metadata ( ) ) ;
0 commit comments