mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +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;
|
const viewportElement = rootComponent.viewportElement;
|
||||||
return 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() {
|
override connectedCallback() {
|
||||||
super.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(
|
this.handleEvent(
|
||||||
'dragStart',
|
'dragStart',
|
||||||
ctx => {
|
ctx => {
|
||||||
|
|||||||
Reference in New Issue
Block a user