<script>
    import Codemirror from "../../libs/CodemirrorMarkdown.svelte";
    import { getErrorMessage } from "./errorMessage";


    export let value;
    export let field;
    export let isCreateMode;
    // export let id;
    export let validationErrors;
    $: errorMessage = getErrorMessage(validationErrors, field.name);
    
</script>

<div class="mb-3">
    
    <Codemirror bind:value editable={!field.readonly || isCreateMode} />

    {#if errorMessage}
        <div class="invalid-feedback d-block">
            {errorMessage}
        </div>
    {/if}
</div>
