You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Desktop: Fixes #1867: Fix scrolling issue when clicking on internal link
This commit is contained in:
		| @@ -161,7 +161,7 @@ | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		let ignoreNextScrollEvent = false; | ||||
| 		let lastScrollEventTime = 0; | ||||
| 		ipc.setPercentScroll = (event) => { | ||||
| 			const percent = event.percent; | ||||
|  | ||||
| @@ -170,7 +170,7 @@ | ||||
| 				checkScrollIID_ = null; | ||||
| 			} | ||||
|  | ||||
| 			ignoreNextScrollEvent = true; | ||||
| 			lastScrollEventTime = Date.now(); | ||||
| 			setPercentScroll(percent); | ||||
| 		} | ||||
|  | ||||
| @@ -293,10 +293,20 @@ | ||||
| 		} | ||||
|  | ||||
| 		contentElement.addEventListener('scroll', webviewLib.logEnabledEventHandler(e => { | ||||
| 			if (ignoreNextScrollEvent) { | ||||
| 				ignoreNextScrollEvent = false; | ||||
| 			console.info('contentElement.scroll', lastScrollEventTime); | ||||
|  | ||||
| 			// If the last scroll event was done by the user, lastScrollEventTime is set and | ||||
| 			// we can use that to skip the event handling. We skip it because in that case | ||||
| 			// the scroll position has already been updated. Also we add a 200ms interval | ||||
| 			// because otherwise it's most likely a glitch where we called ipc.setPercentScroll | ||||
| 			// but the scroll event listener has not been called. | ||||
| 			if (lastScrollEventTime && Date.now() - lastScrollEventTime < 200) { | ||||
| 				lastScrollEventTime = 0; | ||||
| 				return; | ||||
| 			} | ||||
|  | ||||
| 			lastScrollEventTime = 0; | ||||
|  | ||||
| 			const percent = currentPercentScroll(); | ||||
| 			setPercentScroll(percent); | ||||
| 			 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user