mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix(client): clicking on note list not working due to anchor management
This commit is contained in:
		| @@ -286,7 +286,9 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent | |||||||
|     evt.stopPropagation(); |     evt.stopPropagation(); | ||||||
|  |  | ||||||
|     if (hrefLink && hrefLink.startsWith("#") && !hrefLink.startsWith("#root/") && $link) { |     if (hrefLink && hrefLink.startsWith("#") && !hrefLink.startsWith("#root/") && $link) { | ||||||
|         return handleAnchor(hrefLink, $link); |         if (handleAnchor(hrefLink, $link)) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const { notePath, viewScope } = parseNavigationStateFromUrl(hrefLink); |     const { notePath, viewScope } = parseNavigationStateFromUrl(hrefLink); | ||||||
| @@ -353,14 +355,14 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent | |||||||
|  * |  * | ||||||
|  * @param hrefLink the URL of the link that was clicked (it should be in the form of `#fn` or `#fnref`). |  * @param hrefLink the URL of the link that was clicked (it should be in the form of `#fn` or `#fnref`). | ||||||
|  * @param $link the element of the link that was clicked. |  * @param $link the element of the link that was clicked. | ||||||
|  * @returns whether the event should be consumed or not. |  * @returns `true` if the link was handled (i.e., the element was found and scrolled to), `false` otherwise. | ||||||
|  */ |  */ | ||||||
| function handleAnchor(hrefLink: string, $link: JQuery<HTMLElement>) { | function handleAnchor(hrefLink: string, $link: JQuery<HTMLElement>) { | ||||||
|     const el = $link.closest(".ck-content").find(hrefLink)[0]; |     const el = $link.closest(".ck-content").find(hrefLink)[0]; | ||||||
|     if (el) { |     if (el) { | ||||||
|         el.scrollIntoView({ behavior: "smooth", block: "center" }); |         el.scrollIntoView({ behavior: "smooth", block: "center" }); | ||||||
|     } |     } | ||||||
|     return true; |     return !!el; | ||||||
| } | } | ||||||
|  |  | ||||||
| function linkContextMenu(e: PointerEvent) { | function linkContextMenu(e: PointerEvent) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user