From aca889a3e04ff376ee72ec84f5139a79b3ffcd64 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Fri, 8 Apr 2022 10:07:13 +0100 Subject: [PATCH] Sync cursor position to PDF when double-clicking on a heading in the file outline (#7314) GitOrigin-RevId: ef98f5d20e99bfc03c91cbf4027d277e738ab176 --- .../outline/components/outline-item.js | 10 +++------- .../components/pdf-synctex-controls.js | 15 +++++++++++++- .../outline/components/outline-item.test.js | 20 +++++++++++-------- .../test/frontend/helpers/editor-providers.js | 1 + 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/services/web/frontend/js/features/outline/components/outline-item.js b/services/web/frontend/js/features/outline/components/outline-item.js index 7410141f68..55ff9b38af 100644 --- a/services/web/frontend/js/features/outline/components/outline-item.js +++ b/services/web/frontend/js/features/outline/components/outline-item.js @@ -40,12 +40,9 @@ function OutlineItem({ outlineItem, jumpToLine, highlightedLine }) { setExpanded(!expanded) } - function handleOutlineItemLinkClick() { - jumpToLine(outlineItem.line, false) - } - - function handleOutlineItemLinkDoubleClick() { - jumpToLine(outlineItem.line, true) + function handleOutlineItemLinkClick(event) { + const syncToPdf = event.detail === 2 // double-click = sync to PDF + jumpToLine(outlineItem.line, syncToPdf) } useEffect(() => { @@ -87,7 +84,6 @@ function OutlineItem({ outlineItem, jumpToLine, highlightedLine }) {