Skip to content

Commit f970b28

Browse files
author
3aa49ec6bfc910647fa1c5a013e48eef
committed
Refactor code in +page.svelte
1 parent 37a21a7 commit f970b28

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

website/src/routes/editConfig/[configName]/+page.svelte

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { onMount } from 'svelte';
33
import type { Readable } from 'svelte/store';
44
import { createEditor, Editor, EditorContent } from 'svelte-tiptap';
5-
import StarterKit from '@tiptap/starter-kit';
5+
import StarterKit from '@tiptap/starter-kit';
66
import { page } from '$app/stores';
77
88
let isLoading = true;
@@ -28,7 +28,7 @@
2828
2929
const save = () => {
3030
console.log($editor);
31-
console.log($editor?.getHTML());
31+
console.log($editor?.getHTML());
3232
};
3333
3434
const revert = () => {
@@ -43,21 +43,18 @@
4343
4444
onMount(async () => {
4545
console.log('onMount');
46-
let configContent = await getConfig(configName)
46+
let configContent = await getConfig(configName);
4747
editor = createEditor({
4848
extensions: [StarterKit],
4949
content: configContent
5050
});
5151
});
5252
</script>
5353

54-
<div class="p-2 whitespace-pre-wrap">
55-
<!-- {#if html !== 'Loading content...'} -->
56-
<EditorContent editor={$editor} />
57-
<!-- {:else} -->
58-
<!-- <p>Loading config...</p> -->
59-
<!-- {/if} -->
60-
54+
<div class="p-2">
55+
<div class="border border-gray-200 p-2 text-sm">
56+
<EditorContent editor={$editor} />
57+
</div>
6158
<button class="mt-2 mr-2" on:click={save}>Save</button>
6259
<button class="mt-2 bg-gray-500" on:click={revert}>Revert</button>
6360
</div>

0 commit comments

Comments
 (0)