impr: add option to pass modal show settings through the show commandline function

This commit is contained in:
Miodec 2024-03-07 21:15:18 +01:00
parent 41cb95b43e
commit 40aa1e61f8
2 changed files with 7 additions and 3 deletions

View file

@ -4,7 +4,7 @@ import Config from "../config";
import * as AnalyticsController from "../controllers/analytics-controller";
import * as ThemeController from "../controllers/theme-controller";
import { clearFontPreview } from "../ui";
import AnimatedModal from "../popups/animated-modal";
import AnimatedModal, { ShowHideOptions } from "../popups/animated-modal";
import * as Notifications from "../elements/notifications";
type CommandlineMode = "search" | "input";
@ -49,8 +49,12 @@ type ShowSettings = {
singleListOverride?: boolean;
};
export function show(settings?: ShowSettings): void {
export function show(
settings?: ShowSettings,
modalShowSettings?: ShowHideOptions
): void {
void modal.show({
...modalShowSettings,
beforeAnimation: async (modal) => {
mouseMode = false;
inputValue = "";

View file

@ -18,7 +18,7 @@ type ConstructorCustomAnimations = {
hide?: CustomWrapperAndModalAnimations;
};
type ShowHideOptions = {
export type ShowHideOptions = {
animationMode?: "none" | "both" | "modalOnly";
customAnimation?: CustomWrapperAndModalAnimations;
beforeAnimation?: (modal: HTMLElement) => Promise<void>;