From f60eaac74c1a89a19230b76b7236109c1b6446bc Mon Sep 17 00:00:00 2001 From: mgreminger Date: Sun, 15 Dec 2024 13:34:50 -0600 Subject: [PATCH] refactor: port Cell and InsertCell to runes mode This should fix the insert sheet regression --- src/Cell.svelte | 55 +++++++++++++++++++------------------- src/CellList.svelte | 4 +-- src/InsertCell.svelte | 61 ++++++++++++++++++++++--------------------- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/Cell.svelte b/src/Cell.svelte index b134949a..1a6e29fa 100644 --- a/src/Cell.svelte +++ b/src/Cell.svelte @@ -1,5 +1,5 @@ @@ -192,7 +192,7 @@
moveUp(index)} title="Move Cell Up" > @@ -202,8 +202,8 @@ moveDown(index)} title="Move Cell Down" > @@ -224,9 +224,8 @@ - - - + +
{:else if cell instanceof InsertCell} deleteCell(index)} title="Delete Cell" > diff --git a/src/CellList.svelte b/src/CellList.svelte index fac8239f..5ecc4941 100644 --- a/src/CellList.svelte +++ b/src/CellList.svelte @@ -212,8 +212,8 @@ > - import { onMount, onDestroy, createEventDispatcher } from 'svelte'; + import { onMount, onDestroy } from 'svelte'; import type InsertCell from "./cells/InsertCell"; import { cells, activeCell, results, system_results, mathCellChanged, inCellInsertMode, addCell, onMobile, modifierKey } from "./stores"; @@ -16,26 +16,27 @@ import RainDrop from "carbon-icons-svelte/lib/RainDrop.svelte"; import DataTable from "carbon-icons-svelte/lib/DataTable.svelte"; - export let index: number; - export let insertCell: InsertCell; + interface Props { + index: number; + insertCell: InsertCell; + insertSheet: (arg: {index: number}) => void; + } + + let { index, insertCell, insertSheet }: Props = $props(); const timeout = 30000; const delta = 50; - let currentTime = timeout; + let currentTime = $state(timeout); let intervalId = null; let buttonArray: HTMLElement[] = []; - const dispatch = createEventDispatcher(); - export function getMarkdown() { return ""; } - function insertSheet() { + function dispatchInsertSheet() { deleteMyself(); - dispatch('insertSheet', { - index: index - }); + insertSheet( {index: index} ); } onMount(() => { @@ -177,9 +178,9 @@