implemented synchronisation between editors:

whenever one editable field is activated, any other active editable field is resetted
This commit is contained in:
2025-07-11 23:53:58 +02:00
parent e3e4dc16f9
commit d3f2f92aee
5 changed files with 23 additions and 0 deletions

View File

@@ -1,4 +1,6 @@
<script>
import { activeField } from './field_sync.svelte.js';
let { editable = false, currency, value = $bindable(null) } = $props();
let editing = $state(false);
@@ -15,6 +17,7 @@
}
function startEdit(){
activeField.update((n) => n+1);
editing = editable;
}
@@ -22,6 +25,8 @@
if (ev.keyCode == 13) applyEdit();
if (ev.keyCode == 27) resetEdit();
}
activeField.subscribe((val) => resetEdit());
</script>
<style>