{% load seahub_tags i18n %}

<head>
<title>{{doc_title}}</title>
<link rel="icon" href="{{ MEDIA_URL }}{{ favicon_path }}" />
<style type="text/css">
html, body { padding:0; margin:0; }
</style>
</head>

{% block main_content %}
<div id="placeholder"></div>
{% endblock %}

{% get_current_language as LANGUAGE_CODE %}
{% block extra_script %}
<script type="text/javascript" src="{{ ONLYOFFICE_APIJS_URL }}"></script>
<script type="text/javascript">


var config = {
    "document": {
        "fileType": "{{ file_type }}",
        "key": "{{doc_key}}",
        "title": "{{doc_title}}",
        "url": "{{doc_url}}",
        "permissions": {
            "download": true,
            "edit": {% if can_edit %}true{% else %}false{% endif %},
            "print": true,
            "review": true
        },
    },
    "documentType": "{{document_type}}", // 'text' | 'spreadsheet' | 'presentation',
    "editorConfig": {
        "callbackUrl": "{{ callback_url }}",
        "lang": "{{ LANGUAGE_CODE }}",
        "mode": {% if can_edit %}"edit"{% else %}"view"{% endif %},
        "user": {
            "name": "{{ username|email2nickname }}"
        }
    },
};
var docEditor = new DocsAPI.DocEditor("placeholder", config);
</script>
{% endblock %}
