diff --git a/extensions/chromium/preferences_schema.json b/extensions/chromium/preferences_schema.json index 798e32956..6716b4cbd 100644 --- a/extensions/chromium/preferences_schema.json +++ b/extensions/chromium/preferences_schema.json @@ -156,7 +156,13 @@ }, "annotationEditorMode": { "type": "integer", - "default": -1 + "enum": [ + -1, + 0, + 3, + 15 + ], + "default": 0 }, "enablePermissions": { "type": "boolean", diff --git a/web/app.js b/web/app.js index 880cb43d8..001fd50e3 100644 --- a/web/app.js +++ b/web/app.js @@ -585,11 +585,12 @@ const PDFViewerApplication = { appConfig.annotationEditorParams, eventBus ); + } else { for (const element of [ document.getElementById("editorModeButtons"), document.getElementById("editorModeSeparator"), ]) { - element.classList.remove("hidden"); + element.hidden = true; } } diff --git a/web/app_options.js b/web/app_options.js index a8c5d84ec..0f09c490b 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -54,11 +54,8 @@ const OptionKind = { */ const defaultOptions = { annotationEditorMode: { - /** @type {boolean} */ - value: - typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || TESTING") - ? 0 - : -1, + /** @type {number} */ + value: 0, kind: OptionKind.VIEWER + OptionKind.PREFERENCE, }, annotationMode: { diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index bbc40b51e..296d27cde 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -121,7 +121,7 @@ function isValidAnnotationEditorMode(mode) { * The default value is `AnnotationMode.ENABLE_FORMS`. * @property {number} [annotationEditorMode] - Enables the creation and editing * of new Annotations. The constants from {@link AnnotationEditorType} should - * be used. The default value is `AnnotationEditorType.DISABLE`. + * be used. The default value is `AnnotationEditorType.NONE`. * @property {string} [imageResourcesPath] - Path for image resources, mainly * mainly for annotation icons. Include trailing slash. * @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of @@ -219,7 +219,7 @@ class PDFPageViewBuffer { class PDFViewer { #buffer = null; - #annotationEditorMode = AnnotationEditorType.DISABLE; + #annotationEditorMode = AnnotationEditorType.NONE; #annotationEditorUIManager = null; @@ -277,7 +277,7 @@ class PDFViewer { this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS; this.#annotationEditorMode = - options.annotationEditorMode ?? AnnotationEditorType.DISABLE; + options.annotationEditorMode ?? AnnotationEditorType.NONE; this.imageResourcesPath = options.imageResourcesPath || ""; this.enablePrintAutoRotate = options.enablePrintAutoRotate || false; if ( diff --git a/web/viewer.html b/web/viewer.html index b58f80fd0..6ae10874d 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -316,7 +316,7 @@ See https://github.com/adobe-type-tools/cmap-resources
-