[editor] Disable the editor-buttons in XFA documents

Given the differences between XFA documents and "normal" PDF documents, we don't support editing of the former ones. Hence, when a XFA-document is opened, we temporarily disable the editor-buttons.
This commit is contained in:
Jonas Jenwald 2022-06-05 10:00:08 +02:00
parent 9b22483e00
commit d34e7fff01
6 changed files with 37 additions and 15 deletions

View file

@ -97,6 +97,8 @@ class Toolbar {
next: options.next,
zoomIn: options.zoomIn,
zoomOut: options.zoomOut,
editorNoneButton: options.editorNoneButton,
editorFreeTextButton: options.editorFreeTextButton,
};
this._wasLocalized = false;
@ -133,6 +135,7 @@ class Toolbar {
this.pageScale = DEFAULT_SCALE;
this._updateUIState(true);
this.updateLoadingIndicatorState();
this.updateEditorModeButtonsState();
}
_bindListeners(options) {
@ -267,9 +270,16 @@ class Toolbar {
}
updateLoadingIndicatorState(loading = false) {
const pageNumberInput = this.items.pageNumber;
const { pageNumber } = this.items;
pageNumberInput.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);
pageNumber.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);
}
updateEditorModeButtonsState(disabled = false) {
const { editorNoneButton, editorFreeTextButton } = this.items;
editorNoneButton.disabled = disabled;
editorFreeTextButton.disabled = disabled;
}
/**