mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Merge pull request #20929 from calixteman/bug2022481
Add the basic telemetry for Organize feature (bug 2022481)
This commit is contained in:
commit
2c5812006a
@ -1334,6 +1334,10 @@ const PDFViewerApplication = {
|
||||
classList.add("wait");
|
||||
|
||||
if (this.pdfThumbnailViewer?.hasStructuralChanges()) {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "pageOrganization",
|
||||
data: { action: "save" },
|
||||
});
|
||||
await this.onSavePages({
|
||||
data: this.pdfThumbnailViewer.getStructuralChanges(),
|
||||
});
|
||||
|
||||
@ -709,6 +709,7 @@ class PDFThumbnailViewer {
|
||||
this.#toggleMenuEntries(false);
|
||||
this.#updateStatus("select");
|
||||
|
||||
this.#reportTelemetry({ action: "move" });
|
||||
this.eventBus.dispatch("pagesedited", {
|
||||
source: this,
|
||||
pagesMapper,
|
||||
@ -825,7 +826,18 @@ class PDFThumbnailViewer {
|
||||
}
|
||||
}
|
||||
|
||||
#reportTelemetry(data) {
|
||||
this.eventBus.dispatch("reporttelemetry", {
|
||||
source: this,
|
||||
details: {
|
||||
type: "pageOrganization",
|
||||
data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
#saveExtractedPages() {
|
||||
this.#reportTelemetry({ action: "exportSelected" });
|
||||
this.eventBus.dispatch("saveextractedpages", {
|
||||
source: this,
|
||||
data: this.#pagesMapper.extractPages(this.#selectedPages),
|
||||
@ -840,6 +852,7 @@ class PDFThumbnailViewer {
|
||||
// that clicking the "Done" button later only cancels the copy and does
|
||||
// not accidentally restore a previous paste or delete.
|
||||
this.#savedThumbnails = null;
|
||||
this.#reportTelemetry({ action: "copy" });
|
||||
}
|
||||
this.#updateStatus(this.#isCut ? "cut" : "copy");
|
||||
const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(
|
||||
@ -869,12 +882,14 @@ class PDFThumbnailViewer {
|
||||
return;
|
||||
}
|
||||
|
||||
this.#reportTelemetry({ action: "cut" });
|
||||
this.#isCut = true;
|
||||
this.#copyPages(false);
|
||||
this.#deletePages(/* type = */ "cut");
|
||||
}
|
||||
|
||||
#pastePages(index) {
|
||||
this.#reportTelemetry({ action: "paste" });
|
||||
const pagesMapper = this.#pagesMapper;
|
||||
const currentPageNumber = this.#copiedPageNumbers.includes(
|
||||
this._currentPageNumber
|
||||
@ -907,6 +922,7 @@ class PDFThumbnailViewer {
|
||||
|
||||
const selectedPages = this.#selectedPages;
|
||||
if (type === "delete") {
|
||||
this.#reportTelemetry({ action: "delete" });
|
||||
this.#updateStatus("delete");
|
||||
}
|
||||
const pagesMapper = this.#pagesMapper;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user