mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #19121 from Snuffleupagus/more-stopEvent
Use the `stopEvent` helper function everywhere possible
This commit is contained in:
commit
65f20b0392
10 changed files with 32 additions and 31 deletions
|
@ -53,6 +53,7 @@ import {
|
|||
MissingPDFException,
|
||||
PDFWorker,
|
||||
shadow,
|
||||
stopEvent,
|
||||
UnexpectedResponseException,
|
||||
version,
|
||||
} from "pdfjs-lib";
|
||||
|
@ -715,8 +716,7 @@ const PDFViewerApplication = {
|
|||
if (item.type === "application/pdf") {
|
||||
evt.dataTransfer.dropEffect =
|
||||
evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move";
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
stopEvent(evt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -725,8 +725,7 @@ const PDFViewerApplication = {
|
|||
if (evt.dataTransfer.files?.[0].type !== "application/pdf") {
|
||||
return;
|
||||
}
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
stopEvent(evt);
|
||||
eventBus.dispatch("fileinputchange", {
|
||||
source: this,
|
||||
fileInput: evt.dataTransfer,
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { stopEvent } from "pdfjs-lib";
|
||||
|
||||
// Class name of element which can be grabbed.
|
||||
const CSS_CLASS_GRAB = "grab-to-pan-grab";
|
||||
|
||||
|
@ -131,8 +133,7 @@ class GrabToPan {
|
|||
capture: true,
|
||||
signal: this.#scrollAC.signal,
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
stopEvent(event);
|
||||
|
||||
const focusedElement = document.activeElement;
|
||||
if (focusedElement && !focusedElement.contains(event.target)) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import {
|
|||
PermissionFlag,
|
||||
PixelsPerInch,
|
||||
shadow,
|
||||
stopEvent,
|
||||
version,
|
||||
} from "pdfjs-lib";
|
||||
import {
|
||||
|
@ -748,8 +749,7 @@ class PDFViewer {
|
|||
this.#getAllTextInProgress ||
|
||||
textLayerMode === TextLayerMode.ENABLE_PERMISSIONS
|
||||
) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
stopEvent(event);
|
||||
return;
|
||||
}
|
||||
this.#getAllTextInProgress = true;
|
||||
|
@ -786,8 +786,7 @@ class PDFViewer {
|
|||
classList.remove("copyAll");
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
stopEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ const {
|
|||
RenderingCancelledException,
|
||||
setLayerDimensions,
|
||||
shadow,
|
||||
stopEvent,
|
||||
TextLayer,
|
||||
UnexpectedResponseException,
|
||||
Util,
|
||||
|
@ -97,6 +98,7 @@ export {
|
|||
RenderingCancelledException,
|
||||
setLayerDimensions,
|
||||
shadow,
|
||||
stopEvent,
|
||||
TextLayer,
|
||||
UnexpectedResponseException,
|
||||
Util,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
|
||||
|
||||
import { normalizeUnicode, TextLayer } from "pdfjs-lib";
|
||||
import { normalizeUnicode, stopEvent, TextLayer } from "pdfjs-lib";
|
||||
import { removeNullCharacters } from "./ui_utils.js";
|
||||
|
||||
/**
|
||||
|
@ -162,8 +162,7 @@ class TextLayerBuilder {
|
|||
removeNullCharacters(normalizeUnicode(selection.toString()))
|
||||
);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
stopEvent(event);
|
||||
});
|
||||
|
||||
TextLayerBuilder.#textLayers.set(div, end);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue