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: remove default group for checkbox

appflowy0c45e3ce955e
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/board_page.dart b/frontend/app_flowy/lib/plugins/board/presentation/board_page.dart
index b5005d0c74..1a632b5e35 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/board_page.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/board_page.dart
@@ -83,6 +83,7 @@ class _BoardContentState extends State<BoardContent> {
buildWhen: (previous, current) => previous.groupIds != current.groupIds,
builder: (context, state) {
final column = Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [const _ToolbarBlocAdaptor(), _buildBoard(context)],
);
diff --git a/frontend/rust-lib/flowy-grid/src/services/group/action.rs b/frontend/rust-lib/flowy-grid/src/services/group/action.rs
index b339722905..fc92b68c46 100644
--- a/frontend/rust-lib/flowy-grid/src/services/group/action.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/group/action.rs
@@ -8,7 +8,9 @@ pub trait GroupAction: Send + Sync {
fn default_cell_rev(&self) -> Option<CellRevision> {
None
}
-
+ fn use_default_group(&self) -> bool {
+ true
+ }
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool;
fn add_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
fn remove_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
diff --git a/frontend/rust-lib/flowy-grid/src/services/group/configuration.rs b/frontend/rust-lib/flowy-grid/src/services/group/configuration.rs
index c110d01ad4..1518240442 100644
--- a/frontend/rust-lib/flowy-grid/src/services/group/configuration.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/group/configuration.rs
@@ -97,11 +97,8 @@ where
self.groups_map.values().collect()
}
- /// Returns the all the groups that contain the default group.
- pub(crate) fn clone_groups(&self) -> Vec<Group> {
- let mut groups: Vec<Group> = self.groups_map.values().cloned().collect();
- groups.push(self.default_group.clone());
- groups
+ pub(crate) fn default_group(&self) -> &Group {
+ &self.default_group
}
/// Iterate mut the groups. The default group will be the last one that get mutated.
diff --git a/frontend/rust-lib/flowy-grid/src/services/group/controller.rs b/frontend/rust-lib/flowy-grid/src/services/group/controller.rs
index 4e8c47f89a..7bdbb57368 100644
--- a/frontend/rust-lib/flowy-grid/src/services/group/controller.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/group/controller.rs
@@ -182,7 +182,13 @@ where
}
fn groups(&self) -> Vec<Group> {
- self.group_ctx.clone_groups()
+ if self.use_default_group() {
+ let mut groups: Vec<Group> = self.group_ctx.concrete_groups().into_iter().cloned().collect();
+ groups.push(self.group_ctx.default_group().clone());
+ groups
+ } else {
+ self.group_ctx.concrete_groups().into_iter().cloned().collect()
+ }
}
fn get_group(&self, group_id: &str) -> Option<(usize, Group)> {
diff --git a/frontend/rust-lib/flowy-grid/src/services/group/controller_impls/checkbox_controller.rs b/frontend/rust-lib/flowy-grid/src/services/group/controller_impls/checkbox_controller.rs
index c95a6e4af2..62f21d708b 100644
--- a/frontend/rust-lib/flowy-grid/src/services/group/controller_impls/checkbox_controller.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/group/controller_impls/checkbox_controller.rs
@@ -27,6 +27,10 @@ impl GroupAction for CheckboxGroupController {
Some(CellRevision::new(UNCHECK.to_string()))
}
+ fn use_default_group(&self) -> bool {
+ false
+ }
+
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool {
if cell_data.is_check() {
content == CHECK