mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-03 02:20:19 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
function escapeHtml(html: string) {
|
||||
const div = document.createElement('div');
|
||||
div.textContent = html;
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
// Custom function to emit toast notifications
|
||||
export function notify(
|
||||
message: string,
|
||||
variant: 'primary' | 'success' | 'neutral' | 'warning' | 'danger' = 'primary',
|
||||
icon = 'info-circle',
|
||||
duration = 2000
|
||||
) {
|
||||
const alert = Object.assign(document.createElement('sl-alert'), {
|
||||
variant,
|
||||
closable: true,
|
||||
duration: duration,
|
||||
innerHTML: `
|
||||
<sl-icon name="${icon}" slot="icon"></sl-icon>
|
||||
${escapeHtml(message)}
|
||||
`,
|
||||
});
|
||||
|
||||
document.body.append(alert);
|
||||
return alert.toast();
|
||||
}
|
||||
Reference in New Issue
Block a user