L-Sun
2025-04-23 05:41:14 +00:00
parent 9b2cf5cafa
commit 27ff9ab9f4
21 changed files with 304 additions and 339 deletions
@@ -109,12 +109,15 @@ export function copyAsImage(std: BlockStdScope) {
notify.error({
title: I18n.t('com.affine.copy.asImage.notAvailable.title'),
message: I18n.t('com.affine.copy.asImage.notAvailable.message'),
action: {
label: I18n.t('com.affine.copy.asImage.notAvailable.action'),
onClick: () => {
window.open('https://affine.pro/download');
actions: [
{
key: 'download',
label: I18n.t('com.affine.copy.asImage.notAvailable.action'),
onClick: () => {
window.open('https://affine.pro/download');
},
},
},
],
});
return;
}
@@ -1,5 +1,6 @@
import {
Input,
type Notification,
notify,
toast,
type ToastOptions,
@@ -96,17 +97,25 @@ export function patchNotificationService({
throw new Error('Invalid notification accent');
}
const toAffineNotificationActions = (
actions: (typeof notification)['actions']
): Notification['actions'] => {
if (!actions) return undefined;
return actions.map(({ label, onClick, key }) => {
return {
key,
label: toReactNode(label),
onClick,
};
});
};
const toastId = fn(
{
title: toReactNode(notification.title),
message: toReactNode(notification.message),
footer: toReactNode(notification.footer),
action: notification.action?.onClick
? {
label: toReactNode(notification.action?.label),
onClick: notification.action.onClick,
}
: undefined,
actions: toAffineNotificationActions(notification.actions),
onDismiss: notification.onClose,
},
{