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