fix scrolling to the top of detail after switching note

This commit is contained in:
azivner 2018-12-24 09:47:00 +01:00
parent 812f9f6fca
commit a32645cdeb
8 changed files with 15 additions and 8 deletions

View File

@ -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();

View File

@ -107,5 +107,6 @@ export default {
if (codeEditor) { if (codeEditor) {
codeEditor.setValue(''); codeEditor.setValue('');
} }
} },
scrollToTop: () => $component.scrollTop(0)
} }

View File

@ -53,5 +53,6 @@ export default {
getContent: () => null, getContent: () => null,
focus: () => null, focus: () => null,
onNoteChange: () => null, onNoteChange: () => null,
cleanup: () => null cleanup: () => null,
scrollToTop: () => null
} }

View File

@ -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)
} }

View File

@ -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
} }

View File

@ -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)
} }

View File

@ -30,5 +30,6 @@ export default {
show, show,
focus: () => null, focus: () => null,
onNoteChange: () => null, onNoteChange: () => null,
cleanup: () => null cleanup: () => null,
scrollToTop: () => null
} }

View File

@ -74,5 +74,6 @@ export default {
if (textEditor) { if (textEditor) {
textEditor.setData(''); textEditor.setData('');
} }
} },
scrollToTop: () => $component.scrollTop(0)
} }