aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/components/EditorView.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'web/pw-server/src/lib/components/EditorView.svelte')
-rw-r--r--web/pw-server/src/lib/components/EditorView.svelte31
1 files changed, 31 insertions, 0 deletions
diff --git a/web/pw-server/src/lib/components/EditorView.svelte b/web/pw-server/src/lib/components/EditorView.svelte
new file mode 100644
index 0000000..c0dd109
--- /dev/null
+++ b/web/pw-server/src/lib/components/EditorView.svelte
@@ -0,0 +1,31 @@
+<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(() => {
+ let renderer = new ace.VirtualRenderer(editorDiv);
+ editor = new ace.Editor(renderer, editSession);
+ editor.setTheme(aceGithubTheme);
+ });
+
+ $: if (editor !== undefined) {
+ editor.setSession(editSession);
+ }
+</script>
+
+<div bind:this={editorDiv} class="editor" />
+
+<style>
+ .editor {
+ width: 100%;
+ height: 100%;
+ }
+</style>