blob: 5acbca5900f52981eacf7c392eaa04dbde687a66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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>
|