Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: bug where context menu options wouldn't work unless page was selcted

Arymane095a176832f
diff --git a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart
index 7375f6a113..019f674b01 100644
--- a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart
@@ -64,13 +64,17 @@ class ViewDisclosureButton extends StatelessWidget
class ViewDisclosureRegion extends StatelessWidget
with ActionList<ViewDisclosureActionWrapper>, FlowyOverlayDelegate {
final Widget child;
+ final Function() onTap;
final Function(dartz.Option<ViewDisclosureAction>) onSelected;
final _items = ViewDisclosureAction.values
.map((action) => ViewDisclosureActionWrapper(action))
.toList();
ViewDisclosureRegion(
- {Key? key, required this.onSelected, required this.child})
+ {Key? key,
+ required this.onSelected,
+ required this.onTap,
+ required this.child})
: super(key: key);
@override
@@ -96,6 +100,11 @@ class ViewDisclosureRegion extends StatelessWidget
);
};
+ @override
+ void didRemove() {
+ onSelected(dartz.none());
+ }
+
void _handleClick(PointerDownEvent event, BuildContext context) {
if (event.kind == PointerDeviceKind.mouse &&
event.buttons == kSecondaryMouseButton) {
@@ -103,6 +112,7 @@ class ViewDisclosureRegion extends StatelessWidget
Offset position = box.localToGlobal(Offset.zero);
double x = event.position.dx - position.dx - box.size.width;
double y = event.position.dy - position.dy - box.size.height;
+ onTap();
show(context, anchorOffset: Offset(x, y));
}
}
diff --git a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart
index 3ca8577d8c..bfc51f4bf9 100644
--- a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart
@@ -86,6 +86,8 @@ class ViewSectionItem extends StatelessWidget {
}
return ViewDisclosureRegion(
+ onTap: () =>
+ context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),
onSelected: (action) {
context.read<ViewBloc>().add(const ViewEvent.setIsEditing(false));
_handleAction(context, action);