From 75edefb000e4f9129654e765ba5250397865c037 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 11 Oct 2024 01:49:51 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/12482 --- app/src/asset/pdf/app.js | 11 ++++++++--- app/src/assets/scss/pdf/_pdf.scss | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/asset/pdf/app.js b/app/src/asset/pdf/app.js index 29a9fa75c..860425a05 100644 --- a/app/src/asset/pdf/app.js +++ b/app/src/asset/pdf/app.js @@ -90,7 +90,7 @@ import {Toolbar} from "./toolbar"; import {ViewHistory} from "./view_history.js"; import {hasClosestByClassName} from "../../protyle/util/hasClosest"; import {Constants} from "../../constants"; -import {getPdfInstance} from "../anno"; +import {getPdfInstance, hlPDFRect} from "../anno"; const FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms @@ -2469,7 +2469,10 @@ function onPageNumberChanged(evt) { if (evt.value !== "") { it.pdfLinkService.goToPage(evt.value); } - + // NOTE + if (evt.id) { + hlPDFRect(it.pdfViewer.container, evt.id) + } // Ensure that the page number input displays the correct value, even if the // value entered by the user was invalid (e.g. a floating point number). if ( @@ -2815,7 +2818,9 @@ function onKeyUp(evt) { return } // NOTE 4+ 版本不知道为 r 后不 focus 了 - pdfInstance.pdfViewer.focus(); + if (!["SELECT", "TEXTAREA", "INPUT"].includes(evt.target.tagName)) { + pdfInstance.pdfViewer.focus(); + } // evt.ctrlKey is false hence we use evt.key. if (evt.key === "Control") { diff --git a/app/src/assets/scss/pdf/_pdf.scss b/app/src/assets/scss/pdf/_pdf.scss index 68cfcb7f9..3ffe1ba11 100644 --- a/app/src/assets/scss/pdf/_pdf.scss +++ b/app/src/assets/scss/pdf/_pdf.scss @@ -371,6 +371,7 @@ margin-right: 8px; color: var(--b3-theme-on-surface); overflow: initial; + align-self: center; &:hover, &:focus { @@ -412,6 +413,7 @@ width: inherit; min-width: auto; padding: 0 8px; + height: 26px; } }