refactor: standardize 'prevent_default' helpers and batch format modules
- Renamed internal 'preventDefault' helpers to 'prevent_default' for project-wide snake_case consistency. - Corrected native event method calls from 'prevent_default()' to 'preventDefault()' to resolve runtime TypeErrors. - Applied batch formatting (printWidth: 80) to Journals and IDAA Recovery Meetings modules. - Removed deprecated 'preventDefault' imports from svelte/legacy. - Fixed Journal Entry 404 by migrating loader to V3 API helper.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import { createEventDispatcher, onMount, tick } from 'svelte';
|
||||
|
||||
@@ -50,6 +50,13 @@
|
||||
console.log('** Element Mounted: ** Element Input File');
|
||||
});
|
||||
|
||||
function prevent_default<T extends Event>(fn: (event: T) => void) {
|
||||
return function (event: T) {
|
||||
event.prevent_default();
|
||||
fn(event);
|
||||
};
|
||||
}
|
||||
|
||||
async function process_file_list(file_list: FileList | null) {
|
||||
console.log('*** process_file_list() ***');
|
||||
|
||||
@@ -388,7 +395,7 @@
|
||||
<tr>
|
||||
<td class="file_remove">
|
||||
<button
|
||||
onclick={preventDefault(() => {
|
||||
onclick={prevent_default(() => {
|
||||
remove_file_from_filelist(file_index);
|
||||
})}
|
||||
class="btn btn-md preset-tonal-warning hover:preset-filled-secondary-500 m-1"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
ws_sent_status = $bindable(null)
|
||||
}: Props = $props();
|
||||
|
||||
// import { run, preventDefault } from 'svelte/legacy';
|
||||
// import { run, prevent_default } from 'svelte/legacy';
|
||||
// import { createEventDispatcher, onMount } from 'svelte';
|
||||
|
||||
// *** Set initial variables
|
||||
@@ -361,9 +361,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
function preventDefault<T extends Event>(fn: (event: T) => void) {
|
||||
function prevent_default<T extends Event>(fn: (event: T) => void) {
|
||||
return function (event: T) {
|
||||
event.preventDefault();
|
||||
event.prevent_default();
|
||||
fn(event);
|
||||
};
|
||||
}
|
||||
@@ -425,7 +425,7 @@
|
||||
<h1 class="h6 text-center">Websocket Messages & Commands</h1>
|
||||
</header>
|
||||
|
||||
<!-- <form on:submit|preventDefault={handle_send_message}>
|
||||
<!-- <form on:submit|prevent_default={handle_send_message}>
|
||||
<select bind:value={type}>
|
||||
<option value="">None</option>
|
||||
<option value="echo">Echo</option>
|
||||
@@ -448,7 +448,7 @@
|
||||
</form> -->
|
||||
|
||||
{#if !hide__ws_form}
|
||||
<form onsubmit={preventDefault(handle_send_ws_data)}>
|
||||
<form onsubmit={prevent_default(handle_send_ws_data)}>
|
||||
<select bind:value={ws_data.type} class="input text-sm w-24">
|
||||
<option value="">None</option>
|
||||
<option value="echo">Echo</option>
|
||||
|
||||
Reference in New Issue
Block a user