[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) {
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;
}