mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-05 03:25:10 +08:00
22 lines
513 B
TypeScript
22 lines
513 B
TypeScript
import type { ToastOptions } from '@affine/component';
|
|
import { toast as basicToast } from '@affine/component';
|
|
|
|
export const toast = (message: string, options?: ToastOptions) => {
|
|
const mainContainer = document.querySelector(
|
|
'.main-container'
|
|
) as HTMLElement;
|
|
return basicToast(message, {
|
|
portal: mainContainer || document.body,
|
|
...options,
|
|
});
|
|
};
|
|
|
|
declare global {
|
|
// global Events
|
|
interface WindowEventMap {
|
|
'affine-toast:emit': CustomEvent<{
|
|
message: string;
|
|
}>;
|
|
}
|
|
}
|