feat: support gif toast (#3389)

This commit is contained in:
JimmFly
2023-07-27 13:37:18 +08:00
committed by GitHub
parent fa8086d525
commit bc27412425
5 changed files with 137 additions and 30 deletions
@@ -9,6 +9,7 @@ import {
ExportToPdfIcon,
ExportToPngIcon,
} from '@blocksuite/icons';
import { uuidv4 } from '@blocksuite/store';
import { useSetAtom } from 'jotai';
import { useCallback } from 'react';
@@ -36,7 +37,7 @@ export const ExportToPdfMenuItem = ({
.then(() => {
onSelect?.({ type: 'pdf' });
setPushNotification({
key: 'export-to-pdf',
key: uuidv4(),
title: t['com.affine.export.success.title'](),
message: t['com.affine.export.success.message'](),
type: 'success',
@@ -45,7 +46,7 @@ export const ExportToPdfMenuItem = ({
.catch(err => {
console.error(err);
setPushNotification({
key: 'export-to-pdf',
key: uuidv4(),
title: t['com.affine.export.error.title'](),
message: t['com.affine.export.error.message'](),
type: 'error',
@@ -59,7 +60,7 @@ export const ExportToPdfMenuItem = ({
.then(() => {
onSelect?.({ type: 'pdf' });
setPushNotification({
key: 'export-to-pdf',
key: uuidv4(),
title: t['com.affine.export.success.title'](),
message: t['com.affine.export.success.message'](),
type: 'success',
@@ -68,7 +69,7 @@ export const ExportToPdfMenuItem = ({
.catch(err => {
console.error(err);
setPushNotification({
key: 'export-to-pdf',
key: uuidv4(),
title: t['com.affine.export.error.title'](),
message: t['com.affine.export.error.message'](),
type: 'error',
@@ -104,7 +105,7 @@ export const ExportToHtmlMenuItem = ({
.then(() => {
onSelect?.({ type: 'html' });
setPushNotification({
key: 'export-to-html',
key: uuidv4(),
title: t['com.affine.export.success.title'](),
message: t['com.affine.export.success.message'](),
type: 'success',
@@ -112,6 +113,12 @@ export const ExportToHtmlMenuItem = ({
})
.catch(err => {
console.error(err);
setPushNotification({
key: uuidv4(),
title: t['com.affine.export.error.title'](),
message: t['com.affine.export.error.message'](),
type: 'error',
});
});
onSelect?.({ type: 'html' });
}, [currentEditor, onSelect, setPushNotification, t]);
@@ -146,7 +153,7 @@ export const ExportToPngMenuItem = ({
.then(() => {
onSelect?.({ type: 'png' });
setPushNotification({
key: 'export-to-png',
key: uuidv4(),
title: t['com.affine.export.success.title'](),
message: t['com.affine.export.success.message'](),
type: 'success',
@@ -155,7 +162,7 @@ export const ExportToPngMenuItem = ({
.catch(err => {
console.error(err);
setPushNotification({
key: 'export-to-png',
key: uuidv4(),
title: t['com.affine.export.error.title'](),
message: t['com.affine.export.error.message'](),
type: 'error',
@@ -192,7 +199,7 @@ export const ExportToMarkdownMenuItem = ({
.then(() => {
onSelect?.({ type: 'markdown' });
setPushNotification({
key: 'export-to-markdown',
key: uuidv4(),
title: t['com.affine.export.success.title'](),
message: t['com.affine.export.success.message'](),
type: 'success',
@@ -201,7 +208,7 @@ export const ExportToMarkdownMenuItem = ({
.catch(err => {
console.error(err);
setPushNotification({
key: 'export-to-markdown',
key: uuidv4(),
title: t['com.affine.export.error.title'](),
message: t['com.affine.export.error.message'](),
type: 'error',