mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
refactor(editor): remove assert functions (#10629)
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import type { ToastOptions } from '@affine/component';
|
||||
import { toast as basicToast } from '@affine/component';
|
||||
import { assertEquals } from '@blocksuite/affine/global/utils';
|
||||
|
||||
export const toast = (message: string, options?: ToastOptions) => {
|
||||
const modal = document.querySelector(
|
||||
'[role=presentation]'
|
||||
) as HTMLDivElement | null;
|
||||
if (modal) {
|
||||
assertEquals(modal.constructor, HTMLDivElement, 'modal should be div');
|
||||
const modal = document.querySelector<HTMLDivElement>('[role=presentation]');
|
||||
if (modal && !(modal instanceof HTMLDivElement)) {
|
||||
throw new Error('modal should be div');
|
||||
}
|
||||
return basicToast(message, {
|
||||
portal: modal || document.body,
|
||||
|
||||
Reference in New Issue
Block a user