feat: enable creating items on the same level
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-16 10:10:11 +02:00
parent 832587b51d
commit 65c2466f97
5 changed files with 46 additions and 0 deletions

View File

@@ -274,6 +274,25 @@ impl<'a> GraphExplorer<'a> {
batch.with(cmd.into_command());
}
}
Commands::CreateBelow { name } => {
if !name.is_empty() {
let path = self.get_current_path();
if let Some((_, path)) = path.split_last() {
let mut path = path.to_vec();
path.push(name.replace(".", " "));
let cmd = self.state.create_item_command().command(
&self.inner.root,
&path.iter().map(|i| i.as_str()).collect_vec(),
name,
"",
&hyperlog_core::log::ItemState::default(),
);
batch.with(cmd.into_command());
}
}
}
Commands::Edit => {
if let Some(item) = self.get_current_item() {
let path = self.get_current_path();