1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Desktop: Fixed two way scrolling issue in Markdown editor

This commit is contained in:
Laurent Cozic 2020-05-19 23:51:00 +00:00
parent bec8a2e7d1
commit a99db36578
2 changed files with 8 additions and 2 deletions

View File

@ -85,7 +85,7 @@ function NoteEditor(props: NoteEditorProps) {
function scheduleSaveNote(formNote: FormNote) {
if (!formNote.saveActionQueue) throw new Error('saveActionQueue is not set!!'); // Sanity check
reg.logger().debug('Scheduling...', formNote);
// reg.logger().debug('Scheduling...', formNote);
const makeAction = (formNote: FormNote) => {
return async function() {

View File

@ -82,6 +82,12 @@
let percentScroll_ = 0;
let checkScrollIID_ = null;
// This variable provides a way to skip scroll events for a certain duration.
// In general, it should be set whenever the scroll value is set explicitely (programmatically)
// so as to differentiate scroll events generated by the user (when scrolling the view) and those
// generated by the application.
let lastScrollEventTime = 0;
function setPercentScroll(percent) {
percentScroll_ = percent;
contentElement.scrollTop = percentScroll_ * maxScrollTop();
@ -92,6 +98,7 @@
}
function restorePercentScroll() {
lastScrollEventTime = Date.now();
setPercentScroll(percentScroll_);
}
@ -206,7 +213,6 @@
}, 100);
}
let lastScrollEventTime = 0;
ipc.setPercentScroll = (event) => {
const percent = event.percent;