mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #15264 from calixteman/editing_telemetry
[Editor] Add some telemetry to know how often the editing features are used (bug 1782254)
This commit is contained in:
commit
4f6cd05a53
4 changed files with 45 additions and 0 deletions
|
@ -31,6 +31,7 @@ class AnnotationStorage {
|
|||
// can have undesirable effects.
|
||||
this.onSetModified = null;
|
||||
this.onResetModified = null;
|
||||
this.onAnnotationEditor = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,6 +101,13 @@ class AnnotationStorage {
|
|||
if (modified) {
|
||||
this.#setModified();
|
||||
}
|
||||
|
||||
if (
|
||||
value instanceof AnnotationEditor &&
|
||||
typeof this.onAnnotationEditor === "function"
|
||||
) {
|
||||
this.onAnnotationEditor(value.constructor._type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,6 +172,15 @@ class AnnotationStorage {
|
|||
return clone;
|
||||
}
|
||||
|
||||
get hasAnnotationEditors() {
|
||||
for (const value of this._storage.values()) {
|
||||
if (value instanceof AnnotationEditor) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* PLEASE NOTE: Only intended for usage within the API itself.
|
||||
* @ignore
|
||||
|
|
|
@ -63,6 +63,8 @@ class FreeTextEditor extends AnnotationEditor {
|
|||
],
|
||||
]);
|
||||
|
||||
static _type = "freetext";
|
||||
|
||||
constructor(params) {
|
||||
super({ ...params, name: "freeTextEditor" });
|
||||
this.#color =
|
||||
|
|
|
@ -67,6 +67,8 @@ class InkEditor extends AnnotationEditor {
|
|||
|
||||
static _l10nPromise;
|
||||
|
||||
static _type = "ink";
|
||||
|
||||
constructor(params) {
|
||||
super({ ...params, name: "inkEditor" });
|
||||
this.color = params.color || null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue