working on document editor
This commit is contained in:
19
frontend/src/Components/LineEditor.svelte
Normal file
19
frontend/src/Components/LineEditor.svelte
Normal file
@@ -0,0 +1,19 @@
|
||||
<script>
|
||||
let { editable = false, value = $bindable(null) } = $props();
|
||||
let editing = $state(false);
|
||||
|
||||
function toggleEdit(){
|
||||
editing = !editing;
|
||||
}
|
||||
|
||||
function typed(ev){
|
||||
if (ev.keyCode == 13) toggleEdit();
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if editable && editing}
|
||||
<input bind:value onkeyup={typed} />
|
||||
{:else}
|
||||
<div onclick={toggleEdit}>{value}</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user