refactor: image preview plugin (#3457)

This commit is contained in:
Alex Yang
2023-07-29 00:18:28 -07:00
committed by GitHub
parent be3909370e
commit 52809a2783
18 changed files with 129 additions and 45 deletions
@@ -0,0 +1,21 @@
import type { ToastOptions } from '@affine/component';
import { toast as basicToast } from '@affine/component';
export const toast = (message: string, options?: ToastOptions) => {
const mainContainer = document.querySelector(
'[data-testid="image-preview-modal"]'
) as HTMLElement;
return basicToast(message, {
portal: mainContainer || document.body,
...options,
});
};
declare global {
// global Events
interface WindowEventMap {
'affine-toast:emit': CustomEvent<{
message: string;
}>;
}
}