diff options
Diffstat (limited to 'public/code minimal.html')
| -rw-r--r-- | public/code minimal.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/public/code minimal.html b/public/code minimal.html new file mode 100644 index 0000000..ae9fb08 --- /dev/null +++ b/public/code minimal.html | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | <!DOCTYPE html> | ||
| 2 | <html lang="fr"> | ||
| 3 | <head> | ||
| 4 | <meta charset="UTF-8"> | ||
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 6 | <title>TinyMCE Editor</title> | ||
| 7 | <style> | ||
| 8 | .tox-promotion{ | ||
| 9 | display: none; | ||
| 10 | } | ||
| 11 | </style> | ||
| 12 | <script src="node_modules/tinymce/tinymce.min.js"></script> | ||
| 13 | <script> | ||
| 14 | tinymce.init({ | ||
| 15 | selector: '#mytextarea', | ||
| 16 | language: 'fr_FR', // télécharger le paquet correspondant ici: https://www.tiny.cloud/get-tiny/language-packages/ | ||
| 17 | license_key: 'gpl', | ||
| 18 | branding: false | ||
| 19 | }); | ||
| 20 | |||
| 21 | // Récupérer le contenu de l'éditeur TinyMCE | ||
| 22 | // event.preventDefault() empêche l'envoi normal d'un GET ou POST au serveur | ||
| 23 | function submitForm() { | ||
| 24 | var content = tinymce.get('mytextarea').getContent(); | ||
| 25 | console.log(content); | ||
| 26 | |||
| 27 | // envoi du contenu au serveur ici, avec fetch ou XMLHttpRequest | ||
| 28 | } | ||
| 29 | </script> | ||
| 30 | </head> | ||
| 31 | <body> | ||
| 32 | <h1>Mon éditeur TinyMCE</h1> | ||
| 33 | <form onsubmit="event.preventDefault(); submitForm();"> | ||
| 34 | <textarea id="mytextarea">Bonjour, ceci est un éditeur TinyMCE !</textarea> | ||
| 35 | <br> | ||
| 36 | <button type="submit">Soumettre</button> | ||
| 37 | </form> | ||
| 38 | </body> | ||
| 39 | </html> | ||
