Files
AFFiNE-Mirror/blocksuite/affine/widgets/drag-handle/src/watchers/page-watcher.ts
T
doouding 0be30f15ea fix: dnd not working in initial doc (#12519)
Fixes [BS-3152](https://linear.app/affine-design/issue/BS-3152/)

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

- **Bug Fixes**
  - Improved widget stability by removing the event listener that caused the widget to hide on block updates, leaving only viewport changes to trigger hiding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-26 11:25:15 +00:00

22 lines
489 B
TypeScript

import { PageViewportService } from '@blocksuite/affine-shared/services';
import type { AffineDragHandleWidget } from '../drag-handle.js';
export class PageWatcher {
get pageViewportService() {
return this.widget.std.get(PageViewportService);
}
constructor(readonly widget: AffineDragHandleWidget) {}
watch() {
const { disposables } = this.widget;
disposables.add(
this.pageViewportService.subscribe(() => {
this.widget.hide();
})
);
}
}