feat: add PlaygroundParser component to PlaygroundMenu
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
import { DataBase, setDatabase, type character } from "src/ts/storage/database";
|
import { DataBase, setDatabase, type character } from "src/ts/storage/database";
|
||||||
import PlaygroundImageGen from "./PlaygroundImageGen.svelte";
|
import PlaygroundImageGen from "./PlaygroundImageGen.svelte";
|
||||||
|
import PlaygroundParser from "./PlaygroundParser.svelte";
|
||||||
|
|
||||||
const playgroundChat = () => {
|
const playgroundChat = () => {
|
||||||
let db = get(DataBase)
|
let db = get(DataBase)
|
||||||
@@ -75,6 +76,11 @@
|
|||||||
}}>
|
}}>
|
||||||
<h1 class="text-2xl font-bold text-start">{language.imageGeneration}</h1>
|
<h1 class="text-2xl font-bold text-start">{language.imageGeneration}</h1>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="bg-darkbg rounded-md p-6 flex flex-col transition-shadow hover:ring-1" on:click={() => {
|
||||||
|
PlaygroundStore.set(8)
|
||||||
|
}}>
|
||||||
|
<h1 class="text-2xl font-bold text-start">Parser</h1>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
{#if $SizeStore.w < 1024}
|
{#if $SizeStore.w < 1024}
|
||||||
@@ -105,6 +111,9 @@
|
|||||||
{#if $PlaygroundStore === 7}
|
{#if $PlaygroundStore === 7}
|
||||||
<PlaygroundImageGen/>
|
<PlaygroundImageGen/>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if $PlaygroundStore === 8}
|
||||||
|
<PlaygroundParser/>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
23
src/lib/Playground/PlaygroundParser.svelte
Normal file
23
src/lib/Playground/PlaygroundParser.svelte
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { ParseMarkdown } from "src/ts/parser";
|
||||||
|
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
|
||||||
|
let input = "";
|
||||||
|
let output = "";
|
||||||
|
const onInput = async () => {
|
||||||
|
try {
|
||||||
|
output = await ParseMarkdown(input)
|
||||||
|
} catch (e) {
|
||||||
|
output = `Error: ${e}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h2 class="text-4xl text-textcolor my-6 font-black relative">Full Parser</h2>
|
||||||
|
|
||||||
|
<span class="text-textcolor text-lg">Input</span>
|
||||||
|
|
||||||
|
<TextAreaInput onInput={onInput} bind:value={input} optimaizedInput={false} />
|
||||||
|
|
||||||
|
<span class="text-textcolor text-lg">Output HTML</span>
|
||||||
|
|
||||||
|
<TextAreaInput value={output} />
|
||||||
Reference in New Issue
Block a user