mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-29 18:37:20 +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");
|
classList.add("wait");
|
||||||
|
|
||||||
if (this.pdfThumbnailViewer?.hasStructuralChanges()) {
|
if (this.pdfThumbnailViewer?.hasStructuralChanges()) {
|
||||||
|
this.externalServices.reportTelemetry({
|
||||||
|
type: "pageOrganization",
|
||||||
|
data: { action: "save" },
|
||||||
|
});
|
||||||
await this.onSavePages({
|
await this.onSavePages({
|
||||||
data: this.pdfThumbnailViewer.getStructuralChanges(),
|
data: this.pdfThumbnailViewer.getStructuralChanges(),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -709,6 +709,7 @@ class PDFThumbnailViewer {
|
|||||||
this.#toggleMenuEntries(false);
|
this.#toggleMenuEntries(false);
|
||||||
this.#updateStatus("select");
|
this.#updateStatus("select");
|
||||||
|
|
||||||
|
this.#reportTelemetry({ action: "move" });
|
||||||
this.eventBus.dispatch("pagesedited", {
|
this.eventBus.dispatch("pagesedited", {
|
||||||
source: this,
|
source: this,
|
||||||
pagesMapper,
|
pagesMapper,
|
||||||
@ -825,7 +826,18 @@ class PDFThumbnailViewer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#reportTelemetry(data) {
|
||||||
|
this.eventBus.dispatch("reporttelemetry", {
|
||||||
|
source: this,
|
||||||
|
details: {
|
||||||
|
type: "pageOrganization",
|
||||||
|
data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#saveExtractedPages() {
|
#saveExtractedPages() {
|
||||||
|
this.#reportTelemetry({ action: "exportSelected" });
|
||||||
this.eventBus.dispatch("saveextractedpages", {
|
this.eventBus.dispatch("saveextractedpages", {
|
||||||
source: this,
|
source: this,
|
||||||
data: this.#pagesMapper.extractPages(this.#selectedPages),
|
data: this.#pagesMapper.extractPages(this.#selectedPages),
|
||||||
@ -840,6 +852,7 @@ class PDFThumbnailViewer {
|
|||||||
// that clicking the "Done" button later only cancels the copy and does
|
// that clicking the "Done" button later only cancels the copy and does
|
||||||
// not accidentally restore a previous paste or delete.
|
// not accidentally restore a previous paste or delete.
|
||||||
this.#savedThumbnails = null;
|
this.#savedThumbnails = null;
|
||||||
|
this.#reportTelemetry({ action: "copy" });
|
||||||
}
|
}
|
||||||
this.#updateStatus(this.#isCut ? "cut" : "copy");
|
this.#updateStatus(this.#isCut ? "cut" : "copy");
|
||||||
const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(
|
const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(
|
||||||
@ -869,12 +882,14 @@ class PDFThumbnailViewer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.#reportTelemetry({ action: "cut" });
|
||||||
this.#isCut = true;
|
this.#isCut = true;
|
||||||
this.#copyPages(false);
|
this.#copyPages(false);
|
||||||
this.#deletePages(/* type = */ "cut");
|
this.#deletePages(/* type = */ "cut");
|
||||||
}
|
}
|
||||||
|
|
||||||
#pastePages(index) {
|
#pastePages(index) {
|
||||||
|
this.#reportTelemetry({ action: "paste" });
|
||||||
const pagesMapper = this.#pagesMapper;
|
const pagesMapper = this.#pagesMapper;
|
||||||
const currentPageNumber = this.#copiedPageNumbers.includes(
|
const currentPageNumber = this.#copiedPageNumbers.includes(
|
||||||
this._currentPageNumber
|
this._currentPageNumber
|
||||||
@ -907,6 +922,7 @@ class PDFThumbnailViewer {
|
|||||||
|
|
||||||
const selectedPages = this.#selectedPages;
|
const selectedPages = this.#selectedPages;
|
||||||
if (type === "delete") {
|
if (type === "delete") {
|
||||||
|
this.#reportTelemetry({ action: "delete" });
|
||||||
this.#updateStatus("delete");
|
this.#updateStatus("delete");
|
||||||
}
|
}
|
||||||
const pagesMapper = this.#pagesMapper;
|
const pagesMapper = this.#pagesMapper;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user