<div class="text-center mx-auto">
<button class="btn btn-success"
	onclick="saveText()"
	hx-post='{% if page %}/{{ page }}{% endif %}/edit/{{ bloc.name }}'
	hx-swap="outerHTML swap:100ms"
	hx-target="#{{ bloc.name }}" > Enregistrer </button>


<button class="btn btn-danger"
	onclick="enableModBtn()"
	hx-get="{% if page %}/{{ page }}{% endif %}/view/{{ bloc.name }}"
	hx-swap="outerHTML"
	hx-target="#{{ bloc.name }}" > Annuler </button>
</div>
<script>
	function enableModBtn(){
		document.getElementById("modify-{{ bloc.name }}").disabled = false;
	}

	function saveText(){
		
		editor_content = document.getElementById("editor");
		if (editor_content != null)
		{
			document.getElementById("text").innerHTML = quill.getSemanticHTML(0);
			delete quill;
		}
		enableModBtn();

	}
</script>
