implemented synchronisation between editors:
whenever one editable field is activated, any other active editable field is resetted
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user