From d9181236b27fbbb2f99473b24550f34e7585950e Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 4 Feb 2023 23:10:41 +0100 Subject: [PATCH] [GENERIC viewer] Simplify the keyboard find-again state building By using modern JavaScript features, we can ever so slightly reduce the amount of code needed here. --- web/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app.js b/web/app.js index a8e1513fe..989d6172a 100644 --- a/web/app.js +++ b/web/app.js @@ -2954,12 +2954,12 @@ function webViewerKeyDown(evt) { if (!PDFViewerApplication.supportsIntegratedFind) { const { state } = PDFViewerApplication.findController; if (state) { - const eventState = Object.assign(Object.create(null), state, { + const newState = { source: window, type: "again", findPrevious: cmd === 5 || cmd === 12, - }); - eventBus.dispatch("find", eventState); + }; + eventBus.dispatch("find", { ...state, ...newState }); } handled = true; }