mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	fix(editor): data loss if updating while editor crashed
This commit is contained in:
		
							parent
							
								
									b379f89a7a
								
							
						
					
					
						commit
						d7f26fa27c
					
				@ -336,6 +336,11 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getData() {
 | 
					    getData() {
 | 
				
			||||||
 | 
					        if (!this.watchdog.editor) {
 | 
				
			||||||
 | 
					            // There is nothing to save, most likely a result of the editor crashing and reinitializing.
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const content = this.watchdog.editor?.getData() ?? "";
 | 
					        const content = this.watchdog.editor?.getData() ?? "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // if content is only tags/whitespace (typically <p> </p>), then just make it empty,
 | 
					        // if content is only tags/whitespace (typically <p> </p>), then just make it empty,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user