Seems to be working still... Trying to update packages.

This commit is contained in:
Scott Idem
2025-12-05 14:50:06 -05:00
parent b3bad26d8f
commit 1fc58eb18f
6 changed files with 57 additions and 73 deletions

View File

@@ -43,8 +43,8 @@
let editor_element: HTMLDivElement = $state();
let editorView: any = $state(); // Changed to any
let cm_modules: any = $state(); // To hold the dynamically loaded CodeMirror modules
let editor_extensions: any[] = $state([]);
async function initializeCodeMirror() {
if (!browser) return;
@@ -53,7 +53,7 @@
if (!cm_modules) return;
// Reactive declaration for extensions
let editor_extensions = [
editor_extensions = [
// Core extensions
cm_modules.highlightSpecialChars(),
cm_modules.history(),
@@ -122,14 +122,11 @@
});
// Update editor content when `content` prop changes
run(() => {
if (cm_modules && editorView && editorView.state.doc.toString() !== content) {
editorView.setState(
cm_modules.EditorState.create({
doc: content,
extensions: editor_extensions // Use the reactive extensions
})
);
$effect(() => {
if (editorView && content !== editorView.state.doc.toString()) {
editorView.dispatch({
changes: { from: 0, to: editorView.state.doc.length, insert: content || '' }
});
}
});
</script>

View File

@@ -11,6 +11,13 @@
let { event_id, template_id = null }: Props = $props();
function preventDefault<T extends Event>(fn: (event: T) => void) {
return function (event: T) {
event.preventDefault();
fn(event);
};
}
const dispatch = createEventDispatcher();
// Form fields
@@ -121,7 +128,7 @@
}
</script>
<form onsubmit|preventDefault={handle_submit} class="p-4 space-y-4">
<form onsubmit={preventDefault(() => {handle_submit})} class="p-4 space-y-4">
<h3 class="h3">{template_id ? 'Edit' : 'Create New'} Badge Template</h3>
<label class="label">

View File

@@ -3100,9 +3100,6 @@ zzzz
preset-outlined-success-400-600
shadow-lg rounded-lg
"
on:change={(e) => {
$journals_loc.entry.llm__system_prompt = e.detail;
}}
/>
</label>
</div>

View File

@@ -344,13 +344,10 @@
show_line_numbers={false}
placeholder="LLM System Prompt"
class="
p-1
preset-outlined-success-400-600
shadow-lg rounded-lg
"
on:change={(e) => {
$journals_loc.entry.llm__system_prompt = e.detail;
}}
p-1
preset-outlined-success-400-600
shadow-lg rounded-lg
"
/>
</label>