<script>
    import LineEditor from '../../Components/LineEditor.svelte';
    import { org } from '../../vcard.js';
    import { t } from '../../translations.svelte';

    let { code, patch = (from, to) => true } = $props();

    let value = $derived(org(code));

    function onSet(newVal){
        const newCode = code.replace(value,newVal);
        return patch(code,newCode);
    }
</script>

{#if value}
<LineEditor wrapper="span" editable={true} {value} {onSet} title={t('organization')}/>
{/if}