From ec6901fa9b3eee3256cf0baeabe49e3f2926a7a9 Mon Sep 17 00:00:00 2001 From: feored Date: Tue, 24 Sep 2024 19:08:07 +0200 Subject: [PATCH] try wysiwyg editor --- src/lib/editor.svelte | 111 ++++++++++++++++++++++++++++++++++++++++ src/lib/format.ts | 7 ++- src/routes/+page.svelte | 34 ++++++------ 3 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 src/lib/editor.svelte diff --git a/src/lib/editor.svelte b/src/lib/editor.svelte new file mode 100644 index 0000000..bf32b64 --- /dev/null +++ b/src/lib/editor.svelte @@ -0,0 +1,111 @@ + + +
+
+
+
{ + event.preventDefault(); + on_input(event); + }} + > + {#each tm_data as block} + + {block.text} + + {/each} +
+ + +
+ + diff --git a/src/lib/format.ts b/src/lib/format.ts index 3bde089..52c2397 100644 --- a/src/lib/format.ts +++ b/src/lib/format.ts @@ -25,7 +25,12 @@ export type TextDetails = { width: "narrow" | "wide" | "normal", } -const DEFAULT_TEXT_DETAILS: TextDetails = { +export type TMText = { + style: TextDetails, + text: string, +} + +export const DEFAULT_TEXT_DETAILS: TextDetails = { color: "#fff", bold: false, italic: false, diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 334e2fe..93acf97 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,28 +1,30 @@
-

Trackmania Formatting Tool

+ + +