mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	fix scrolling to the top of detail after switching note
This commit is contained in:
		
							parent
							
								
									812f9f6fca
								
							
						
					
					
						commit
						a32645cdeb
					
				@ -223,7 +223,7 @@ async function loadNoteDetail(noteId) {
 | 
				
			|||||||
    treeService.setBranchBackgroundBasedOnProtectedStatus(noteId);
 | 
					    treeService.setBranchBackgroundBasedOnProtectedStatus(noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // after loading new note make sure editor is scrolled to the top
 | 
					    // after loading new note make sure editor is scrolled to the top
 | 
				
			||||||
    $noteDetailWrapper.scrollTop(0);
 | 
					    getComponent(currentNote.type).scrollToTop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $scriptArea.empty();
 | 
					    $scriptArea.empty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -107,5 +107,6 @@ export default {
 | 
				
			|||||||
        if (codeEditor) {
 | 
					        if (codeEditor) {
 | 
				
			||||||
            codeEditor.setValue('');
 | 
					            codeEditor.setValue('');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
 | 
					    scrollToTop: () => $component.scrollTop(0)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -53,5 +53,6 @@ export default {
 | 
				
			|||||||
    getContent: () => null,
 | 
					    getContent: () => null,
 | 
				
			||||||
    focus: () => null,
 | 
					    focus: () => null,
 | 
				
			||||||
    onNoteChange: () => null,
 | 
					    onNoteChange: () => null,
 | 
				
			||||||
    cleanup: () => null
 | 
					    cleanup: () => null,
 | 
				
			||||||
 | 
					    scrollToTop: () => null
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -71,5 +71,6 @@ export default {
 | 
				
			|||||||
    getContent: () => null,
 | 
					    getContent: () => null,
 | 
				
			||||||
    focus: () => null,
 | 
					    focus: () => null,
 | 
				
			||||||
    onNoteChange: () => null,
 | 
					    onNoteChange: () => null,
 | 
				
			||||||
    cleanup: () => null
 | 
					    cleanup: () => null,
 | 
				
			||||||
 | 
					    scrollToTop: () => $component.scrollTop(0)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -566,5 +566,6 @@ export default {
 | 
				
			|||||||
    getContent: () => JSON.stringify(mapData),
 | 
					    getContent: () => JSON.stringify(mapData),
 | 
				
			||||||
    focus: () => null,
 | 
					    focus: () => null,
 | 
				
			||||||
    onNoteChange: () => null,
 | 
					    onNoteChange: () => null,
 | 
				
			||||||
    cleanup
 | 
					    cleanup,
 | 
				
			||||||
 | 
					    scrollToTop: () => null
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -37,5 +37,6 @@ export default {
 | 
				
			|||||||
    getContent: () => "",
 | 
					    getContent: () => "",
 | 
				
			||||||
    focus: () => null,
 | 
					    focus: () => null,
 | 
				
			||||||
    onNoteChange: () => null,
 | 
					    onNoteChange: () => null,
 | 
				
			||||||
    cleanup: () => $noteDetailRenderContent.empty()
 | 
					    cleanup: () => $noteDetailRenderContent.empty(),
 | 
				
			||||||
 | 
					    scrollToTop: () => $component.scrollTop(0)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -30,5 +30,6 @@ export default {
 | 
				
			|||||||
    show,
 | 
					    show,
 | 
				
			||||||
    focus: () => null,
 | 
					    focus: () => null,
 | 
				
			||||||
    onNoteChange: () => null,
 | 
					    onNoteChange: () => null,
 | 
				
			||||||
    cleanup: () => null
 | 
					    cleanup: () => null,
 | 
				
			||||||
 | 
					    scrollToTop: () => null
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -74,5 +74,6 @@ export default {
 | 
				
			|||||||
        if (textEditor) {
 | 
					        if (textEditor) {
 | 
				
			||||||
            textEditor.setData('');
 | 
					            textEditor.setData('');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
 | 
					    scrollToTop: () => $component.scrollTop(0)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user