<div id="editor-content">
    <form class="editor-form" {{if not .IsHome}}hx-post="/api/notes/{{.Filename}}" hx-swap="none"{{end}}>
        <div class="editor-header">
            <label for="editor">
                {{if .IsHome}}
                    <strong>{{.Filename}}</strong>
                {{else}}
                    Édition de&nbsp;: <strong>{{.Filename}}</strong>
                    <span id="auto-save-status" class="auto-save-status"></span>
                {{end}}
            </label>
            {{if .IsHome}}
                <button type="button" class="toggle-preview-btn" hx-get="/api/home" hx-target="#editor-container" hx-swap="innerHTML" title="Actualiser la page d'accueil">
                    🔄 Actualiser
                </button>
            {{else}}
                <button type="button" id="toggle-preview-btn" class="toggle-preview-btn" onclick="togglePreview()" title="Mode: Éditeur + Preview (cliquer pour Éditeur seul)">
                    ◫ Split
                </button>
            {{end}}
        </div>
        <div class="editor-grid {{if .IsHome}}editor-hidden{{end}}" id="editor-grid">
            <div class="editor-panel {{if .IsHome}}hidden{{end}}">
                <textarea id="editor" name="content">{{.Content}}</textarea>
            </div>
            <div id="preview" class="preview markdown-preview">
            </div>
        </div>
        {{if not .IsHome}}
        <div class="editor-actions">
            <div class="editor-actions-primary">
                <button type="submit">Enregistrer</button>
                <button
                    hx-delete="/api/notes/{{.Filename}}"
                    hx-confirm="Êtes-vous sûr de vouloir supprimer cette note ({{.Filename}}) ?"
                    hx-target="#editor-container"
                    hx-swap="innerHTML"
                    class="secondary"
                    type="button"
                >
                    Supprimer
                </button>
            </div>
            <span id="save-status" class="save-status"></span>
        </div>
        {{end}}
    </form>
</div>