New Code Editor and fun

This commit is contained in:
2023-12-03 19:31:29 +01:00
parent 2abe554059
commit fbd52f3edb
53 changed files with 1330 additions and 489 deletions

View File

@@ -0,0 +1,37 @@
<script lang="ts">
import {onDestroy, onMount} from "svelte";
import EasyMDE from "easymde";
import "easymde/dist/easymde.min.css"
export let value: string;
let editor: HTMLTextAreaElement;
let mde: EasyMDE;
onMount(() => {
mde = new EasyMDE({
element: editor,
initialValue: value,
spellChecker: false,
})
mde.codemirror.on("change", () => {
value = mde.value();
})
})
onDestroy(() => {
mde.toTextArea();
mde.cleanup();
})
</script>
<textarea bind:this={editor} class="editor-preview">
</textarea>
<style>
:global(.editor-preview) {
& * {
all: revert;
color: black;
}
}
</style>