Use a web component for easymde

* Bump tsconfig output to es6
* Fix wrong import behavior on typescript according to webpack's doc
* Create an easymde component
This commit is contained in:
2024-10-14 17:46:39 +02:00
committed by Bartuccio Antoine
parent a68e47ce8c
commit 670d2fa12e
4 changed files with 199 additions and 190 deletions

View File

@ -1,13 +1,7 @@
<div>
<textarea name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea>
<textarea is="markdown-input" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea>
{# The easymde script can be included twice, it's safe in the code #}
<script src="{{ statics.js }}" defer> </script>
<link rel="stylesheet" type="text/css" href="{{ statics.css }}" defer>
<script type="text/javascript">
addEventListener("DOMContentLoaded", (event) => {
easymdeFactory(
document.getElementById("{{ widget.attrs.id }}"));
})
</script>
</div>