refac: rich text input behaviour

This commit is contained in:
Timothy Jaeryang Baek 2024-11-23 20:31:33 -08:00
parent 5ed5e532a9
commit c567185cb1
2 changed files with 15 additions and 2 deletions

View File

@ -231,6 +231,16 @@ input[type='number'] {
@apply dark:bg-gray-800 bg-gray-100;
}
.tiptap p code {
color: #eb5757;
border-width: 0px;
padding: 3px 8px;
font-size: 0.8em;
font-weight: 600;
@apply rounded-md dark:bg-gray-800 bg-gray-100 mx-0.5;
}
/* Code styling */
.hljs-comment,
.hljs-quote {

View File

@ -1,7 +1,10 @@
<script lang="ts">
import { marked } from 'marked';
import TurndownService from 'turndown';
const turndownService = new TurndownService();
const turndownService = new TurndownService({
codeBlockStyle: 'fenced'
});
turndownService.escape = (string) => string;
import { onMount, onDestroy } from 'svelte';
import { createEventDispatcher } from 'svelte';
@ -154,7 +157,7 @@
const newValue = turndownService.turndown(editor.getHTML());
if (value !== newValue) {
value = newValue; // Trigger parent updates
value = newValue;
}
},
editorProps: {