From e03594c22e200fb9dd1ffd0d8db594df6ebf1934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drix?= Date: Sat, 16 May 2026 13:01:46 +0200 Subject: [PATCH] =?UTF-8?q?fix=20:=20boutons=20IA=20dans=20wizard/step1.ph?= =?UTF-8?q?p=20(=C3=A9diteur=20r=C3=A9el)=20+=20adaptation=20ids=20textare?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit post_form.php n'était jamais inclus — les boutons IA sont ajoutés dans la vraie page d'édition (wizard/step1.php). ai-editor.js cherche #wz-content en priorité et extrait le titre depuis la première ligne # du Markdown. Co-Authored-By: Claude Sonnet 4.6 --- public/assets/js/ai-editor.js | 12 +++++++++--- templates/wizard/step1.php | 36 ++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/public/assets/js/ai-editor.js b/public/assets/js/ai-editor.js index 43cc1d9..5d0e3b8 100644 --- a/public/assets/js/ai-editor.js +++ b/public/assets/js/ai-editor.js @@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', function () { var resultEl = document.getElementById('ai-result-content'); var btnApply = document.getElementById('btn-ai-apply'); var btnClose = document.getElementById('btn-ai-close'); - var ta = document.getElementById('content'); + var ta = document.getElementById('wz-content') || document.getElementById('content'); var titleEl = document.getElementById('title'); var lastRewrite = ''; @@ -33,13 +33,19 @@ document.addEventListener('DOMContentLoaded', function () { lastRewrite = ''; try { + var titleVal = titleEl ? titleEl.value : ''; + if (!titleVal && ta) { + var m = ta.value.match(/^#\s+(.+)/m); + if (m) { titleVal = m[1].trim(); } + } + var res = await fetch('/?action=ai_query', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ action: action, - title: titleEl ? titleEl.value : '', - content: ta ? ta.value : '', + title: titleVal, + content: ta ? ta.value : '', }), }); diff --git a/templates/wizard/step1.php b/templates/wizard/step1.php index 367143d..0b77541 100644 --- a/templates/wizard/step1.php +++ b/templates/wizard/step1.php @@ -49,15 +49,44 @@ $_hasUuid = $_wizUuid !== ''; - +
-
+
Plan
-
+
    + + +
    +
    IA
    +
    +
    + + +
    + +
    +
    +
    @@ -172,4 +201,5 @@ $_hasUuid = $_wizUuid !== '';