aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/components
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-02-07 20:56:08 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-02-07 20:56:08 +0100
commit4feebe50430236a331b439c31af13d0d390be805 (patch)
tree70ea366cb9b2f105599a6ca5805e86737c9aed36 /web/pw-server/src/lib/components
parentd45699189ecafe30500fd7770a45b5043077f58b (diff)
downloadplanetwars.dev-4feebe50430236a331b439c31af13d0d390be805.tar.xz
planetwars.dev-4feebe50430236a331b439c31af13d0d390be805.zip
keep persistent EditorSession on demo page
Diffstat (limited to 'web/pw-server/src/lib/components')
-rw-r--r--web/pw-server/src/lib/components/Editor.svelte27
1 files changed, 27 insertions, 0 deletions
diff --git a/web/pw-server/src/lib/components/Editor.svelte b/web/pw-server/src/lib/components/Editor.svelte
new file mode 100644
index 0000000..5acbca5
--- /dev/null
+++ b/web/pw-server/src/lib/components/Editor.svelte
@@ -0,0 +1,27 @@
+<script lang="ts">
+ import type { Ace } from "ace-builds";
+ import ace from "ace-builds/src-noconflict/ace?client";
+ import * as aceGithubTheme from "ace-builds/src-noconflict/theme-github?client";
+
+ import { onMount } from "svelte";
+
+ export let editSession: Ace.EditSession;
+
+ let editorDiv: HTMLDivElement | undefined;
+ let editor: Ace.Editor | undefined;
+
+ onMount(async () => {
+ let renderer = new ace.VirtualRenderer(editorDiv);
+ editor = new ace.Editor(renderer, editSession);
+ editor.setTheme(aceGithubTheme);
+ });
+</script>
+
+<div bind:this={editorDiv} class="editor" />
+
+<style>
+ .editor {
+ width: 100%;
+ height: 100%;
+ }
+</style>