clean up test context menu
This commit is contained in:
parent
7b044c6050
commit
caa35c92e9
1 changed files with 5 additions and 11 deletions
|
@ -66,11 +66,9 @@ export default function Edit(props: ParentProps) {
|
||||||
filesContext.open(directory);
|
filesContext.open(directory);
|
||||||
}, { key: 'o', modifier: Modifier.Control });
|
}, { key: 'o', modifier: Modifier.Control });
|
||||||
|
|
||||||
return <Context.Root commands={[open]}>
|
return <Show when={filesContext.root()} fallback={<Blank open={open} />}>{
|
||||||
<Show when={filesContext.root()} fallback={<Blank open={open} />}>{
|
root => <Editor root={root()} />
|
||||||
root => <Editor root={root()} />
|
}</Show>;
|
||||||
}</Show>
|
|
||||||
</Context.Root>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
|
@ -316,10 +314,6 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
return <div class={css.root}>
|
return <div class={css.root}>
|
||||||
<Command.Add commands={[commands.saveAs, commands.closeTab]} />
|
<Command.Add commands={[commands.saveAs, commands.closeTab]} />
|
||||||
|
|
||||||
<Context.Menu>{
|
|
||||||
command => <Command.Handle command={command} />
|
|
||||||
}</Context.Menu>
|
|
||||||
|
|
||||||
<Menu.Root>
|
<Menu.Root>
|
||||||
<Menu.Item label={t('page.edit.menu.file')}>
|
<Menu.Item label={t('page.edit.menu.file')}>
|
||||||
<Menu.Item command={commands.open} />
|
<Menu.Item command={commands.open} />
|
||||||
|
@ -366,11 +360,11 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
file => {
|
file => {
|
||||||
const mutated = createMemo(() => mutatedFiles().values().find(({ id }) => id === file().id) !== undefined);
|
const mutated = createMemo(() => mutatedFiles().values().find(({ id }) => id === file().id) !== undefined);
|
||||||
|
|
||||||
return <Context.Handle class={`${mutated() ? css.mutated : ''}`} onDblClick={() => {
|
return <span class={`${mutated() ? css.mutated : ''}`} onDblClick={() => {
|
||||||
const folder = file().directory;
|
const folder = file().directory;
|
||||||
filesContext?.set(folder.name, folder);
|
filesContext?.set(folder.name, folder);
|
||||||
setActive(folder.name);
|
setActive(folder.name);
|
||||||
}}>{file().name}</Context.Handle>;
|
}}>{file().name}</span>;
|
||||||
},
|
},
|
||||||
] as const}</Tree>
|
] as const}</Tree>
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue