fixed conflict between textarea require and tinymce
This commit is contained in:
@@ -17,20 +17,23 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<form method="post" action="{{ action }}">
|
{# Formulaire identifié pour le script JavaScript #}
|
||||||
|
<form id="articleForm" method="post" action="{{ action }}">
|
||||||
<p>
|
<p>
|
||||||
<label>Titre<br>
|
<label>Titre<br>
|
||||||
<input type="text" name="title"
|
<input type="text" name="title"
|
||||||
value="{{ post.title|default('') }}" required>
|
value="{{ post.title|default('') }}" required>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label>Contenu<br>
|
<label>Contenu<br>
|
||||||
<textarea id="editor" name="content" rows="6" required>{{ post.content|default('') }}</textarea>
|
<textarea id="editor" name="content" rows="6" {# required <- removed because conflicts with TinyMCE#}>{{ post.content|default('') }}</textarea>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
{% if post is defined %}Mettre à jour{% else %}Enregistrer{% endif %}
|
{% if post is defined and post.id is defined %}Mettre à jour{% else %}Enregistrer{% endif %}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -38,24 +41,28 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{# TinyMCE #}
|
<script src="/js/tinymce/tinymce.min.js" referrerpolicy="origin" crossorigin="anonymous"></script>
|
||||||
<script src="/js/tinymce/tinymce.min.js" referrerpolicy="origin" crossorigin="anonymous"></script>
|
<script>
|
||||||
<script>
|
tinymce.init({
|
||||||
tinymce.init({
|
selector: '#editor',
|
||||||
selector: '#editor', // id du textarea
|
base_url: '/js/tinymce', // assure le bon chemin relatif
|
||||||
license_key: 'gpl', // self-host TinyMCE under the GPL license and agree to its terms
|
license_key: 'gpl',
|
||||||
height: 400,
|
height: 400,
|
||||||
menubar: false,
|
menubar: false,
|
||||||
plugins: [
|
plugins: [
|
||||||
'advlist autolink lists link image charmap preview anchor',
|
'advlist', 'autolink', 'lists', 'link', 'image',
|
||||||
'searchreplace visualblocks code fullscreen',
|
'charmap', 'preview', 'anchor', 'searchreplace',
|
||||||
'insertdatetime media table paste code help wordcount'
|
'visualblocks', 'code', 'fullscreen',
|
||||||
],
|
'insertdatetime', 'media', 'table',
|
||||||
toolbar: 'undo redo | formatselect | bold italic underline | ' +
|
'help', 'wordcount'
|
||||||
'alignleft aligncenter alignright alignjustify | ' +
|
],
|
||||||
'bullist numlist outdent indent | link image media | ' +
|
toolbar: [
|
||||||
'removeformat | help',
|
'undo redo | formatselect | bold italic underline |',
|
||||||
content_style: 'body {font-family:Helvetica,Arial,sans-serif;font-size:14px}'
|
'alignleft aligncenter alignright alignjustify |',
|
||||||
});
|
'bullist numlist outdent indent | link image media |',
|
||||||
</script>
|
'removeformat | help'
|
||||||
|
].join(' '),
|
||||||
|
content_style: 'body {font-family:Helvetica,Arial,sans-serif;font-size:14px}'
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user