[GENERIC viewer] Ensure that the we register the editorTypes for each AnnotationEditorUIManager-instance (issue 15564)

When a new PDF document is opened in the GENERIC viewer we (obviously) create a new `AnnotationEditorUIManager`-instance, since those are document-specific, and thus we need to ensure that we actually register the `editorTypes` for each one.
This commit is contained in:
Jonas Jenwald 2022-10-12 09:02:23 +02:00
parent 21c2d0c7b0
commit 00c3bc3aab
2 changed files with 5 additions and 2 deletions

View File

@ -69,9 +69,9 @@ class AnnotationEditorLayer {
AnnotationEditorLayer._initialized = true;
FreeTextEditor.initialize(options.l10n);
InkEditor.initialize(options.l10n);
options.uiManager.registerEditorTypes([FreeTextEditor, InkEditor]);
}
options.uiManager.registerEditorTypes([FreeTextEditor, InkEditor]);
this.#uiManager = options.uiManager;
this.annotationStorage = options.annotationStorage;
this.pageIndex = options.pageIndex;

View File

@ -637,6 +637,9 @@ class AnnotationEditorUIManager {
}
registerEditorTypes(types) {
if (this.#editorTypes) {
return;
}
this.#editorTypes = types;
for (const editorType of this.#editorTypes) {
this.#dispatchUpdateUI(editorType.defaultPropertiesToUpdate);