From 30c133b81d55250bb5fe363f1196a1bc32bd5fe0 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 30 Dec 2025 09:48:25 +0100 Subject: =?UTF-8?q?link=5Ftitle=20false,=20fonction=20images=5Fupload=5Fha?= =?UTF-8?q?ndler=20d=C3=A9plac=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'public') diff --git a/public/index.php b/public/index.php index db73276..d32dfff 100644 --- a/public/index.php +++ b/public/index.php @@ -239,6 +239,13 @@ elseif(isset($_GET['action']) && $_GET['action'] == 'upload_image_base64'){ menubar: false, toolbar_mode: 'wrap', statusbar: false, + link_title: false, // supprime le champ compliqué "titre" (apparaît au survol du lien) dans la fenêtre "link" + /*link_attributes_postprocess: (attrs) => { // modifier les attributs des liens créés + console.log(attrs); + if (attrs.rel) { + attrs.rel += 'noreferrer'; // cacher la page d'où on vient + } + },*/ //paste_data_images: true, setup: function (editor) { editor.on('init', function () { @@ -348,27 +355,7 @@ elseif(isset($_GET['action']) && $_GET['action'] == 'upload_image_base64'){ }); }, // upload d'image natif de tinymce avec le bouton "Insérer une image" - images_upload_handler: (blobInfo, progress) => new Promise((resolve, reject) => { - const formData = new FormData(); - formData.append("file", blobInfo.blob()); - - fetch('index.php?action=upload_image', { - method: 'POST', - body: formData - }) - .then(response => response.json()) - .then(data => { - if(data.location) { - resolve(data.location); - } - else { - reject("Erreur: Chemin d'image invalide"); - } - }) - .catch(error => { - reject("Erreur lors de l'upload"); - }); - }), + images_upload_handler: images_upload_handler, // = fonction fléchée image_caption: true }); @@ -376,6 +363,28 @@ elseif(isset($_GET['action']) && $_GET['action'] == 'upload_image_base64'){ document.getElementById(articleId).innerHTML = articleContent; } + const images_upload_handler = (blobInfo, progress) => new Promise((resolve, reject) => { + const formData = new FormData(); + formData.append("file", blobInfo.blob()); + + fetch('index.php?action=upload_image', { + method: 'POST', + body: formData + }) + .then(response => response.json()) + .then(data => { + if(data.location) { + resolve(data.location); + } + else { + reject("Erreur: Chemin d'image invalide"); + } + }) + .catch(error => { + reject("Erreur lors de l'upload"); + }); + }); + function deleteArticle(articleId) { if (confirm('Voulez-vous vraiment supprimer cet article ?')) { // Envoyer une requête au serveur pour supprimer l'article -- cgit v1.2.3