refac: deprecate event dispatcher

This commit is contained in:
Timothy Jaeryang Baek
2025-04-18 02:38:53 -07:00
parent 64a98b2e0e
commit a86a932b46
3 changed files with 12 additions and 25 deletions
@@ -1,6 +1,6 @@
<script lang="ts">
import DOMPurify from 'dompurify';
import { createEventDispatcher, onMount, getContext } from 'svelte';
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');
import fileSaver from 'file-saver';
@@ -22,8 +22,6 @@
import Source from './Source.svelte';
import { settings } from '$lib/stores';
const dispatch = createEventDispatcher();
export let id: string;
export let tokens: Token[];
export let top = true;
@@ -31,6 +29,9 @@
export let save = false;
export let onUpdate: Function = () => {};
export let onCode: Function = () => {};
export let onTaskClick: Function = () => {};
export let onSourceClick: Function = () => {};
@@ -93,11 +94,9 @@
code={token?.text ?? ''}
{attributes}
{save}
onCode={(value) => {
dispatch('code', value);
}}
{onCode}
onSave={(value) => {
dispatch('update', {
onUpdate({
raw: token.raw,
oldContent: token.text,
newContent: value