mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	fixes
This commit is contained in:
		
							parent
							
								
									95e38a037b
								
							
						
					
					
						commit
						a24c56a9d5
					
				@ -1077,13 +1077,17 @@ class BNote extends AbstractBeccaEntity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /** @returns {BAttachment[]} */
 | 
					    /** @returns {BAttachment[]} */
 | 
				
			||||||
    getAttachments() {
 | 
					    getAttachments() {
 | 
				
			||||||
        return sql.getRows("SELECT * FROM attachments WHERE noteId = ? AND isDeleted = 0", [this.noteId])
 | 
					        return sql.getRows(`
 | 
				
			||||||
 | 
					                SELECT attachments.*
 | 
				
			||||||
 | 
					                FROM attachments 
 | 
				
			||||||
 | 
					                WHERE parentId = ? 
 | 
				
			||||||
 | 
					                  AND isDeleted = 0`, [this.noteId])
 | 
				
			||||||
            .map(row => new BAttachment(row));
 | 
					            .map(row => new BAttachment(row));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** @returns {BAttachment|undefined} */
 | 
					    /** @returns {BAttachment|undefined} */
 | 
				
			||||||
    getAttachmentByName(name) {
 | 
					    getAttachmentByName(name) {
 | 
				
			||||||
        return sql.getRows("SELECT * FROM attachments WHERE noteId = ? AND name = ? AND isDeleted = 0", [this.noteId, name])
 | 
					        return sql.getRows("SELECT * FROM attachments WHERE parentId = ? AND name = ? AND isDeleted = 0", [this.noteId, name])
 | 
				
			||||||
            .map(row => new BAttachment(row))
 | 
					            .map(row => new BAttachment(row))
 | 
				
			||||||
            [0];
 | 
					            [0];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -120,4 +120,12 @@ export default class RootCommandExecutor extends Component {
 | 
				
			|||||||
            await appContext.tabManager.openContextWithNote(notePath, { activate: true, viewMode: 'source' });
 | 
					            await appContext.tabManager.openContextWithNote(notePath, { activate: true, viewMode: 'source' });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async showAttachmentsCommand() {
 | 
				
			||||||
 | 
					        const notePath = appContext.tabManager.getActiveContextNotePath();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (notePath) {
 | 
				
			||||||
 | 
					            await appContext.tabManager.openContextWithNote(notePath, { activate: true, viewMode: 'attachments' });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user