mirror of
https://github.com/Blah-IM/Weblah.git
synced 2025-07-16 18:52:39 +00:00
feat: basic rich text input & format
This commit is contained in:
parent
e386fe2583
commit
ca380e9ce6
8 changed files with 219 additions and 24 deletions
30
src/routes/(internal)/_rich-text/+page.svelte
Normal file
30
src/routes/(internal)/_rich-text/+page.svelte
Normal file
|
@ -0,0 +1,30 @@
|
|||
<script lang="ts">
|
||||
import RichTextInput from '$lib/components/RichTextInput.svelte';
|
||||
import { deltaToBlahRichText } from '$lib/richText';
|
||||
import type { Delta } from 'typewriter-editor';
|
||||
|
||||
let delta: Delta;
|
||||
|
||||
$: brt = delta ? deltaToBlahRichText(delta) : null;
|
||||
</script>
|
||||
|
||||
<RichTextInput bind:delta class="m-4 max-h-32">
|
||||
<p>A <strong>quick</strong> brown <em>fox</em> jumps over the lazy dog.</p>
|
||||
<p>A test engineer <a href="https://example.com">tests</a> the <code>RichTextInput</code>.</p>
|
||||
</RichTextInput>
|
||||
|
||||
<div class="flex min-h-0 flex-1 gap-4 p-4">
|
||||
<div class="flex min-h-0 flex-1 flex-col">
|
||||
<h2 class="text-lg">Delta (Editor's internal representation)</h2>
|
||||
<div class="min-h-0 flex-1 select-text overflow-auto">
|
||||
<pre><code>{JSON.stringify(delta, null, 2)}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 flex-1 flex-col">
|
||||
<h2 class="text-lg">Blah Rich Text</h2>
|
||||
<div class="min-h-0 flex-1 select-text overflow-auto">
|
||||
<pre><code>{JSON.stringify(brt, null, 2)}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue