For reference:
https://github.com/mozilla/pdf.js/issues/15571#issuecomment-1278141781
this.#uiManager.updateToolbar(mode);
  }
  /**
   * The mode has changed: it must be updated.
   * @param {number} mode
   */
  updateMode(mode = this.#uiManager.getMode()) {
    this.#cleanup();
    if (mode === AnnotationEditorType.INK) {
      
      this.addInkEditorIfNeeded(false);
      this.disableClick();
    } else {
      this.enableClick();
    }
    this.#uiManager.unselectAll();
    this.div.classList.toggle(
      "freeTextEditing",
      mode === AnnotationEditorType.FREETEXT
    );
    this.div.classList.toggle("inkEditing", mode === AnnotationEditorType.INK);
  }
  addInkEditorIfNeeded(isCommitting) {