Merge pull request #15339 from Snuffleupagus/enable-editor

[api-major] Enable editing by default
This commit is contained in:
Jonas Jenwald 2022-09-13 15:57:54 +02:00 committed by GitHub
commit 5e5aa9fb69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 13 deletions

View File

@ -156,7 +156,13 @@
},
"annotationEditorMode": {
"type": "integer",
"default": -1
"enum": [
-1,
0,
3,
15
],
"default": 0
},
"enablePermissions": {
"type": "boolean",

View File

@ -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;
}
}

View File

@ -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: {

View File

@ -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 (

View File

@ -316,7 +316,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="verticalToolbarSeparator hiddenMediumView"></div>
<div id="editorModeButtons" class="splitToolbarButton toggled hidden" role="radiogroup">
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" tabindex="34" data-l10n-id="editor_free_text2">
<span data-l10n-id="editor_free_text2_label">Text</span>
</button>
@ -325,8 +325,7 @@ See https://github.com/adobe-type-tools/cmap-resources
</button>
</div>
<!-- Should be visible when the "editorModeButtons" are visible. -->
<div id="editorModeSeparator" class="verticalToolbarSeparator hidden"></div>
<div id="editorModeSeparator" class="verticalToolbarSeparator"></div>
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="48" data-l10n-id="tools" aria-expanded="false" aria-controls="secondaryToolbar">
<span data-l10n-id="tools_label">Tools</span>