Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: add autofill and onClose params in notification service api (#7162)

akumatus38dde7f5b7b8
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
index a9c36ad7d8..482c98f3d0 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
@@ -169,14 +169,19 @@ export function patchNotificationService(
confirmText,
placeholder,
cancelText,
+ autofill,
abort,
}) => {
return new Promise<string | null>(resolve => {
- let value = '';
+ let value = autofill || '';
const description = (
<div>
<span style={{ marginBottom: 12 }}>{toReactNode(message)}</span>
- <Input placeholder={placeholder} onChange={e => (value = e)} />
+ <Input
+ placeholder={placeholder}
+ defaultValue={value}
+ onChange={e => (value = e)}
+ />
</div>
);
openConfirmModal({
@@ -189,7 +194,6 @@ export function patchNotificationService(
cancelButtonOptions: {
children: cancelText ?? 'Cancel',
},
-
onConfirm: () => {
resolve(value);
},
@@ -229,9 +233,12 @@ export function patchNotificationService(
onClick: notification.action.onClick,
}
: undefined,
+ onDismiss: notification.onClose,
},
{
duration: notification.duration || 0,
+ onDismiss: notification.onClose,
+ onAutoClose: notification.onClose,
}
);