[Editor] Avoid to have a color picker for highlighting twice in the main toolbar

When opening a pdf from the secondary toolbar, a second color picker is added.
So in order to avoid that, we just stop listening for annotationeditoruimanager
in the toolbar.
This commit is contained in:
Calixte Denizet 2023-12-06 16:10:29 +01:00
parent 8702e1bbb2
commit cb9c855993

View File

@ -121,12 +121,17 @@ class Toolbar {
this.#bindListeners(options); this.#bindListeners(options);
if (options.editorHighlightColorPicker) { if (options.editorHighlightColorPicker) {
this.eventBus._on("annotationeditoruimanager", ({ uiManager }) => { this.eventBus._on(
this.#setAnnotationEditorUIManager( "annotationeditoruimanager",
uiManager, ({ uiManager }) => {
options.editorHighlightColorPicker this.#setAnnotationEditorUIManager(
); uiManager,
}); options.editorHighlightColorPicker
);
},
// Once the color picker has been added, we don't want to add it again.
{ once: true }
);
} }
this.reset(); this.reset();