[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.
This commit is contained in:
Jonas Jenwald 2023-02-04 23:10:41 +01:00
parent d6178a13d7
commit d9181236b2

View File

@ -2954,12 +2954,12 @@ function webViewerKeyDown(evt) {
if (!PDFViewerApplication.supportsIntegratedFind) { if (!PDFViewerApplication.supportsIntegratedFind) {
const { state } = PDFViewerApplication.findController; const { state } = PDFViewerApplication.findController;
if (state) { if (state) {
const eventState = Object.assign(Object.create(null), state, { const newState = {
source: window, source: window,
type: "again", type: "again",
findPrevious: cmd === 5 || cmd === 12, findPrevious: cmd === 5 || cmd === 12,
}); };
eventBus.dispatch("find", eventState); eventBus.dispatch("find", { ...state, ...newState });
} }
handled = true; handled = true;
} }