first attempt with deleting rows. deep diff algorithm needs more time in the cooker

This commit is contained in:
Chris Kruining 2024-10-29 18:36:01 +01:00
parent 041de66c64
commit 6d1e011621
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
2 changed files with 33 additions and 2 deletions

View file

@ -146,6 +146,10 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
})();
});
createEffect(() => {
console.log(mutations());
});
const commands = {
close: createCommand('close folder', async () => {
filesContext.remove('__root__');
@ -183,7 +187,13 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
api()?.clear();
}),
delete: createCommand('delete selected items', () => {
console.log(api()?.selection())
const { selection, remove } = api() ?? {};
if (!selection || !remove) {
return;
}
remove(Object.keys(selection()));
}, { key: 'delete', modifier: Modifier.None }),
} as const;
@ -242,6 +252,8 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
}}>{file().name}</Context.Handle>;
},
] as const}</Tree>
<span>Total mutation: {mutations().length}</span>
</Sidebar>
<Tabs active={setActive} onClose={commands.closeTab}>