Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): disable page header title from dragging when editing (#9258)

pengx1774a168222c2a
diff --git a/packages/frontend/core/src/desktop/pages/workspace/detail-page/detail-page-header.tsx b/packages/frontend/core/src/desktop/pages/workspace/detail-page/detail-page-header.tsx
index 233f04eb50..c346dc38b3 100644
--- a/packages/frontend/core/src/desktop/pages/workspace/detail-page/detail-page-header.tsx
+++ b/packages/frontend/core/src/desktop/pages/workspace/detail-page/detail-page-header.tsx
@@ -189,6 +189,13 @@ export function DetailPageHeader(
id: page.id,
},
},
+ canDrag: args => {
+ // hack for preventing drag when editing the page title
+ const editingElement =
+ args.element.contains(document.activeElement) &&
+ document.activeElement?.tagName === 'INPUT';
+ return !editingElement;
+ },
onDragStart: () => {
track.$.header.$.dragStart();
},