This commit is contained in:
Chris Kruining 2025-02-13 17:18:03 +11:00
parent 69fd9a1753
commit 8e0eee5847
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
8 changed files with 220 additions and 70 deletions

View file

@ -15,6 +15,7 @@ import { writeClipboard } from "@solid-primitives/clipboard";
import { destructure } from "@solid-primitives/destructure";
import css from "./edit.module.css";
import { contentsOf } from "~/features/file/helpers";
import { createHtmlParser, createMarkdownParser, createSource } from "~/features/source";
const isInstalledPWA = !isServer && window.matchMedia('(display-mode: standalone)').matches;
@ -389,17 +390,52 @@ const Content: Component<{ directory: FileSystemDirectoryHandle, api?: Setter<Gr
const copyKey = createCommand('page.edit.command.copyKey', (key: string) => writeClipboard(key));
return <Grid rows={rows()} locales={locales()} api={setApi}>{
key => {
return <Context.Root commands={[copyKey.with(key)]}>
<Context.Menu>{
command => <Command.Handle command={command} />
}</Context.Menu>
const tempVal = `
# Header
<Context.Handle>{key.split('.').at(-1)!}</Context.Handle>
</Context.Root>;
}
}</Grid>;
this is **a string** that contains bolded text
this is *a string* that contains italicized text
> Dorothy followed her through many of the beautiful rooms in her castle.
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
> *Everything* is going according to **plan**.
- First item
- Second item
- Third item
- Fourth item
`;
const { out: [html, update] } = createSource(createMarkdownParser(), createHtmlParser(), tempVal);
createEffect(() => {
console.log(html());
});
return <>
<div contentEditable innerHTML={html()} />
<Grid rows={rows()} locales={locales()} api={setApi}>{
key => {
return <Context.Root commands={[copyKey.with(key)]}>
<Context.Menu>{
command => <Command.Handle command={command} />
}</Context.Menu>
<Context.Handle>{key.split('.').at(-1)!}</Context.Handle>
</Context.Root>;
}
}</Grid>
</>;
};
const Blank: Component<{ open: CommandType }> = (props) => {