{% extends 'theme_' ~ constant('config_theme') ~ '/base.html.twig' %}
{% block maincontent %}
<div class="container">
<iframe class="w-100" id="chili-iframe" onload="iFrameLoaded()" src="{{ url }}"></iframe>
<input type="hidden" id="chilidocument_id" value="{{ docid }}">
<button id="saveeditordocumentbutton" disabled="disabled" type="button" class="btn btn-success btn-fill" style="display:none;" onclick="saveEditorDocument()">Lagre</button>
</div>
{% endblock %}
{% block footer %}
{% endblock %}
{% block bodyjavascript %}
<script>
$.LoadingOverlay('show');
function saveEditorDocument() {
toggleFullOverlayTo('show');
var chilidocument_id = $('#chilidocument_id').val();
var chili_xml = editor.ExecuteFunction('document','GetTempXML');
var postdata = 'chilidocument_id=' + chilidocument_id + '&chili_xml=' + encodeURIComponent(chili_xml);
$.post('/saveChilidocumentToBasket', postdata, function(json) {
try {
logg(json);
updateNumInBasket();
toggleFullOverlayTo('hide');
} catch(e) {
console.log(e);
}
});
}
function loaddocument() {
editor.ExecuteFunction('document','OpenDocumentFromXml','{{ docxml | raw }}','','','');
}
theInterval = setInterval(function() {
if (typeof editor !== 'undefined') {
clearInterval(theInterval);
loaddocument();
toggleFullOverlayTo('hide');
} else {
// Wait 1 sec...
logg('Waiting for editor');
}
}, 1000);
</script>
{% endblock %}