{#
    This template defines extra_head and data_editor macros that are selected
    within content.py based on the item's content type.
    Both will be passed to the modify.html template.

    The extra_head macro loads javascript and css files required by the CKEditor.

    The data_editor macro defines the textarea used by the CKEditor to edit HTML items.
#}

{% macro extra_head() %}
    <script type="text/javascript" src="{{ url_for('serve.files', name='ckeditor', filename='ckeditor.js') }}"></script>
    <link rel="stylesheet" href="{{ url_for('serve.files', name='ckeditor', filename='contents.css') }}">
    {#- prevent ckeditor css from making body font-size 12px #}
    <style>body {font-size: 1em;}</style>
{% endmacro %}

{% macro data_editor(form, item_name) %}
    {{ gen.textarea(form['data_text'], class='ckeditor', rows=form.rows|string, cols=form.cols|string) }}
{% endmacro %}
