Minor changes

This commit is contained in:
Scott Idem
2025-05-13 17:54:23 -04:00
parent 24e1190874
commit e96675174f
4 changed files with 15 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
// *** Import Svelte version 5 specific
import { browser } from '$app/environment';
import { onMount, onDestroy, createEventDispatcher } from 'svelte';
import { onMount, onDestroy } from 'svelte';
import {
EditorView, keymap, highlightSpecialChars, drawSelection,
highlightActiveLine, dropCursor, rectangularSelection,
@@ -38,8 +38,10 @@ import { languages } from '@codemirror/language-data';
// import { } from '@codemirror/gutter'; // Merged into @codemirror/view
import { basicSetup } from 'codemirror';
import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
import { javascript } from '@codemirror/lang-javascript';
import { json } from '@codemirror/lang-json';
// import { css } from '@codemirror/lang-css';
// import { javascript } from '@codemirror/lang-javascript';
// import { json } from '@codemirror/lang-json';
// import { html } from '@codemirror/lang-html';
import { oneDark } from "@codemirror/theme-one-dark";
// Props
@@ -64,8 +66,6 @@ export let tab_size: number = 4;
let classes = "";
export { classes as class };
const dispatch = createEventDispatcher<{ change: string }>();
let editor_element: HTMLDivElement;
let editorView: EditorView;
@@ -152,8 +152,10 @@ $: editor_extensions = [
// placeholderExt(placeholder),
// language,
markdown({base: markdownLanguage, codeLanguages: languages}),
javascript({typescript: true}),
json({ jsx: true }),
// javascript({typescript: true}),
// json(),
// css(),
// html(),
theme,
...extensions
@@ -193,7 +195,7 @@ onMount(() => {
if (transaction.docChanged) {
new_content = editorView.state.doc.toString();
const newContent = editorView.state.doc.toString();
dispatch('change', newContent);
// dispatch('change', newContent);
}
}
});