mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 07:06:28 +08:00
866408015e
Co-authored-by: Alex Yang <himself65@outlook.com>
22 lines
540 B
TypeScript
22 lines
540 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(
|
|
'[plugin-id="@affine/image-preview-plugin"]'
|
|
) as HTMLElement;
|
|
return basicToast(message, {
|
|
portal: mainContainer || document.body,
|
|
...options,
|
|
});
|
|
};
|
|
|
|
declare global {
|
|
// global Events
|
|
interface WindowEventMap {
|
|
'affine-toast:emit': CustomEvent<{
|
|
message: string;
|
|
}>;
|
|
}
|
|
}
|