chore(ts): get rid of bootstrap related ts-ignores

This commit is contained in:
Panagiotis Papadopoulos 2025-02-12 08:28:29 +01:00
parent 3c83112240
commit cf11be7f35
2 changed files with 5 additions and 9 deletions

View File

@ -1,4 +1,5 @@
import dayjs from "dayjs";
import { Modal } from "bootstrap";
function reloadFrontendApp(reason?: string) {
if (reason) {
@ -244,9 +245,7 @@ function getMimeTypeClass(mime: string) {
function closeActiveDialog() {
if (glob.activeDialog) {
// TODO: Fix once we use proper ES imports.
//@ts-ignore
bootstrap.Modal.getOrCreateInstance(glob.activeDialog[0]).hide();
Modal.getOrCreateInstance(glob.activeDialog[0]).hide();
glob.activeDialog = null;
}
}
@ -288,9 +287,7 @@ async function openDialog($dialog: JQuery<HTMLElement>, closeActDialog = true) {
}
saveFocusedElement();
// TODO: Fix once we use proper ES imports.
//@ts-ignore
bootstrap.Modal.getOrCreateInstance($dialog[0]).show();
Modal.getOrCreateInstance($dialog[0]).show();
$dialog.on("hidden.bs.modal", () => {
const $autocompleteEl = $(".aa-input");

View File

@ -3,6 +3,7 @@ import NoteContextAwareWidget from "./note_context_aware_widget.js";
import { t } from "../services/i18n.js";
import type FNote from "../entities/fnote.js";
import type { EventData } from "../components/app_context.js";
import { Dropdown } from "bootstrap";
type Editability = "auto" | "readOnly" | "autoReadOnlyDisabled";
@ -65,9 +66,7 @@ export default class EditabilitySelectWidget extends NoteContextAwareWidget {
doRender() {
this.$widget = $(TPL);
// TODO: Remove once bootstrap is added to webpack.
//@ts-ignore
this.dropdown = bootstrap.Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']"));
this.dropdown = Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")[0]);
this.$editabilityActiveDesc = this.$widget.find(".editability-active-desc");