Mise en place tinymce dans accueil blog avec clé et domaine
This commit is contained in:
@@ -17,8 +17,9 @@ form.addEventListener('submit', function(e) {
|
||||
|
||||
const titre = titleField.value.trim().toLowerCase();
|
||||
const fichierImage = imgField.files[0];
|
||||
const contenu = tinymce.get("articleContent").getContent(); // ← CORRECTION IMPORTANTE
|
||||
const contenu = tinymce.get("articleContent").getContent();
|
||||
const categorie = categoryField.value;
|
||||
const published = publishedField.checked; // ← récupère la case cochée
|
||||
|
||||
// Reset messages
|
||||
errorEmpty.classList.add('d-none');
|
||||
@@ -62,9 +63,30 @@ form.addEventListener('submit', function(e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Simuler enregistrement
|
||||
// Simuler enregistrement (ancienne logique)
|
||||
titreExistants.push(titre);
|
||||
|
||||
// -------------------------------
|
||||
// 📌 CRÉATION DE L'ARTICLE
|
||||
// -------------------------------
|
||||
const nouvelArticle = {
|
||||
id: Date.now(),
|
||||
titre: titleField.value.trim(),
|
||||
contenu: contenu,
|
||||
categorie: categorie,
|
||||
published: published, // ← valeur TRUE/FALSE pour afficher le badge Facebook
|
||||
date: new Date().toISOString()
|
||||
};
|
||||
|
||||
// --------------------------------
|
||||
// 📌 SAUVEGARDE DANS LOCALSTORAGE
|
||||
// --------------------------------
|
||||
let articles = JSON.parse(localStorage.getItem("articles")) || [];
|
||||
articles.push(nouvelArticle);
|
||||
localStorage.setItem("articles", JSON.stringify(articles));
|
||||
|
||||
console.log("Article enregistré :", nouvelArticle);
|
||||
|
||||
// Succès
|
||||
successMsg.classList.remove('d-none');
|
||||
|
||||
@@ -74,11 +96,11 @@ form.addEventListener('submit', function(e) {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
// TinyMCE
|
||||
// TinyMCE INIT
|
||||
tinymce.init({
|
||||
selector: '#articleContent',
|
||||
height: 400,
|
||||
language: 'fr',
|
||||
plugins: 'lists fullscreen',
|
||||
toolbar: 'undo redo | bold italic underline | bullist numlist | fullscreen',
|
||||
toolbar: 'undo redo | bold italic underline | bullist numlist | fullscreen'
|
||||
});
|
||||
|
||||
3
package-lock.json
generated
3
package-lock.json
generated
@@ -76,8 +76,7 @@
|
||||
"node_modules/scheduler": {
|
||||
"version": "0.27.0",
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
|
||||
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
|
||||
"peer": true
|
||||
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="
|
||||
},
|
||||
"node_modules/tinymce": {
|
||||
"version": "8.2.2",
|
||||
|
||||
Reference in New Issue
Block a user