mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
fix(editor): remove pointer event handlers in root block (#9802)
This commit is contained in:
@@ -50,15 +50,4 @@ export abstract class RootService extends BlockService {
|
||||
const viewportElement = rootComponent.viewportElement;
|
||||
return viewportElement;
|
||||
}
|
||||
|
||||
override mounted() {
|
||||
super.mounted();
|
||||
|
||||
this.disposables.add(
|
||||
this.std.event.add('pointerDown', ctx => {
|
||||
const state = ctx.get('pointerState');
|
||||
state.raw.stopPropagation();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,40 +200,6 @@ export class AffinePageDraggingAreaWidget extends WidgetComponent<
|
||||
override connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.handleEvent(
|
||||
'pointerDown',
|
||||
ctx => {
|
||||
const container = this.block.rootElementContainer;
|
||||
if (!container) return;
|
||||
|
||||
const currentFocus = document.activeElement;
|
||||
if (!container.contains(currentFocus)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const containerRect = container.getBoundingClientRect();
|
||||
const containerStyles = window.getComputedStyle(container);
|
||||
const paddingLeft = parseFloat(containerStyles.paddingLeft);
|
||||
const paddingRight = parseFloat(containerStyles.paddingRight);
|
||||
const state = ctx.get('pointerState');
|
||||
const raw = state.raw;
|
||||
|
||||
if (
|
||||
raw.clientX > containerRect.left + paddingLeft &&
|
||||
raw.clientX < containerRect.right - paddingRight &&
|
||||
raw.clientY > containerRect.top &&
|
||||
raw.clientY < containerRect.bottom
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.raw.preventDefault();
|
||||
},
|
||||
{
|
||||
global: true,
|
||||
}
|
||||
);
|
||||
|
||||
this.handleEvent(
|
||||
'dragStart',
|
||||
ctx => {
|
||||
|
||||
Reference in New Issue
Block a user