chore(editor): adjust notification of database editing (#13484)

#### PR Dependency Tree


* **PR #13484** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- Bug Fixes
- Reduced repeated mobile editing notifications; the notice now appears
once and only reappears after you dismiss it.
- More consistent notification behavior on mobile for a less disruptive
editing experience.

- Refactor
- Streamlined internal event handling to improve reliability and reduce
potential listener leaks, resulting in smoother interactions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-08-13 14:33:38 +08:00
committed by GitHub
parent a0c22b7d06
commit 5c73fc9767

View File

@@ -372,6 +372,7 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent<DatabaseBloc
handleMobileEditing() {
if (!IS_MOBILE) return;
let notifyClosed = true;
const handler = () => {
if (
!this.std
@@ -379,7 +380,8 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent<DatabaseBloc
.getFlag('enable_mobile_database_editing')
) {
const notification = this.std.getOptional(NotificationProvider);
if (notification) {
if (notification && notifyClosed) {
notifyClosed = false;
notification.notify({
title: html`<div
style=${styleMap({
@@ -390,16 +392,15 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent<DatabaseBloc
experimental features, or edit it in desktop mode.
</div>`,
accent: 'warning',
onClose: () => {
notifyClosed = true;
},
});
}
this.removeEventListener('click', handler);
}
};
this.addEventListener('click', handler);
this.disposables.add(() => {
this.removeEventListener('click', handler);
});
this.disposables.addFromEvent(this, 'click', handler);
}
private readonly dataViewRootLogic = lazy(