1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[Editor] Add an option to use the new 'add an image' flow (bug 1907207)

UX team designed in a new flow we'll implement soon and we want to be able to
make an experiment to be able to compare current flow vs the new one.
This commit is contained in:
Calixte Denizet 2024-07-12 10:49:36 +02:00
parent 2d254375a8
commit dfccc8ffd9
5 changed files with 25 additions and 0 deletions

View file

@ -477,6 +477,7 @@ const PDFViewerApplication = {
enableHighlightFloatingButton: AppOptions.get(
"enableHighlightFloatingButton"
),
enableUpdatedAddImage: AppOptions.get("enableUpdatedAddImage"),
imageResourcesPath: AppOptions.get("imageResourcesPath"),
enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"),
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),

View file

@ -178,6 +178,14 @@ const defaultOptions = {
value: typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME"),
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
},
enableUpdatedAddImage: {
// We'll probably want to make some experiments before enabling this
// in Firefox release, but it has to be temporary.
// TODO: remove it when unnecessary.
/** @type {boolean} */
value: false,
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
},
externalLinkRel: {
/** @type {string} */
value: "noopener noreferrer nofollow",

View file

@ -219,6 +219,8 @@ class PDFViewer {
#enablePermissions = false;
#enableUpdatedAddImage = false;
#eventAbortController = null;
#mlManager = null;
@ -291,6 +293,7 @@ class PDFViewer {
options.annotationEditorHighlightColors || null;
this.#enableHighlightFloatingButton =
options.enableHighlightFloatingButton === true;
this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true;
this.imageResourcesPath = options.imageResourcesPath || "";
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
@ -890,6 +893,7 @@ class PDFViewer {
pageColors,
this.#annotationEditorHighlightColors,
this.#enableHighlightFloatingButton,
this.#enableUpdatedAddImage,
this.#mlManager
);
eventBus.dispatch("annotationeditoruimanager", {