mirror of https://github.com/laurent22/joplin.git
Desktop: Fixed two way scrolling issue in Markdown editor
parent
bec8a2e7d1
commit
a99db36578
|
@ -85,7 +85,7 @@ function NoteEditor(props: NoteEditorProps) {
|
||||||
function scheduleSaveNote(formNote: FormNote) {
|
function scheduleSaveNote(formNote: FormNote) {
|
||||||
if (!formNote.saveActionQueue) throw new Error('saveActionQueue is not set!!'); // Sanity check
|
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) => {
|
const makeAction = (formNote: FormNote) => {
|
||||||
return async function() {
|
return async function() {
|
||||||
|
|
|
@ -82,6 +82,12 @@
|
||||||
let percentScroll_ = 0;
|
let percentScroll_ = 0;
|
||||||
let checkScrollIID_ = null;
|
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) {
|
function setPercentScroll(percent) {
|
||||||
percentScroll_ = percent;
|
percentScroll_ = percent;
|
||||||
contentElement.scrollTop = percentScroll_ * maxScrollTop();
|
contentElement.scrollTop = percentScroll_ * maxScrollTop();
|
||||||
|
@ -92,6 +98,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function restorePercentScroll() {
|
function restorePercentScroll() {
|
||||||
|
lastScrollEventTime = Date.now();
|
||||||
setPercentScroll(percentScroll_);
|
setPercentScroll(percentScroll_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +213,6 @@
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastScrollEventTime = 0;
|
|
||||||
ipc.setPercentScroll = (event) => {
|
ipc.setPercentScroll = (event) => {
|
||||||
const percent = event.percent;
|
const percent = event.percent;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue