{% extends "page.html" %}
{% block breadcrumb %}<a href="/service/documents/">Документация</a> / Редактирование{% endblock %}
{% block page_actions %}<a href="/service/documents/{{ doc.filename | replace('.md', '') }}" class="btn btn-secondary btn-sm">← Назад</a>{% endblock %}
{% block page_content %}
<div class="card" style="padding-bottom:0">
    <form method="post" action="/service/documents/{{ doc.filename | replace('.md', '') }}/edit">
        <div class="form-group" style="margin-bottom:0">
            <textarea id="editor" name="content">{{ content }}</textarea>
        </div>
        <div class="form-actions edit-form-actions">
            <button type="submit" class="btn btn-primary">Сохранить</button>
            <a href="/service/documents/{{ doc.filename | replace('.md', '') }}" class="btn btn-secondary">Отмена</a>
        </div>
    </form>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css">
<script src="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.js"></script>
<script>
    const easyMDE = new EasyMDE({
        element: document.getElementById('editor'),
        spellChecker: false,
        autosave: {
            enabled: true,
            uniqueId: "{{ doc.filename }}",
            delay: 1000,
        },
    });
</script>
{% endblock %}
